Software /
code /
prosody-modules
Comparison
mod_cloud_notify_encrypted/mod_cloud_notify_encrypted.lua @ 5054:62480053c87b
mod_cloud_notify_encrypted: Additional debug logging when enabling/skipping
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 23 Sep 2022 22:41:15 +0100 |
parent | 4651:8231774f5bfd |
child | 5055:3b609eaf0db5 |
comparison
equal
deleted
inserted
replaced
5053:00e8cc6860cb | 5054:62480053c87b |
---|---|
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 |