cryptoSignEd25519SkToPk static method

Uint8List cryptoSignEd25519SkToPk(
  1. Uint8List sk
)

Implementation

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

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