cryptoBoxSeal static method

Uint8List cryptoBoxSeal(
  1. Uint8List m,
  2. Uint8List pk
)

Implementation

static Uint8List cryptoBoxSeal(Uint8List m, Uint8List pk) {
  RangeError.checkValueInInterval(pk.length, cryptoBoxPublickeybytes,
      cryptoBoxPublickeybytes, 'pk', 'Invalid length');

  final _c = calloc<Uint8>(m.length + cryptoBoxSealbytes);
  final _m = m.toPointer();
  final _pk = pk.toPointer();

  try {
    _cryptoBox
        .crypto_box_seal(_c, _m, m.length, _pk)
        .mustSucceed('crypto_box_seal');

    return _c.toList(m.length + cryptoBoxSealbytes);
  } finally {
    calloc.free(_c);
    calloc.free(_m);
    calloc.free(_pk);
  }
}