cryptoKxSeedKeypair static method

KeyPair cryptoKxSeedKeypair(
  1. Uint8List seed
)

Implementation

static KeyPair cryptoKxSeedKeypair(Uint8List seed) {
  RangeError.checkValueInInterval(seed.length, cryptoKxSeedbytes,
      cryptoKxSeedbytes, 'seed', 'Invalid length');
  final _pk = calloc<Uint8>(cryptoKxPublickeybytes);
  final _sk = calloc<Uint8>(cryptoKxSecretkeybytes);
  final _seed = seed.toPointer();

  try {
    _cryptoKx
        .crypto_kx_seed_keypair(_pk, _sk, _seed)
        .mustSucceed('crypto_kx_seed_keypair');
    return KeyPair(
        pk: _pk.toList(cryptoKxPublickeybytes),
        sk: _sk.toList(cryptoKxSecretkeybytes));
  } finally {
    calloc.free(_pk);
    calloc.free(_sk);
    calloc.free(_seed);
  }
}