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 {
  await initInstance();
  if (!await blsInit()) {
    throw StateError('cannot initialize BLS on Web.');
  }
  final blsVerifyFunc = instance!.functions['bls_verify']! as int Function(
    int,
    int,
    int,
    int,
    int,
    int,
  );

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

  return blsVerifyFunc(
        set0.first,
        set0.last,
        set1.first,
        set1.last,
        set2.first,
        set2.last,
      ) ==
      0;
}