MgetPublicKey
Bun

method

crypto.ECDH.getPublicKey

encoding?: null,
format?: ECDHKeyFormat
): NonSharedBuffer;

The format argument specifies point encoding and can be 'compressed' or 'uncompressed'. If format is not specified the point will be returned in'uncompressed' format.

If encoding is specified, a string is returned; otherwise a Buffer is returned.

@param encoding

The encoding of the return value.

@returns

The EC Diffie-Hellman public key in the specified encoding and format.

format?: ECDHKeyFormat
): string;

The format argument specifies point encoding and can be 'compressed' or 'uncompressed'. If format is not specified the point will be returned in'uncompressed' format.

If encoding is specified, a string is returned; otherwise a Buffer is returned.

@param encoding

The encoding of the return value.

@returns

The EC Diffie-Hellman public key in the specified encoding and format.

Referenced types

type ECDHKeyFormat = 'compressed' | 'uncompressed' | 'hybrid'
type BinaryToTextEncoding = 'base64' | 'base64url' | 'hex' | 'binary'