cryptoKxClientSessionKeys static method
Implementation
static SessionKeys cryptoKxClientSessionKeys(
Uint8List clientPk, Uint8List clientSk, Uint8List serverPk) {
RangeError.checkValueInInterval(clientPk.length, cryptoKxPublickeybytes,
cryptoKxPublickeybytes, 'clientPk', 'Invalid length');
RangeError.checkValueInInterval(clientSk.length, cryptoKxSecretkeybytes,
cryptoKxSecretkeybytes, 'clientSk', 'Invalid length');
RangeError.checkValueInInterval(serverPk.length, cryptoKxPublickeybytes,
cryptoKxPublickeybytes, 'serverPk', 'Invalid length');
final _rx = calloc<Uint8>(cryptoKxSessionkeybytes);
final _tx = calloc<Uint8>(cryptoKxSessionkeybytes);
final _clientPk = clientPk.toPointer();
final _clientSk = clientSk.toPointer();
final _serverPk = serverPk.toPointer();
try {
_cryptoKx
.crypto_kx_client_session_keys(
_rx, _tx, _clientPk, _clientSk, _serverPk)
.mustSucceed('crypto_kx_client_session_keys');
return SessionKeys(
rx: _rx.toList(cryptoKxSessionkeybytes),
tx: _tx.toList(cryptoKxSessionkeybytes));
} finally {
calloc.free(_rx);
calloc.free(_tx);
calloc.free(_clientPk);
calloc.free(_clientSk);
calloc.free(_serverPk);
}
}