Exemplo n.º 1
0
        public async Task CanPerformProofProtocol()
        {
            (var issuerConnection, var holderConnection) = await AgentScenarios.EstablishConnectionAsync(_issuerAgent, _holderAgent);

            await AgentScenarios.IssueCredentialAsync(_issuerAgent, _holderAgent, issuerConnection, holderConnection, new List <CredentialPreviewAttribute>
            {
                new CredentialPreviewAttribute("first_name", "Test"),
                new CredentialPreviewAttribute("last_name", "Holder")
            });

            (var holderRequestorConnection, var requestorConnection) = await AgentScenarios.EstablishConnectionAsync(_holderAgent, _requestorAgent);

            await AgentScenarios.ProofProtocolAsync(_requestorAgent, _holderAgent, requestorConnection,
                                                    holderRequestorConnection, new ProofRequest()
            {
                Name                = "ProofReq",
                Version             = "1.0",
                Nonce               = $"0{Guid.NewGuid().ToString("N")}",
                RequestedAttributes = new Dictionary <string, ProofAttributeInfo>
                {
                    { "first-name-requirement", new ProofAttributeInfo {
                          Name = "first_name"
                      } }
                }
            });
        }
        public async Task CanIssueCredential()
        {
            (var issuerConnection, var holderConnection) = await AgentScenarios.EstablishConnectionAsync(_issuerAgent, _holderAgent);

            await AgentScenarios.IssueCredentialAsync(_issuerAgent, _holderAgent, issuerConnection, holderConnection, new List <CredentialPreviewAttribute>
            {
                new CredentialPreviewAttribute("first_name", "Test"),
                new CredentialPreviewAttribute("last_name", "Holder")
            });
        }
Exemplo n.º 3
0
        public async Task CanPerformProofProtocolConnectionless(bool useDidKeyFormat)
        {
            (var issuerConnection, var holderConnection) = await AgentScenarios.EstablishConnectionAsync(_issuerAgent, _holderAgent);

            await AgentScenarios.IssueCredentialAsync(_issuerAgent, _holderAgent, issuerConnection, holderConnection, new List <CredentialPreviewAttribute>
            {
                new CredentialPreviewAttribute("first_name", "Test"),
                new CredentialPreviewAttribute("last_name", "Holder")
            });

            await AgentScenarios.ProofProtocolConnectionlessAsync(_requestorAgent, _holderAgent, new ProofRequest()
            {
                Name                = "ProofReq",
                Version             = "1.0",
                Nonce               = await AnonCreds.GenerateNonceAsync(),
                RequestedAttributes = new Dictionary <string, ProofAttributeInfo>
                {
                    { "first-name-requirement", new ProofAttributeInfo {
                          Name = "first_name"
                      } }
                }
            }, useDidKeyFormat);
        }