verify function

Future verify(
  1. dynamic data,
  2. dynamic pair, [
  3. DefaultOptVerifyType? opt
])

Implementation

Future<dynamic> verify(dynamic data, dynamic pair,
    [DefaultOptVerifyType? opt]) async {
  if (data == null) {
    throw ("data `null` not allowed.");
  }

  opt ??= DEFAULT_OPTS;

  final json = parse(data);

  final pub = pair is PairReturnType ? pair.pub : pair;

  if (await verifySignature(
      json['m'] ?? json[':'], json['s'] ?? json['~'], pub, pair, opt)) {
    return json['m'] ?? json[':'];
  }

  if (opt.fallback != null && opt.fallback!) {
    return oldVerify(data, pub, opt);
  }

  return null;
}