https://github.com/linuskmr/webpush-server
A server for registering Web Push endpoints and sending pushes using the Push API, written in Rust.
https://github.com/linuskmr/webpush-server
push-api rust web-push
Last synced: 6 months ago
JSON representation
A server for registering Web Push endpoints and sending pushes using the Push API, written in Rust.
- Host: GitHub
- URL: https://github.com/linuskmr/webpush-server
- Owner: linuskmr
- License: agpl-3.0
- Created: 2024-01-31T10:06:09.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-13T18:26:32.000Z (almost 2 years ago)
- Last Synced: 2024-02-13T19:32:56.432Z (almost 2 years ago)
- Topics: push-api, rust, web-push
- Language: Rust
- Homepage:
- Size: 92.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# webpush-server
A server for registering [Web Push](https://web.dev/articles/push-notifications-overview) endpoints and sending pushes using the [Push API](https://developer.mozilla.org/en-US/docs/Web/API/Push_API), written in Rust.
> Currently work in progress
## Usage
Clone this repository and [install Rust and Cargo](https://rustup.rs):
Install OpenSSL header files needed for compilation:
```
sudo apt-get install libssl-dev
```
### Push Application Keys
As described by
Generate a application private key pair:
```
openssl ecparam -name prime256v1 -genkey -noout -out private.pem
```
Derive the public key from the private key:
```
openssl ec -in private.pem -pubout -out vapid_public.pem
```
To get the byte form of the public key for the JavaScript client:
```
openssl ec -in private.pem -text -noout -conv_form uncompressed
```
...or a base64 encoded string, which the client should convert into byte form before using:
```
openssl ec -in private.pem -pubout -outform DER|tail -c 65|base64|tr '/+' '_-'|tr -d '\n'
```
### Running
```
cargo run
```
Set logging to the debug level:
```
RUST_LOG=webpush_server=debug cargo run
```