import { isInitialized } from '../init.js'; import type { WasmSource } from '../wasm-source.js'; import type { X25519KeyPair } from './types.js'; /** * Initialise the curve25519 WASM module under the `x25519` alias. * Equivalent to `ed25519Init(source)`; both target the same WASM module * and the init layer de-dupes when given identical sources. */ export declare function x25519Init(source: WasmSource): Promise; export type { WasmSource }; export type { X25519KeyPair, X25519Exports } from './types.js'; export { isInitialized }; export declare class X25519 { constructor(); private get mx(); /** * Deterministic X25519 key generation from a 32-byte secret per * RFC 7748 §6. Clamping is applied internally on every WASM call; * the returned secretKey is a fresh copy of the supplied sk bytes * (NOT pre-clamped). */ keygenDerand(sk: Uint8Array): X25519KeyPair; /** Random X25519 key generation, wraps `keygenDerand` with `randomBytes(32)`. */ keygen(): X25519KeyPair; /** * X25519 Diffie-Hellman, RFC 7748 §6. * * Computes the shared u-coordinate from the local secret and the * peer's public key. If the resulting shared secret is all-zero * (peer public key is a small-order point per RFC 7748 §7), throws * `KeyAgreementError` rather than returning the degenerate value. * The all-zero scan accumulates via OR across all 32 output bytes * before comparing to zero, so the success path is constant-time; * the throw branches off only after a known-bad outcome is observed. * * @param sk 32-byte local secret (NOT pre-clamped, clamped internally) * @param peerPk 32-byte peer public key (u-coordinate) * @returns 32-byte shared u-coordinate * @throws KeyAgreementError on all-zero shared secret */ dh(sk: Uint8Array, peerPk: Uint8Array): Uint8Array; dispose(): void; }