webcrypto.SubtleCrypto.deriveBits - Node documentation
method webcrypto.SubtleCrypto.deriveBits

Usage in Deno

import { type webcrypto } from "node:crypto";
SubtleCrypto.deriveBits(
baseKey: CryptoKey,
length: number | null,
): Promise<ArrayBuffer>

Using the method and parameters specified in algorithm and the keying material provided by baseKey, subtle.deriveBits() attempts to generate length bits. The Node.js implementation requires that when length is a number it must be multiple of 8. When length is null the maximum number of bits for a given algorithm is generated. This is allowed for the 'ECDH', 'X25519', and 'X448' algorithms. If successful, the returned promise will be resolved with an <ArrayBuffer> containing the generated data.

The algorithms currently supported include:

  • 'ECDH'
  • 'X25519'
  • 'X448'
  • 'HKDF'
  • 'PBKDF2'

Parameters

baseKey: CryptoKey
length: number | null

Return Type

Promise<ArrayBuffer>
SubtleCrypto.deriveBits(
baseKey: CryptoKey,
length: number,
): Promise<ArrayBuffer>

Parameters

baseKey: CryptoKey
length: number

Return Type

Promise<ArrayBuffer>