# HG changeset patch # User Matthew Wild # Date 1610550119 0 # Node ID 97f369745ec76247570cc68a357ab8bd09defaf1 # Parent 7a5ca4b285cbda0b0f9a2f7a1c25dc790b8db4b8 mod_cloud_notify_encrypted: Use new direct access to notification element diff -r 7a5ca4b285cb -r 97f369745ec7 mod_cloud_notify_encrypted/mod_cloud_notify_encrypted.lua --- a/mod_cloud_notify_encrypted/mod_cloud_notify_encrypted.lua Wed Jan 13 15:00:41 2021 +0000 +++ b/mod_cloud_notify_encrypted/mod_cloud_notify_encrypted.lua Wed Jan 13 15:01:59 2021 +0000 @@ -94,15 +94,10 @@ local encrypted_payload = base64.encode(ciphers.new("AES-128-GCM"):encrypt(key_binary, iv):final(push_json)..string.rep("\0", 16)); local encrypted_element = st.stanza("encrypted", { xmlns = xmlns_push_encrypt, iv = base64.encode(iv) }) :text(encrypted_payload); - -- Replace the unencrypted notification with the encrypted one - event.notification_stanza - :get_child("pubsub", "http://jabber.org/protocol/pubsub") - :get_child("publish") - :get_child("item") - :remove_children("notification", xmlns_push) - :tag("notification", { xmlns = xmlns_push }) - :add_child(encrypted_element) - :up(); + -- Replace the unencrypted notification data with the encrypted one + event.notification_payload + :remove_children("x", "jabber:x:data") + :add_child(encrypted_element); end module:hook("cloud_notify/registration", handle_register);