deriveAesKeyWithSalt function

Future<Uint8List> deriveAesKeyWithSalt(
  1. Uint8List r,
  2. Uint8List salt
)

Implementation

Future<Uint8List> deriveAesKeyWithSalt(Uint8List r, Uint8List salt) async {
  final info = utf8.encode('AES-GCM key');

  final secretKey = await hkdf.deriveKey(
    secretKey: SecretKey(r),
    nonce: salt,
    info: info,
  );

  return Uint8List.fromList(await secretKey.extractBytes());
}