Exemple #1
0
        /// <inheritdoc />
        public virtual async Task <string> ProcessProofRequestAsync(IAgentContext agentContext,
                                                                    ProofRequestMessage proofRequest, ConnectionRecord connection)
        {
            var requestJson = proofRequest.ProofRequestJson;

            // Write offer record to local wallet
            var proofRecord = new ProofRecord
            {
                Id           = Guid.NewGuid().ToString(),
                RequestJson  = requestJson,
                ConnectionId = connection.Id,
                State        = ProofState.Requested
            };

            proofRecord.SetTag(TagConstants.LastThreadId, proofRequest.GetThreadId());
            proofRecord.SetTag(TagConstants.Role, TagConstants.Holder);

            await RecordService.AddAsync(agentContext.Wallet, proofRecord);

            EventAggregator.Publish(new ServiceMessageProcessingEvent
            {
                RecordId    = proofRecord.Id,
                MessageType = proofRequest.Type,
                ThreadId    = proofRequest.GetThreadId()
            });

            return(proofRecord.Id);
        }
        /// <inheritdoc />
        public virtual async Task <string> ProcessProofRequestAsync(IAgentContext agentContext,
                                                                    ProofRequestMessage proofRequest, ConnectionRecord connection, bool isVcOidc)
        {
            var requestJson = proofRequest.ProofRequestJson;


            // Write offer record to local wallet
            var proofRecord = new ProofRecord
            {
                Id           = Guid.NewGuid().ToString(),
                RequestJson  = requestJson,
                ConnectionId = isVcOidc ? null : connection.Id,
                State        = ProofState.Requested
            };

            proofRecord.SetTag(TagConstants.LastThreadId, proofRequest.GetThreadId());
            proofRecord.SetTag(TagConstants.Role, TagConstants.Holder);

            if (!connection.Sso && !isVcOidc)
            {
                await RecordService.AddAsync(agentContext.Wallet, proofRecord);

                EventAggregator.Publish(new ServiceMessageProcessingEvent
                {
                    RecordId    = proofRecord.Id,
                    MessageType = proofRequest.Type,
                    ThreadId    = proofRequest.GetThreadId()
                });
            }
            else
            {
                if (isVcOidc)
                {
                    connection.Endpoint = new AgentEndpoint {
                        Uri = proofRequest.ServiceDecorator.ServiceEndpoint?.ToString()
                    };
                }
                await SelectCredentialsForProofAsync(agentContext, proofRecord, connection);
            }

            return(proofRecord.Id);
        }