decrypt method

  1. @override
Future<String> decrypt(
  1. String symKey,
  2. String encoded
)
override

Implementation

@override
Future<String> decrypt(String symKey, String encoded) async {
  final chacha = dc.Chacha20.poly1305Aead();
  final dc.SecretKey secretKey = dc.SecretKey(
    hex.decode(symKey),
  );
  final EncodingParams encodedData = deserialize(encoded);
  final dc.SecretBox b = dc.SecretBox.fromConcatenation(
    encodedData.ivSealed,
    nonceLength: 12,
    macLength: 16,
  );
  List<int> data = await chacha.decrypt(b, secretKey: secretKey);
  return utf8.decode(data);
}