unwrap static method

Future<Uint8List> unwrap(
  1. List<int> wrappedKey,
  2. SecretKey derivedKey
)

Implementation

static Future<Uint8List> unwrap(
    List<int> wrappedKey, SecretKey derivedKey) async {
  final wrappingAlgorithm = Chacha20.poly1305Aead();
  final secretBox = SecretBox.fromConcatenation(
      List.generate(12, (index) => 0x00) + wrappedKey,
      macLength: 16,
      nonceLength: 12);
  return Uint8List.fromList(
      await wrappingAlgorithm.decrypt(secretBox, secretKey: derivedKey));
}