UNPKG

wireguard-keygen

Version:

A TypeScript library for generating WireGuard key pairs using proper Curve25519 cryptography

32 lines (31 loc) 1.01 kB
/** * WireGuard key pair interface */ export interface WireGuardKeyPair { privateKey: string; publicKey: string; } /** * Generate a WireGuard private key * @returns Base64 encoded private key (32 bytes) */ export declare function generatePrivateKey(): string; /** * Derive a WireGuard public key from a private key * Uses Curve25519 elliptic curve cryptography * @param privateKeyStr Base64 encoded private key * @returns Base64 encoded public key */ export declare function derivePublicKey(privateKeyStr: string): string; /** * Validate a WireGuard public key * @param publicKey Base64 encoded public key to validate * @returns true if valid, false otherwise */ export declare function validatePublicKey(publicKey: string): boolean; /** * Generate a complete WireGuard key pair * Uses proper Curve25519 cryptography for WireGuard compatibility * @returns Object containing base64 encoded private and public keys */ export declare function generateWireguardKeyPair(): WireGuardKeyPair;