hkdf function

Future<SecretKey> hkdf(
  1. List<int> secret,
  2. List<int> salt
)

Implementation

Future<SecretKey> hkdf(List<int> secret, List<int> salt) async {
  final hkdfAlgorithm = Hkdf(
    hmac: Hmac.sha256(),
    outputLength: 32,
  );

  final derivedKey = await hkdfAlgorithm.deriveKey(
    secretKey: SecretKey(secret),
    nonce: salt,
    info: Uint8List(0), // Empty array buffer for info
  );

  return derivedKey;
}