| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
webpush is a Web Push library (RFC 8291 and RFC 8292) based on Web APIs.
NOTE: This library hasn't been reviewed by crypto experts and may be unsecure. I've done my best to follow RFC recommandation and I only used primitives provided by the SubtleCrypto API.
webpush is available on JSR.
Before sending Web Push message to a user agent, you need to create VAPID keys (see RFC 8292) to identify your server (Application) to the Push Service:
+-------+ +--------------+ +-------------+
| UA | | Push Service | | Application |
+-------+ +--------------+ +-------------+
| | |
| Setup | |
|<====================>| |
| Provide Subscription |
|-------------------------------------------->|
| | |
: : :
| | Push Message |
| Push Message |<---------------------|
|<---------------------| |
| | |
Run generate-vapid-keys script part of this repository to generate new keys:
# You can use any Web compatible runtime.
$ deno run https://raw.githubusercontent.com/negrel/webpush/master/cmd/generate-vapid-keys.tsCopy the output of the command and save it in example/vapid.json. Now you can run example server.
$ cd example/ $ deno run -A ./main.ts
Code is commented be sure to read it.
I also wrote an ok-ish blog post about Web Push and this library.
This library tries its best at keeping the minimum number of dependencies. It has no external dependencies except some runtime agnostic @std/ packages maintained by Deno team and http-ece, which I maintain.
http-ece also only depends on @std/ packages.
If you want to contribute to webpush to add a feature or improve the code contact me at alexandre@negrel.dev, open an issue or make a pull request.
Please give a ⭐ if this project helped you!
MIT © Alexandre Negrel
| Back | FazBrowse Home | New Git URL |