module

Vapid

VAPID (Voluntary Application Server Identification) protocol implementation for Web Push authentication.

This library provides:

  • ES256 cryptographic key pair generation and management
  • JWT token creation and signing for VAPID authentication
  • HTTP client for sending authenticated push notifications

Usage

# Generate a new key pair
key_pair = Vapid::KeyPair.generate

# Create VAPID headers for a push request
headers = Vapid::RequestHeaders.new(
  audience: "https://fcm.googleapis.com",
  subject: "mailto:admin@example.com",
  private_key: key_pair
)

# Send a push notification
client = Vapid::Client.new
client.send_notification(
  endpoint: "https://fcm.googleapis.com/fcm/send/...",
  headers: headers,
  payload: {"title" => "Hello", "body" => "World"}.to_json
)

Constants

VERSION = "0.1.0"

Nested types