Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove padding = from openssl base64 public key #70

Merged
merged 1 commit into from
Feb 13, 2025

Conversation

ducklol2
Copy link
Contributor

@ducklol2 ducklol2 commented Feb 7, 2025

When I attempt to register/subscribe to web push notifications, and the base64 public key contains padding (one or two = terminal characters) browsers yield these errors:

  • Chrome 132: "InvalidCharacterError: Failed to execute 'subscribe' on 'PushManager': The provided applicationServerKey is not encoded as base64url without padding."
  • Firefox 134: "DOMException: String contains an invalid character"

Simply deleting these seems to work for me, so this change adds = to the tr deleted character set in the public key openssl command.

For folks curious why this padding exists: https://en.wikipedia.org/wiki/Base64#Output_padding

When I attempt to register/subscribe to web push notifications, and the base64 public key contains padding (one or two `=` terminal characters) browsers yield these errors:

- Chrome 132: "_InvalidCharacterError: Failed to execute 'subscribe' on 'PushManager': The provided applicationServerKey is not encoded as base64url without padding._"
- Firefox 134: "_DOMException: String contains an invalid character_"

Simply deleting these seems to work for me, so this change adds `=` to the `tr` deleted character set in the public key `openssl` command.
@andyblarblar andyblarblar merged commit f8e00e0 into pimeys:master Feb 13, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants