cryptoSignDetached static method

Uint8List cryptoSignDetached(
  1. Uint8List m,
  2. Uint8List sk
)

Implementation

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

  final _sig = calloc<Uint8>(cryptoSignBytes);
  final _siglenP = calloc<Uint64>(1);
  final _m = m.toPointer();
  final _sk = sk.toPointer();

  try {
    _cryptoSign
        .crypto_sign_detached(_sig, _siglenP, _m, m.length, _sk)
        .mustSucceed('crypto_sign_detached');
    return _sig.toList(_siglenP[0]);
  } finally {
    calloc.free(_sig);
    calloc.free(_siglenP);
    calloc.free(_m);
    calloc.free(_sk);
  }
}