verifyStringSignature function

Future<bool> verifyStringSignature(
  1. String jws,
  2. String expectedDid, {
  3. dynamic toSign,
  4. Erc1056? erc1056,
})

Verifies the signature in jws.

If a detached jws is given the signed string must be given separately as toSign. toSign could be a String or a json-object (Dart Map).

Implementation

Future<bool> verifyStringSignature(String jws, String expectedDid,
    {dynamic toSign, Erc1056? erc1056}) async {
  if (expectedDid.startsWith('did:ethr')) {
    return _verifyEthr(jws, expectedDid, erc1056: erc1056, toSign: toSign);
  } else if (expectedDid.startsWith('did:key:z6Mk')) {
    return _verifyEd(jws, expectedDid, toSign: toSign);
  } else {
    throw UnimplementedError('Unknown did method');
  }
}