cryptoSignFinalCreate static method

Uint8List cryptoSignFinalCreate(
  1. Pointer<Uint8> state,
  2. Uint8List sk
)

Implementation

static Uint8List cryptoSignFinalCreate(Pointer<Uint8> state, Uint8List sk) {
  RangeError.checkValueInInterval(sk.length, cryptoSignSecretkeybytes,
      cryptoSignSecretkeybytes, 'sk', 'Invalid length');

  final _sig = calloc<Uint8>(cryptoSignBytes);
  final _siglenP = calloc<Uint64>(1);
  final _sk = sk.toPointer();
  try {
    _cryptoSign
        .crypto_sign_final_create(state, _sig, _siglenP, _sk)
        .mustSucceed('crypto_sign_final_create');
    return _sig.toList(_siglenP[0]);
  } finally {
    // note: caller is responsible for freeing state
    calloc.free(_sig);
    calloc.free(_siglenP);
    calloc.free(_sk);
  }
}