/// <inheritdoc /> public async Task <CredentialRecord> CreateCredentialAsync(IAgentContext agentContext, CredentialOfferMessage message) { var service = message.GetDecorator <ServiceDecorator>(DecoratorNames.ServiceDecorator); var credentialRecordId = await ProcessOfferAsync(agentContext, message, null); var(request, record) = await CreateRequestAsync(agentContext, credentialRecordId); var provisioning = await ProvisioningService.GetProvisioningAsync(agentContext.Wallet); try { var credentialIssueMessage = await MessageService.SendReceiveAsync <CredentialIssueMessage>( wallet : agentContext.Wallet, message : request, recipientKey : service.RecipientKeys.First(), endpointUri : service.ServiceEndpoint, routingKeys : service.RoutingKeys.ToArray(), senderKey : provisioning.IssuerVerkey); var recordId = await ProcessCredentialAsync(agentContext, credentialIssueMessage, null); return(await RecordService.GetAsync <CredentialRecord>(agentContext.Wallet, recordId)); } catch (AriesFrameworkException ex) when(ex.ErrorCode == ErrorCode.A2AMessageTransmissionError) { throw new AriesFrameworkException(ex.ErrorCode, ex.Message, record, null); } }
/// <inheritdoc /> public async Task <CredentialRecord> CreateCredentialAsync(IAgentContext agentContext, CredentialOfferMessage message) { var service = message.GetDecorator <ServiceDecorator>(DecoratorNames.ServiceDecorator); var credentialRecordId = await ProcessOfferAsync(agentContext, message, null); var(request, record) = await CreateRequestAsync(agentContext, credentialRecordId); var provisioning = await ProvisioningService.GetProvisioningAsync(agentContext.Wallet); var credentialIssueMessage = await MessageService.SendReceiveAsync <CredentialIssueMessage>( wallet : agentContext.Wallet, message : request, recipientKey : service.RecipientKeys.First(), endpointUri : service.ServiceEndpoint, routingKeys : service.RoutingKeys.ToArray(), senderKey : provisioning.IssuerVerkey); var recordId = await ProcessCredentialAsync(agentContext, credentialIssueMessage, null); return(await RecordService.GetAsync <CredentialRecord>(agentContext.Wallet, recordId)); }