Overview
Imports an x25519 private key as a CryptoKey by wrapping it in PKCS8 format.
Imports an x25519 public key as a CryptoKey.
Derives public key from private key using x25519 curve.
Generates UNCLAMPED 32 bytes of random data.
Generates clamped private key from random data.
Mimics WireGuard's wg genkey command.
Alias for randomPrivateKeyBytes, returns base64 encoded private key instead of Uint8Array.
Can be used directly by WireGuard as Interface PrivateKey.
Mimics WireGuard's wg genpsk command.
Alias for randomPresharedKeyBytes, returns base64 encoded preshared key instead of Uint8Array.
Can be used directly by WireGuard as Peer PresharedKey.
Derives the x25519 public key for a base64-encoded private key.
Options for importing a private key into a CryptoKey.
-
algorithm: AlgorithmIdentifier
Algorithm identifier for the key. Defaults to
{ name: "X25519" }. -
extractable: boolean
Whether the key can be exported. Defaults to
true. -
keyUsages: KeyUsage[]
Array of key usages. Defaults to
["deriveBits"].
Options for importing a public key into a CryptoKey.
-
algorithm: AlgorithmIdentifier
Algorithm identifier for the key. Defaults to
{ name: "X25519" }. -
extractable: boolean
Whether the key can be exported. Defaults to
true.