blsVerify method

  1. @override
Future<bool> blsVerify(
  1. Uint8List pk,
  2. Uint8List sig,
  3. Uint8List msg
)
override

Implementation

@override
Future<bool> blsVerify(Uint8List pk, Uint8List sig, Uint8List msg) async {
  BLSVerifyFunc? blsVerifyFunc;
  if (blsVerifyFunc == null) {
    await initInstance();
    if (!await blsInit()) {
      throw 'Cannot initialize BLS';
    }
    blsVerifyFunc = instance!.functions['bls_verify']! as int Function(
        int, int, int, int, int, int);
  }

  var set0 = passArray8ToWasm0(sig, _malloc);
  var set1 = passArray8ToWasm0(msg, _malloc);
  var set2 = passArray8ToWasm0(pk, _malloc);

  return blsVerifyFunc(set0.first, set0.last, set1.first, set1.last,
              set2.first, set2.last) ==
          0
      ? true
      : false;
}