@me2em/crypto
    Preparing search index...

    Function x25519SharedSecret

    • X25519 ECDH. Returns the FULL 32-byte shared secret.

      ⚠️ Security note: some implementations truncate this output (a legacy bug from typed-array workarounds) — truncation breaks interoperability and MUST NOT be replicated.

      Parameters

      • privateKey: Uint8Array

        32-byte X25519 private key.

      • publicKey: Uint8Array

        32-byte X25519 public key.

      Returns Uint8Array

      32-byte shared secret (full, NOT truncated).

      'KEY/INVALID_LENGTH' if inputs ≠ 32B.

      const shared = x25519SharedSecret(alicePriv, bobPub);
      // shared is exactly 32 bytes