public async Task SignCreateProofAndVerifyVaccination() { var unsignedDocument = Utilities.LoadJson("Data/vaccination-certificate-unsigned.jsonld"); var verificationMethod = new Bls12381G2Key2020(Utilities.LoadJson("Data/did_example_489398593_test.json")); var signedDocument = await LdSignatures.SignAsync(unsignedDocument, new ProofOptions { Suite = new BbsBlsSignature2020 { KeyPair = verificationMethod.ToBlsKeyPair(), VerificationMethod = "did:example:489398593#test" }, Purpose = new AssertionMethodPurpose() }); var revealDocument = Utilities.LoadJson("Data/vaccination-certificate-frame.jsonld"); var derivedDocument = await LdSignatures.SignAsync(signedDocument, new ProofOptions { Suite = new BbsBlsSignatureProof2020 { RevealDocument = revealDocument }, Purpose = new AssertionMethodPurpose() }); var result = await LdSignatures.VerifyAsync(derivedDocument, new ProofOptions { Suite = new BbsBlsSignatureProof2020(), Purpose = new AssertionMethodPurpose() }); Assert.NotNull(result); Assert.Equal("did:example:489398593", result.Controller); }
public async Task SignDocumentRevealAll() { var revealDocument = Utilities.LoadJson("Data/test_reveal_all_document.json"); var signedDocument = Utilities.LoadJson("Data/test_signed_document.json"); var verificationMethod = new Bls12381G2Key2020(Utilities.LoadJson("Data/did_example_489398593_test.json")); var derivedDocument = await LdSignatures.SignAsync(signedDocument, new ProofOptions { Suite = new BbsBlsSignatureProof2020 { RevealDocument = revealDocument, VerificationMethod = verificationMethod.Id }, Purpose = new AssertionMethodPurpose() }); derivedDocument.Should().NotBeNull(); derivedDocument["proof"].Should().NotBeNull(); derivedDocument["proof"]["proofValue"].Should().NotBeNull(); }
public async Task SignDocumentRevealSome() { var revealDocument = Utilities.LoadJson("Data/test_vc_reveal_document.json"); var unsignedDocument = Utilities.LoadJson("Data/test_vc.json"); var verificationMethod = new Bls12381G2Key2020(Utilities.LoadJson("Data/did_example_489398593_test.json")); var signedDocument = await LdSignatures.SignAsync(unsignedDocument, new ProofOptions { Suite = new BbsBlsSignature2020 { KeyPair = verificationMethod.ToBlsKeyPair(), VerificationMethod = "did:example:489398593#test" }, Purpose = new AssertionMethodPurpose() }); var derivedDocument = await LdSignatures.SignAsync(signedDocument, new ProofOptions { Suite = new BbsBlsSignatureProof2020 { RevealDocument = revealDocument }, Purpose = new AssertionMethodPurpose() }); derivedDocument.Should().NotBeNull(); derivedDocument["proof"].Should().NotBeNull(); derivedDocument["proof"]["proofValue"].Should().NotBeNull(); var verifyDerived = await LdSignatures.VerifyAsync(derivedDocument, new ProofOptions { Suite = new BbsBlsSignatureProof2020(), Purpose = new AssertionMethodPurpose() }); Assert.NotNull(verifyDerived); Assert.Equal(verifyDerived.Controller, verificationMethod.Controller); }