Closed marco-c closed 8 years ago
Now it was correctly validated (using the non-urlsafe encoding).
As you can see, the VAPID key is in the non-urlsafe base64 encoding.
I actually think I fixed the verification yesterday in a separate change: https://github.com/mozilla-services/push-dev-dashboard/pull/184
And I just now pushed a fix for the Error communicating with Push Messages API: Status: 201; Content: ").
issue. Though it will still give another error right now: https://github.com/mozilla-services/push-dev-dashboard/issues/185
I'll leave this open to investigate after I fix #185
Okay, I went thru https://mozilla-services.github.io/WebPushDataTestPage/ to generate the VAPID key pair. I copied the public key value in "Push Dashboard" area, which I think is a url-safe, base64-encoded version of the key? Then I signed the token value that I got from the dashboard, and I copied the signed token value from the WebPushDataTestPage, which, again, I think is a url-safe, base64-encoded version of the signed token.
@jrconlin: is that accurate?
The public key value on https://mozilla-services.github.io/WebPushDataTestPage/ doesn't look like the urlsafe variant, it contains == at the end.
Same as the signed token.
'==' is just padding. URL safe generally has '-' and '_' instead of '+' and '/' Padding is optional and can be stripped.
'==' is just padding. URL safe generally has '-' and '_' instead of '+' and '/' Padding is optional and can be stripped.
Oh, ok, all the URL safe libraries that I used removed padding, so I assumed it was always removed. So the problem on the dashboard is that it only accepts values with padding, while the URL safe base64 sometimes doesn't have it.
While validating, there was an "Incorrect padding" error, for the VAPID key at first, and then for the encrypted token. I tried the non-urlsafe base64 encoding out of curiosity, and it worked (well, at least I think, since I don't see "Incorrect padding" anymore, but I see "Error communicating with Push Messages API: Status: 201; Content: ").