Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Commit

Permalink
feat: update proofs api, wip
Browse files Browse the repository at this point in the history
  • Loading branch information
tplooker committed Apr 23, 2020
1 parent 146b36e commit b92151e
Show file tree
Hide file tree
Showing 20 changed files with 663 additions and 22,728 deletions.
51 changes: 51 additions & 0 deletions __tests__/BbsBlsSignatureProof2020.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { exampleBls12381KeyPair,
testRevealDocument,
testSignedDocument,
testProofDocument,
customLoader,
} from "./__fixtures__";

import jsigs from "jsonld-signatures";
import { Bls12381G2KeyPair, BbsBlsSignatureProof2020 } from "../src/index";

const key = new Bls12381G2KeyPair(exampleBls12381KeyPair);

describe("BbsBlsSignatureProof2020", () => {
it("should derive proof", async () => {
const suite = new BbsBlsSignatureProof2020({ useNativeCanonize: false, key });
let document = { ...testSignedDocument };
let proof = {
'@context': jsigs.SECURITY_CONTEXT_URL,
...testSignedDocument.proof
};
delete document.proof;
const result = await suite.deriveProof({
document,
proof,
revealDocument: testRevealDocument,
documentLoader: customLoader ,
compactProof: false
});
console.log(JSON.stringify(result,null,2));
expect(result).toBeDefined();
});

it("should verify derived proof", async () => {
const suite = new BbsBlsSignatureProof2020({ useNativeCanonize: false, key });
let document = { ...testProofDocument };
let proof = {
'@context': jsigs.SECURITY_CONTEXT_URL,
...testProofDocument.proof
};
delete document.proof;
const result = await suite.verifyProof({
document,
proof,
documentLoader: customLoader,
compactProof: false,
purpose: new jsigs.purposes.AssertionProofPurpose()
});
console.log(result);
expect(result).toBeDefined();
});
});
Loading

0 comments on commit b92151e

Please sign in to comment.