verifySignature static method

Future<bool> verifySignature(
  1. String address,
  2. String reconstructedMessage,
  3. CacaoSignature cacaoSignature,
  4. String chainId,
  5. String projectId,
)

Implementation

static Future<bool> verifySignature(
  String address,
  String reconstructedMessage,
  CacaoSignature cacaoSignature,
  String chainId,
  String projectId,
) async {
  if (cacaoSignature.t == 'eip191') {
    return isValidEip191Signature(
      address,
      reconstructedMessage,
      cacaoSignature.s,
    );
  } else if (cacaoSignature.t == 'eip1271') {
    return await isValidEip1271Signature(
      address,
      reconstructedMessage,
      cacaoSignature.s,
      chainId,
      projectId,
    );
  } else {
    throw Exception(
      'verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${cacaoSignature.t}',
    );
  }
}