Mercurial > prosody-modules
diff mod_push2/mod_push2.lua @ 5663:a1d22d6efb3d
mod_push2: Need to include the public key with the JWT
author | Stephen Paul Weber <singpolyma@singpolyma.net> |
---|---|
date | Wed, 20 Sep 2023 23:05:29 -0500 |
parents | bebb10fa5787 |
children | 4b052598e435 |
line wrap: on
line diff
--- a/mod_push2/mod_push2.lua Tue Sep 19 21:39:14 2023 -0500 +++ b/mod_push2/mod_push2.lua Wed Sep 20 23:05:29 2023 -0500 @@ -285,13 +285,14 @@ key = "-----BEGIN PRIVATE KEY-----\n"..key.."\n-----END PRIVATE KEY-----" end + local public_key = pkey.new(key):getParameters().pub_key:toBinary() local signer = jwt.new_signer(match.jwt_alg, key) local payload = {} for k, v in pairs(match.jwt_claims or {}) do payload[k] = v end payload.sub = contact_uri - push_notification_payload:text_tag("jwt", signer(payload)) + push_notification_payload:text_tag("jwt", signer(payload), { key = base64.encode(public_key) }) end local function handle_notify_request(stanza, node, user_push_services, log_push_decline)