publicBytesFromPrivateBytes(privateKey: Uint8Array,options?: ImportPrivateKeyOptions): Promise<Uint8Array>
Derives public key from private key using x25519 curve.
Useful for getting public key from private key.
Derive public key from private key
Derive public key from private key
import { assertEquals } from "@std/assert"; import { randomPrivateKeyBytes, publicBytesFromPrivateBytes } from "@hertzg/wg-keys"; const privateKeyBytes = randomPrivateKeyBytes(); const publicKeyBytes = await publicBytesFromPrivateBytes(privateKeyBytes); assertEquals(publicKeyBytes.length, 32);
privateKey: Uint8Array
Private key bytes
optional
options: ImportPrivateKeyOptions
Configuration options for key import
Promise<Uint8Array>
Public key bytes