This repository has been archived by the owner on Oct 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
663 additions
and
22,728 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
}); | ||
}); |
Oops, something went wrong.