cryptoSign static method

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

Implementation

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

  final _sm = calloc<Uint8>(m.length + cryptoSignBytes);
  final _smlenP = calloc<Uint64>(1);
  final _m = m.toPointer();
  final _sk = sk.toPointer();

  try {
    _cryptoSign
        .crypto_sign(_sm, _smlenP, _m, m.length, _sk)
        .mustSucceed('crypto_sign');
    return _sm.toList(_smlenP[0]);
  } finally {
    calloc.free(_sm);
    calloc.free(_smlenP);
    calloc.free(_m);
    calloc.free(_sk);
  }
}