cryptoSignOpen static method

Uint8List cryptoSignOpen(
  1. Uint8List sm,
  2. Uint8List pk
)

Implementation

static Uint8List cryptoSignOpen(Uint8List sm, Uint8List pk) {
  RangeError.checkValueInInterval(pk.length, cryptoSignPublickeybytes,
      cryptoSignPublickeybytes, 'pk', 'Invalid length');

  final _m = calloc<Uint8>(sm.length - cryptoSignBytes);
  final _mlenP = calloc<Uint64>(1);
  final _sm = sm.toPointer();
  final _pk = pk.toPointer();

  try {
    _cryptoSign
        .crypto_sign_open(_m, _mlenP, _sm, sm.length, _pk)
        .mustSucceed('crypto_sign_open');
    return _m.toList(_mlenP[0]);
  } finally {
    calloc.free(_m);
    calloc.free(_mlenP);
    calloc.free(_sm);
    calloc.free(_pk);
  }
}