web-push-go icon indicating copy to clipboard operation
web-push-go copied to clipboard

Base64 decoding problem of auth and p256dh

Open juan88 opened this issue 7 years ago • 1 comments

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?

juan88 avatar Dec 22 '17 04:12 juan88

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.

anaskhan96 avatar Dec 22 '17 06:12 anaskhan96