fix (backend-rs): convert base64 encoded keys into base64url

This commit is contained in:
naskya 2024-04-23 08:34:56 +09:00
parent 6442364341
commit 3f399bc067
No known key found for this signature in database
GPG Key ID: 712D413B3A9FED5C
1 changed files with 4 additions and 2 deletions

View File

@ -59,8 +59,10 @@ pub async fn send_push_notification(
let subscription = SubscriptionInfo {
endpoint: endpoint.to_owned(),
keys: SubscriptionKeys {
p256dh: publickey.to_owned(),
auth: auth.to_owned(),
// convert standard base64 into base64url
// https://en.wikipedia.org/wiki/Base64#Variants_summary_table
p256dh: publickey.replace('+', "-").replace('/', "_").to_owned(),
auth: auth.replace('+', "-").replace('/', "_").to_owned(),
},
};