web-push-go
web-push-go copied to clipboard
Base64 decoding problem of auth and p256dh
Hello.
I've been having some problems with some p256dh values and some auths that seem to have been created by the javascript end of the web push app that do not have a terminating "=" or "==" respectively.
The function used in the examples, base64.URLEncoding.DecodeString complains that there is invalid data in the input when trying to process the encoded string.
Any ideas of what this might be?
This is because base64.URLEncoding.DecodeString expects padded base64 encoded strings (terminating with an "=" or "==") as input. Try using base64.RawURLEncoding.DecodeString for unpadded values.