question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Verification fails for `BbsBlsSignatureProof2020` for jsonld-signatures >8.0.0

See original GitHub issue

I’m using @mattrglobal/jsonld-signatures-bbs for issuing credentials and creating a zero-knowledge proof for a selectively disclosed credential. However the verify method of jsonld-signatures fails when the version of jsonld-signatures is >8.0.0.

I’ve shared an example code in this gist with the keypair and the used context hardcoded inside the document. To reproduce npm init a new project, paste the code and install the packages via npm install. This should install the latest jsonld-signatures version which at the time of writing is 9.0.2. Runing the file with node index.js throws the following error:

{
  verified: false,
  error: VerificationError: Verification error(s).
      at verify (/home/kuzdogan/Desktop/repos/jsonld-bug-test/node_modules/jsonld-signatures/lib/jsonld-signatures.js:125:22)
      at async verifySelectiveDisclosedCredential (/home/kuzdogan/Desktop/repos/jsonld-bug-test/index.js:168:20) {
    errors: [
      Error: Could not verify any proofs; no proofs matched the required suite and purpose.
          at ProofSet.verify (/home/kuzdogan/Desktop/repos/jsonld-bug-test/node_modules/jsonld-signatures/lib/ProofSet.js:152:15)
          at async verify (/home/kuzdogan/Desktop/repos/jsonld-bug-test/node_modules/jsonld-signatures/lib/jsonld-signatures.js:114:18)
          at async verifySelectiveDisclosedCredential (/home/kuzdogan/Desktop/repos/jsonld-bug-test/index.js:168:20)
    ]
  }
}

However when revered to an older version of jsonld-signatures the document gets successfully verified.

npm install jsonld-signatures@7^

and running node index.js outputs:

Found cached https://raw.githubusercontent.com/kuzdogan/peer-review-verifiable-credentials-thesis/main/code/PeerReview.json, not requesting
Found cached did:example:489398593#test, not requesting
Found cached did:example:489398593, not requesting
{ verified: true, results: [ { proof: [Object], verified: true } ] }

OS: Ubuntu 20.04.2 LTS node version: 14.17.0 npm version: 7.13.0

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:6

github_iconTop GitHub Comments

3reactions
OR13commented, Jul 10, 2021

I took a look at this today…

The issue is caused by changes in the way suites assume contexts… recently, this package was updated to care less about sec-v2… “sec:”… those changes appear to have had some kind of sad interaction with inheritance model in the mattr library.

All that suite.matchProof is trying to do is string equality check really…

In our fork of this library, we were able to resolve this issue by just not using it…

for (const s of suites) {
            const matchFound = s.type.replace("sec:", "") === proof.type;
            if (matchFound) {
              return s
                .verifyProof({
                  proof,
                  document,
                  purpose,
                  documentLoader,
                  expansionMap,
                  compactProof,
                })
                .catch((error: any) => ({ verified: false, error }));
            }
          }

This is very hacky… ideally, we would update the suite and account for https://github.com/mattrglobal/jsonld-signatures-bbs/issues/142 which is related.

1reaction
OR13commented, Jul 20, 2021

yes, I think so… IMO the mattr suite should be updated, since it now has several breaking issues with the latest version of jsonld-signatures that assumes new suite methods, such as ensureContext

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: suite.ensureSuiteContext is not a function #142
Verification fails for BbsBlsSignatureProof2020 for jsonld-signatures >8.0.0 digitalbazaar/jsonld-signatures#143.
Read more >
BBS+ Signatures 2020 - W3C Credentials Community Group
This specification defines a set of cryptographic suites for the purpose of creating, verifying and deriving proofs for BBS+ Signatures in ...
Read more >
digitalbazaar - Bountysource
Verification fails for `BbsBlsSignatureProof2020` for jsonld-signatures ... of jsonld-signatures fails when the version of jsonld-signatures is >8.0.0.
Read more >
Error: jsonld.InvalidUrl: Dereferencing a URL did not result in a valid ...
Error: jsonld. ... I am not sure why I am getting the error. ... Verification fails for `BbsBlsSignatureProof2020` for jsonld-signatures >8.0.0 HOT 6 ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found