crypto

package
v0.2.49 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2026 License: GPL-2.0, GPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package crypto provides RFC 8291 encryption helpers and VAPID JWT construction for Web Push. These are pure cryptographic functions with no dependency on the push Service's state.

Index

Constants

View Source
const VAPIDExpWindow = 12 * 60 * 60

VAPIDExpWindow is the JWT expiry window in seconds (12 hours).

Variables

This section is empty.

Functions

func BuildVAPIDHeader

func BuildVAPIDHeader(priv *ecdsa.PrivateKey, pubKeyB64, subject, endpoint string) (string, error)

BuildVAPIDHeader constructs a VAPID Authorization header (RFC 8292) from a pre-decoded ECDSA private key.

func DeriveKeyNonce

func DeriveKeyNonce(shared, authSecret, clientPub, serverPub, salt []byte) (cek, nonce []byte, err error)

DeriveKeyNonce derives the content-encryption key and nonce per RFC 8291.

func ECDHToECDSA

func ECDHToECDSA(key *ecdh.PrivateKey) (*ecdsa.PrivateKey, error)

ECDHToECDSA converts an ECDH P-256 private key to an ECDSA private key.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL