@oazmi/kitchensink - v0.10.1
    Preparing search index...

    Function generateX25519Keypair

    • generate an x25519 private and public keypair (in 32-byte array form) using the curve25519 scalar multiplication algorithm.

      you can optionally provide an existing private_key, either as a bigint, or as a 32-byte array (Uint8Array of size 32). if your private key is not pre-clamped based on x25519's requirements, it will be forcefully clampped, and the returned KeyPair.privateKey will be clampped.

      if you don't provide a private key, this function will randomly generate one for you, using: crypto.getRandomValues(new Uint8Array(32)).

      Note

      to convert the key pairs to base64 strings, use the freshly added (es2025+) Uint8Array.toBase64 method on each of the keys.

      Parameters

      • Optionalprivate_key: bigint | Uint8Array<ArrayBufferLike>

      Returns KeyPair