cryptoSecretstreamXchacha20poly1305InitPush static method
InitPushResult
cryptoSecretstreamXchacha20poly1305InitPush(
- Uint8List key
)
Implementation
static InitPushResult cryptoSecretstreamXchacha20poly1305InitPush(
Uint8List key) {
RangeError.checkValueInInterval(
key.length,
cryptoSecretstreamXchacha20poly1305Keybytes,
cryptoSecretstreamXchacha20poly1305Keybytes,
'key',
'Invalid length');
final _state = calloc<Uint8>(cryptoSecretstreamXchacha20poly1305Statebytes);
final _header =
calloc<Uint8>(cryptoSecretstreamXchacha20poly1305Headerbytes);
final _k = key.toPointer();
try {
_cryptoSecretStream
.crypto_secretstream_xchacha20poly1305_init_push(_state, _header, _k)
.mustSucceed('crypto_secretstream_xchacha20poly1305_init_push');
return InitPushResult(
state: _state,
header:
_header.toList(cryptoSecretstreamXchacha20poly1305Headerbytes));
} finally {
calloc.free(_header);
calloc.free(_k);
}
}