Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verification fails for BbsBlsSignatureProof2020 for jsonld-signatures >8.0.0 #143

Open
kuzdogan opened this issue May 14, 2021 · 6 comments

Comments

@kuzdogan
Copy link

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

@vongohren
Copy link

Experiencing the same at mattrglobal/jsonld-signatures-bbs#139 and I do think I have pinned it down to a line. But I dont know what the solution shall be. Awaitng reply from the creators as well

@kuzdogan
Copy link
Author

I am using version 7.0.0 as a workaround @vongohren. Only fails with version >8.0.0

@vongohren
Copy link

@kuzdogan cool, thanks! I have use the one bundled with this lib, which currently is only 5, but works for now. I will look to test out 7.0.0

@OR13
Copy link

OR13 commented 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 mattrglobal/jsonld-signatures-bbs#142 which is related.

@vongohren
Copy link

@OR13 nice find, so the process for this would be to solve that attached issue?

@OR13
Copy link

OR13 commented 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants