FdiffieHellman
Bun

function

crypto.diffieHellman

function diffieHellman(
): NonSharedBuffer;

Computes the Diffie-Hellman shared secret based on a privateKey and a publicKey. Both keys must have the same asymmetricKeyType and must support either the DH or ECDH operation.

If the callback function is provided this function uses libuv's threadpool.

function diffieHellman(
callback: (err: null | Error, secret: NonSharedBuffer) => void
): void;

Computes the Diffie-Hellman shared secret based on a privateKey and a publicKey. Both keys must have the same asymmetricKeyType and must support either the DH or ECDH operation.

If the callback function is provided this function uses libuv's threadpool.