cryptoSignEd25519SkToSeed static method

Uint8List cryptoSignEd25519SkToSeed(
  1. Uint8List sk
)

Implementation

static Uint8List cryptoSignEd25519SkToSeed(Uint8List sk) {
  RangeError.checkValueInInterval(sk.length, cryptoSignSecretkeybytes,
      cryptoSignSecretkeybytes, 'sk', 'Invalid length');

  final _seed = calloc<Uint8>(cryptoSignSeedbytes);
  final _sk = sk.toPointer();
  try {
    _cryptoSign
        .crypto_sign_ed25519_sk_to_seed(_seed, _sk)
        .mustSucceed('crypto_sign_ed25519_sk_to_seed');
    return _seed.toList(cryptoSignSeedbytes);
  } finally {
    calloc.free(_seed);
    calloc.free(_sk);
  }
}