public RequestProofHandler(string relationshipDID, string proofName, Attribute[] attributes) { _handler = PresentProof.v1_0(relationshipDID, proofName, attributes); _messageHandler = (messageName, message) => { if ("presentation-result".Equals(messageName)) { var proofComplete = true; } }; }
public void testGetThreadId() { PresentProofV1_0 testProtocol = PresentProof.v1_0( forRelationship, proofRequestName, new Protocols.PresentProof.Attribute[] { attr1 }, new Protocols.PresentProof.Predicate[] { pred1 } ); Assert.IsNotNull(testProtocol.getThreadId()); }
public void testGetMessageType() { PresentProofV1_0 testProtocol = PresentProof.v1_0(forRelationship, ""); string msgName = "msg name"; Assert.AreEqual(Util.getMessageType( Util.COMMUNITY_MSG_QUALIFIER, testProtocol.family(), testProtocol.version(), msgName ), testProtocol.messageType(msgName)); }
public void testRequest() { withContext(context => { PresentProofV1_0 presentProof = PresentProof.v1_0(forRelationship, proofRequestName, attr1); byte[] message = presentProof.requestMsgPacked(context); JsonObject unpackedMessage = TestHelpers.unpackForwardMessage(context, message); testBaseMessage(unpackedMessage); Assert.AreEqual( Util.COMMUNITY_MSG_QUALIFIER + "/present-proof/1.0/request", unpackedMessage.getAsString("@type") ); }); }
public void testRequest() { withContext(context => { PresentProofV1_0 presentProof = PresentProof.v1_0(forRelationship, proofRequestName, attr1); byte[] message = presentProof.requestMsgPacked(context); JsonObject unpackedMessage = TestHelpers.unpackForwardMessage(context, message); testBaseMessage(unpackedMessage); Assert.AreEqual( "did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/present-proof/1.0/request", unpackedMessage.getAsString("@type") ); }); }
public void testAcceptProposal() { withContext(context => { PresentProofV1_0 testProtocol = PresentProof.v1_0(forRelationship, Guid.NewGuid().ToString()); byte [] message = testProtocol.acceptProposalMsgPacked(context); JsonObject unpackedMessage = TestHelpers.unpackForwardMessage(context, message); testBaseMessage(unpackedMessage); Assert.AreEqual( Util.COMMUNITY_MSG_QUALIFIER + "/present-proof/1.0/accept-proposal", unpackedMessage.getAsString("@type") ); }); }
public void testAcceptProposal() { withContext(context => { PresentProofV1_0 testProtocol = PresentProof.v1_0(forRelationship, Guid.NewGuid().ToString()); byte [] message = testProtocol.acceptProposalMsgPacked(context); JsonObject unpackedMessage = TestHelpers.unpackForwardMessage(context, message); testBaseMessage(unpackedMessage); Assert.AreEqual( "did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/present-proof/1.0/accept-proposal", unpackedMessage.getAsString("@type") ); }); }
public void testReject() { withContext(context => { PresentProofV1_0 testProtocol = PresentProof.v1_0(forRelationship, Guid.NewGuid().ToString()); byte[] message = testProtocol.rejectMsgPacked(context, "because"); JsonObject unpackedMessage = TestHelpers.unpackForwardMessage(context, message); testBaseMessage(unpackedMessage); Assert.AreEqual( Util.COMMUNITY_MSG_QUALIFIER + "/present-proof/1.0/reject", unpackedMessage.getAsString("@type") ); Assert.AreEqual("because", unpackedMessage.getAsString("reason")); Assert.IsFalse(testProtocol.rejectMsg(context, "").ContainsKey("reason")); Assert.IsFalse(testProtocol.rejectMsg(context, null).ContainsKey("reason")); }); }
public void testConstructorWithAttr() { Context context = TestHelpers.getContext(); PresentProofV1_0 testProtocol = PresentProof.v1_0( forRelationship, proofRequestName, new Protocols.PresentProof.Attribute[] { attr1 }, new Protocols.PresentProof.Predicate[] { pred1 }, byInvitation ); JsonObject msg = testProtocol.requestMsg(context); testRequestMsgMessages(msg); JsonObject msg2 = testProtocol.statusMsg(context); testStatusMsg(msg2); }
void DoRequestProof() { // input parameters for request proof string proofName = "Proof of Degree - " + Guid.NewGuid().ToString().Substring(0, 8); Restriction restriction = RestrictionBuilder .blank() .issuerDid(_issuerDID) .build(); Protocols.PresentProof.Attribute nameAttr = PresentProofV1_0.attribute("name", restriction); Protocols.PresentProof.Attribute degreeAttr = PresentProofV1_0.attribute("degree", restriction); // constructor for the Present Proof protocol PresentProofV1_0 proof = PresentProof.v1_0(_relDID, proofName, nameAttr, degreeAttr); requestProofHandler(proof); // request proof proof.request(context); // wait for connect.me user to present the requested proof WaitFor(ref proofComplete, "Waiting for proof presentation from Connect.me"); }