decryptSync method
Implementation
List<int> decryptSync(
SecretBox secretBox, {
required SecretKeyData secretKey,
List<int> aad = const <int>[],
int keyStreamIndex = 0,
Uint8List? possibleBuffer,
}) {
checkParameters(
length: secretBox.cipherText.length,
secretKey: secretKey,
nonceLength: secretBox.nonce.length,
aadLength: aad.length,
keyStreamIndex: keyStreamIndex,
);
final state = newState();
state.initializeSync(
isEncrypting: false,
secretKey: secretKey,
nonce: secretBox.nonce,
aad: aad,
keyStreamIndex: keyStreamIndex,
);
final clearText = state.convertSync(
secretBox.cipherText,
possibleBuffer: possibleBuffer,
);
if (secretBox.mac != state.mac) {
throw SecretBoxAuthenticationError();
}
return clearText;
}