deriveBits method
The deriveBits()
method of the
SubtleCrypto interface can be used to derive an array of bits from a
base
key.
It takes as its arguments the base key, the derivation algorithm to use,
and the length
of the bits to derive. It returns a
Promise
which will be fulfilled with an
ArrayBuffer
containing the derived bits.
This method is very similar to
SubtleCrypto.deriveKey()
,
except that deriveKey()
returns a
CryptoKey
object rather than an
ArrayBuffer
. Essentially deriveKey()
is composed of
deriveBits()
followed by
importKey()
.
This function supports the same derivation algorithms as deriveKey()
:
ECDH, HKDF, and PBKDF2. See
Supported algorithms
for some more detail on these algorithms.
Implementation
external JSPromise<JSArrayBuffer> deriveBits(
AlgorithmIdentifier algorithm,
CryptoKey baseKey,
int length,
);