key function
Derives a key from the secret, salt, and info using HKDF-SHA256, returning
length bytes that can be used as a cryptographic key.
The salt is optional; pass an empty list for none.
Throws if length is negative or exceeds the maximum output length for
SHA-256 HKDF, which is 255 * 32 = 8160 bytes.
Implementation
Uint8List key({
required Uint8List secret,
required Uint8List salt,
required Uint8List info,
int length = 32,
}) {
_checkLength(length);
return ffi.hkdfKey(
secret: secret,
salt: salt,
info: info,
length: BigInt.from(length),
);
}