forked from SherClockHolmes/webpush-go
-
Notifications
You must be signed in to change notification settings - Fork 0
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
update to v2 API #1
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The RFC says: > The "sub" claim SHOULD include a contact URI for the application > server as either a "mailto:" (email) [RFC6068] or an "https:" > [RFC2818] URI. However the library assumes the passed in subscribed is always an e-mail address, without leaving a way to pass an HTTPS URL.
This new test mocks both the user agent (e.g. browser) and the push service (e.g. Firestore) to verify that encryption and decryption works properly. I used the RFCs as reference (RFC8291, RFC8292 & RFC 8188), but didn't follow them to the letter. The result can successfully check all the signatures and decrypt the content, so it seems to be working. Instead of the deprecated crypto/elliptic functions, this makes heavy use of crypto/ecdh, which require Go 1.20. But this is only a test dependency, library users should not be impacted.
crypto/elliptic is subject for removal soon, use of crypto/ecdh is advised instead. This has a number of side-effects: - the required Go version increases to Go 1.20 - the configured VAPID keys get verified now, and invalid keys are rejected - this necessitated changes to some tests - VAPID is effectively mandatory now (but all push services I know require it anyway) go.mod has been updated to reflect the new requirement, and I ran `go mod tidy` to clean up go.sum. I also added additional error context by wrapping errors with fmt.Errorf's %w verb. This was introduced in Go 1.13.
* New key types for Keys and VAPIDKeys * VAPID key serializes to a JSON string of the PEM-encoded PKCS8
The passed value was wrong, but net/http ignores it anyway (it does a type assertion for bytes.Buffer and uses Len() on success).
slingamn
force-pushed
the
ecdh_update.6
branch
from
December 31, 2024 07:16
0272088
to
2decbc9
Compare
cc @mrwonko ; this is an attempt at a v2 API for webpush-go that reflects the current split between Also sorry if you got a GitHub email from me last week claiming that your code was wrong! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
crypto/ecdh
crypto/ecdh
andcrypto/ecdsa