equal
deleted
inserted
replaced
50 event.stanza, "modify", "bad-request", "Invalid encryption key" |
50 event.stanza, "modify", "bad-request", "Invalid encryption key" |
51 )); |
51 )); |
52 return false; |
52 return false; |
53 end |
53 end |
54 |
54 |
|
55 module:log("debug", "Encrypted push notifications enabled"); |
|
56 |
55 event.push_info.encryption = { |
57 event.push_info.encryption = { |
56 algorithm = algorithm; |
58 algorithm = algorithm; |
57 key_base64 = key_base64; |
59 key_base64 = key_base64; |
58 }; |
60 }; |
59 end |
61 end |
60 |
62 |
61 function handle_push(event) |
63 function handle_push(event) |
62 local encryption = event.push_info.encryption; |
64 local encryption = event.push_info.encryption; |
63 if not encryption then return; end |
65 if not encryption then |
|
66 module:log("debug", "Encryption not enabled for this notification"); |
|
67 return; |
|
68 end |
64 |
69 |
65 if encryption.algorithm ~= "aes-128-gcm" then |
70 if encryption.algorithm ~= "aes-128-gcm" then |
66 event.reason = "Unsupported encryption algorithm: "..tostring(encryption.algorithm); |
71 event.reason = "Unsupported encryption algorithm: "..tostring(encryption.algorithm); |
67 return true; |
72 return true; |
68 end |
73 end |