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).
Throws
'KEY/INVALID_LENGTH' if inputs ≠ 32B.
Example
constshared = x25519SharedSecret(alicePriv, bobPub); // shared is exactly 32 bytes
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.