cryptoBoxKeypair static method

KeyPair cryptoBoxKeypair()

Implementation

static KeyPair cryptoBoxKeypair() {
  final _pk = calloc<Uint8>(cryptoBoxPublickeybytes);
  final _sk = calloc<Uint8>(cryptoBoxSecretkeybytes);

  try {
    _cryptoBox.crypto_box_keypair(_pk, _sk).mustSucceed('crypto_box_keypair');
    return KeyPair(
        pk: _pk.toList(cryptoBoxPublickeybytes),
        sk: _sk.toList(cryptoBoxSecretkeybytes));
  } finally {
    calloc.free(_pk);
    calloc.free(_sk);
  }
}