cryptoSecretboxOpenDetached static method
Implementation
static Uint8List cryptoSecretboxOpenDetached(
Uint8List c, Uint8List mac, Uint8List n, Uint8List k) {
RangeError.checkValueInInterval(mac.length, cryptoSecretboxMacbytes,
cryptoSecretboxMacbytes, 'mac', 'Invalid length');
RangeError.checkValueInInterval(n.length, cryptoSecretboxNoncebytes,
cryptoSecretboxNoncebytes, 'n', 'Invalid length');
RangeError.checkValueInInterval(k.length, cryptoSecretboxKeybytes,
cryptoSecretboxKeybytes, 'k', 'Invalid length');
final _m = calloc<Uint8>(c.length);
final _mac = mac.toPointer();
final _c = c.toPointer();
final _n = n.toPointer();
final _k = k.toPointer();
try {
_cryptoSecretbox
.crypto_secretbox_open_detached(_m, _c, _mac, c.length, _n, _k)
.mustSucceed('crypto_secretbox_open_detached');
return _m.toList(c.length);
} finally {
calloc.free(_m);
calloc.free(_mac);
calloc.free(_c);
calloc.free(_n);
calloc.free(_k);
}
}