Msign
Bun

method

crypto.Sign.sign

): NonSharedBuffer;

Calculates the signature on all the data passed through using either sign.update() or sign.write().

If privateKey is not a KeyObject, this function behaves as if privateKey had been passed to createPrivateKey. If it is an object, the following additional properties can be passed:

If outputEncoding is provided a string is returned; otherwise a Buffer is returned.

The Sign object can not be again used after sign.sign() method has been called. Multiple calls to sign.sign() will result in an error being thrown.

outputFormat: BinaryToTextEncoding
): string;

Calculates the signature on all the data passed through using either sign.update() or sign.write().

If privateKey is not a KeyObject, this function behaves as if privateKey had been passed to createPrivateKey. If it is an object, the following additional properties can be passed:

If outputEncoding is provided a string is returned; otherwise a Buffer is returned.

The Sign object can not be again used after sign.sign() method has been called. Multiple calls to sign.sign() will result in an error being thrown.

Referenced types

type KeyLike = string | Buffer | KeyObject

interface SignKeyObjectInput

interface SignPrivateKeyInput

interface SignJsonWebKeyInput

type BinaryToTextEncoding = 'base64' | 'base64url' | 'hex' | 'binary'