key function

Uint8List key({
  1. required Uint8List secret,
  2. required Uint8List salt,
  3. required Uint8List info,
  4. int length = 32,
})

Derives a key from the secret, salt, and info using HKDF-SHA256, returning a byte array that can be used as a cryptographic key.

Throws if length 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,
}) => ffi.hkdfKey(
  secret: secret,
  salt: salt,
  info: info,
  length: BigInt.from(length),
);