Skip to main content
sign - node__crypto.d.ts - Node documentation
function sign

Usage in Deno

```typescript import { sign } from "node:node__crypto.d.ts"; ```
sign(
algorithm:
string
| null
| undefined
,
data: ArrayBufferView,
): Buffer
Calculates and returns the signature for `data` using the given private key and algorithm. If `algorithm` is `null` or `undefined`, then the algorithm is dependent upon the key type (especially Ed25519 and Ed448). If `key` is not a `KeyObject`, this function behaves as if `key` had been passed to [createPrivateKey](../.././node__crypto.d.ts/~/createPrivateKey). If it is an object, the following additional properties can be passed: If the `callback` function is provided this function uses libuv's threadpool.

Parameters

algorithm:
string
| null
| undefined
data: ArrayBufferView

Return Type

Buffer
sign(
algorithm:
string
| null
| undefined
,
data: ArrayBufferView,
callback: (
error: Error | null,
data: Buffer,
) => void
,
): void

Parameters

algorithm:
string
| null
| undefined
data: ArrayBufferView
callback: (
error: Error | null,
data: Buffer,
) => void

Return Type

void