public ProofRequestsViewModel(
            IUserDialogs userDialogs,
            INavigationService navigationService,
            IProofService proofService,
            ICredentialService credentialService,
            IAgentProvider agentContextProvider,
            IWalletRecordService recordService,
            IEventAggregator eventAggregator,
            IProofAssembler proofAssembler,
            IRequestPresentationFiller requestPresentationFiller,
            ILifetimeScope scope
            ) : base(
                AppResources.ProofsPageTitle,
                userDialogs,
                navigationService
                )
        {
            _proofService         = proofService;
            _agentContextProvider = agentContextProvider;
            _scope                     = scope;
            _eventAggregator           = eventAggregator;
            _recordService             = recordService;
            _credentialService         = credentialService;
            _proofAssembler            = proofAssembler;
            _requestPresentationFiller = requestPresentationFiller;

            this.WhenAnyValue(x => x.SearchTerm)
            .Throttle(TimeSpan.FromMilliseconds(200))
            .InvokeCommand(RefreshCommand);
        }
 /// <summary>
 /// This constructor is used when proof request details are fetched from mediator
 /// </summary>
 public ProofRequestViewModel(IUserDialogs userDialogs,
                              INavigationService navigationService,
                              IAgentProvider agentContextProvider,
                              IProofService proofService,
                              ILifetimeScope scope,
                              ICredentialService credentialService,
                              IConnectionService connectionService,
                              IEventAggregator eventAggregator,
                              IMessageService messageService,
                              ProofRecord proofRecord,
                              ConnectionRecord connection) : base("Proof Request Detail", userDialogs, navigationService)
 {
     this.userDialogs          = userDialogs;
     this.navigationService    = navigationService;
     this.agentContextProvider = agentContextProvider;
     this.proofService         = proofService;
     this.scope             = scope;
     this.credentialService = credentialService;
     this.connectionService = connectionService;
     this.eventAggregator   = eventAggregator;
     this.messageService    = messageService;
     this.proofRecord       = proofRecord;
     this.connection        = connection;
     ConnectionLogo         = connection.Alias.ImageUrl;
     ConnectionName         = connection.Alias.Name;
     ProofRequest           = JsonConvert.DeserializeObject <ProofRequest>(proofRecord.RequestJson);
     ProofRequestName       = ProofRequest?.Name;
     RequestedAttributes    = new ObservableCollection <ProofRequestAttributeViewModel>();
     HasLogo = !string.IsNullOrWhiteSpace(ConnectionLogo);
 }
Ejemplo n.º 3
0
 public HomeViewModel(IUserDialogs userDialogs,
                      INavigationService navigationService,
                      IConnectionService connectionService,
                      ICredentialService credentialService,
                      ICredentialAssembler credentialAssembler,
                      IProofAssembler proofAssembler,
                      IRequestPresentationFiller requestPresentationFiller,
                      IConnectionAssembler connectionAssembler,
                      IProofService proofService,
                      IWalletRecordService recordService,
                      IAgentProvider agentContextProvider,
                      IEventAggregator eventAggregator,
                      ILifetimeScope scope) : base(AppResources.HomeTabTitle, userDialogs, navigationService)
 {
     _connectionService         = connectionService;
     _credentialService         = credentialService;
     _credentialAssembler       = credentialAssembler;
     _connectionAssembler       = connectionAssembler;
     _proofAssembler            = proofAssembler;
     _proofService              = proofService;
     _requestPresentationFiller = requestPresentationFiller;
     _recordService             = recordService;
     _agentContextProvider      = agentContextProvider;
     _eventAggregator           = eventAggregator;
     _scope             = scope;
     _userDialogs       = userDialogs;
     _navigationService = navigationService;
 }
        public ProofRequestViewModel(IUserDialogs userDialogs,
                                     INavigationService navigationService,
                                     IProofService proofService,
                                     IAgentProvider agentContextProvider,
                                     IMessageService messageService,
                                     IConnectionService connectionService,
                                     IEventAggregator eventAggregator,
                                     IWalletRecordService recordService,
                                     IProofCredentialSelector proofCredentialSelector,
                                     ProofRecord proof) : base(AppResources.ProofRequestPageTitle, userDialogs, navigationService)
        {
            _proofRecord             = proof;
            _proofService            = proofService;
            _agentContextProvider    = agentContextProvider;
            _messageService          = messageService;
            _connectionService       = connectionService;
            _eventAggregator         = eventAggregator;
            _userDialogs             = userDialogs;
            _recordService           = recordService;
            _navigationService       = navigationService;
            _proofCredentialSelector = proofCredentialSelector;
            GetConnectionAlias();

            _proofRequest = JsonConvert.DeserializeObject <ProofRequest>(_proofRecord.RequestJson);

            ProofName = _proofRequest.Name;

            Version = _proofRequest.Version;

            State = ProofStateTranslator.Translate(_proofRecord.State);

            AreButtonsVisible = _proofRecord.State == ProofState.Requested;

            Attributes = new List <ProofAttributeViewModel>();
        }
Ejemplo n.º 5
0
 public RequestIdentityProofViewModel(
     IUserDialogs userDialogs,
     INavigationService navigationService,
     IAgentProvider agentContextProvider,
     IMessageService messageService,
     IConnectionService defaultConnectionService,
     ISchemaService schemaService,
     ICredentialService credentialService,
     ILedgerService ledgerService,
     IProofService proofService
     ) : base(
         "Request Identity Proof",
         userDialogs,
         navigationService)
 {
     _agentContextProvider = agentContextProvider;
     _connectionService    = defaultConnectionService;
     _proofService         = proofService;
     _messageService       = messageService;
     _schemaService        = schemaService;
     _credentialService    = credentialService;
     _ledgerService        = ledgerService;
     Schemas         = new RangeEnabledObservableCollection <SchemaRecord>();
     CredDefinitions = new RangeEnabledObservableCollection <DefinitionRecord>();
 }
 /// <summary>
 /// This constructor is used presentation request is scanned
 /// </summary>
 public ProofRequestViewModel(IUserDialogs userDialogs,
                              INavigationService navigationService,
                              IAgentProvider agentContextProvider,
                              IProofService proofService,
                              ILifetimeScope scope,
                              ICredentialService credentialService,
                              IConnectionService connectionService,
                              IEventAggregator eventAggregator,
                              IMessageService messageService,
                              ProofRequest proofRequest,
                              RequestPresentationMessage requestPresentationMessage) : base("Proof Request Detail", userDialogs, navigationService)
 {
     this.userDialogs          = userDialogs;
     this.navigationService    = navigationService;
     this.agentContextProvider = agentContextProvider;
     this.proofService         = proofService;
     this.scope                      = scope;
     this.credentialService          = credentialService;
     this.connectionService          = connectionService;
     this.eventAggregator            = eventAggregator;
     this.messageService             = messageService;
     this.requestPresentationMessage = requestPresentationMessage;
     ConnectionName                  = "Scanned Presentation Request";
     ProofRequest                    = proofRequest;
     ProofRequestName                = ProofRequest?.Name;
     RequestedAttributes             = new ObservableCollection <ProofRequestAttributeViewModel>();
     HasLogo = !string.IsNullOrWhiteSpace(ConnectionLogo);
 }
 public MessageAgentMiddleware(
     IMemoryCache memoryCache,
     IProofService proofService
     )
 {
     _cache        = memoryCache;
     _proofService = proofService;
 }
Ejemplo n.º 8
0
 public GetCredentialsForProofHandler
 (
     IAgentProvider aAgentProvider,
     IProofService aProofService
 )
 {
     AgentProvider = aAgentProvider;
     ProofService  = aProofService;
 }
 public GetProofHandler
 (
     IAgentProvider aAgentProvider,
     IProofService aProofService
 )
 {
     AgentProvider = aAgentProvider;
     ProofService  = aProofService;
 }
Ejemplo n.º 10
0
        public static async Task <(ProofRecord holderProofRecord, ProofRecord RequestorProofRecord)> ProofProtocolAsync(
            IProofService proofService,
            IProducerConsumerCollection <AgentMessage> messages,
            ConnectionRecord holderConnection, ConnectionRecord requestorConnection,
            IAgentContext holderContext,
            IAgentContext requestorContext, ProofRequest proofRequestObject)
        {
            //Requestor sends a proof request
            var(message, requestorProofRecord) = await proofService.CreateRequestAsync(requestorContext, proofRequestObject, requestorConnection.Id);

            messages.TryAdd(message);

            // Holder accepts the proof requests and builds a proof
            var proofRequest = FindContentMessage <RequestPresentationMessage>(messages);

            Assert.NotNull(proofRequest);

            //Holder stores the proof request
            var holderProofRequestRecord = await proofService.ProcessRequestAsync(holderContext, proofRequest, holderConnection);

            var holderProofRecord = await proofService.GetAsync(holderContext, holderProofRequestRecord.Id);

            var holderProofRequest = JsonConvert.DeserializeObject <ProofRequest>(holderProofRecord.RequestJson);

            // Auto satify the proof with which ever credentials in the wallet are capable
            var requestedCredentials =
                await ProofServiceUtils.GetAutoRequestedCredentialsForProofCredentials(holderContext, proofService,
                                                                                       holderProofRequest);

            //Holder accepts the proof request and sends a proof
            (var proofMessage, _) = await proofService.CreatePresentationAsync(
                holderContext,
                holderProofRequestRecord.Id,
                requestedCredentials);

            messages.TryAdd(proofMessage);

            //Requestor retrives proof message from their cloud agent
            var proof = FindContentMessage <PresentationMessage>(messages);

            Assert.NotNull(proof);

            //Requestor stores proof
            requestorProofRecord = await proofService.ProcessPresentationAsync(requestorContext, proof);

            //Requestor verifies proof
            var requestorVerifyResult = await proofService.VerifyProofAsync(requestorContext, requestorProofRecord.Id);

            //Verify the proof is valid
            Assert.True(requestorVerifyResult);

            var requestorProofRecordResult = await proofService.GetAsync(requestorContext, requestorProofRecord.Id);

            var holderProofRecordResult = await proofService.GetAsync(holderContext, holderProofRecord.Id);

            return(holderProofRecordResult, requestorProofRecordResult);
        }
        public EphemeralChallengeTests()
        {
            var recordService = new DefaultWalletRecordService();
            var ledgerService = new DefaultLedgerService();

            var eventAggregator = new EventAggregator();

            var routingMock = new Mock <IMessageService>();

            routingMock.Setup(x =>
                              x.SendAsync(It.IsAny <Wallet>(), It.IsAny <AgentMessage>(), It.IsAny <ConnectionRecord>(), It.IsAny <string>(), It.IsAny <bool>()))
            .Callback((Wallet _, AgentMessage content, ConnectionRecord __, string ___, bool ____) =>
            {
                if (_routeMessage)
                {
                    _messages.Add(content);
                }
                else
                {
                    throw new AgentFrameworkException(ErrorCode.LedgerOperationRejected, "");
                }
            })
            .Returns(Task.FromResult <MessageContext>(null));

            var provisioningMock = ServiceUtils.GetDefaultMockProvisioningService();

            var tailsService = new DefaultTailsService(ledgerService, new HttpClientHandler());

            _schemaService = new DefaultSchemaService(provisioningMock, recordService, ledgerService, tailsService);

            _connectionService = new DefaultConnectionService(
                eventAggregator,
                recordService,
                provisioningMock,
                new Mock <ILogger <DefaultConnectionService> >().Object);

            _credentialService = new DefaultCredentialService(
                eventAggregator,
                ledgerService,
                _connectionService,
                recordService,
                _schemaService,
                tailsService,
                provisioningMock,
                new Mock <ILogger <DefaultCredentialService> >().Object);

            _proofService = new DefaultProofService(
                eventAggregator,
                _connectionService,
                recordService,
                provisioningMock,
                ledgerService,
                tailsService,
                new Mock <ILogger <DefaultProofService> >().Object);

            _ephemeralChallengeService = new DefaultEphemeralChallengeService(eventAggregator, _proofService, recordService, provisioningMock, new Mock <ILogger <DefaultEphemeralChallengeService> >().Object);
        }
Ejemplo n.º 12
0
 public ProofController(
     IAgentProvider agentProvider,
     IProofService proofService,
     IWalletRecordService walletRecordService,
     IMessageService messageService,
     IConnectionService connectionService)
 {
     _agentProvider       = agentProvider;
     _proofService        = proofService;
     _walletRecordService = walletRecordService;
     _messageService      = messageService;
     _connectionService   = connectionService;
 }
 public AcceptProofRequestHandler
 (
     IAgentProvider aAgentProvider,
     IProofService aProofService,
     IProvisioningService aProvisioningService,
     IMessageService aMessageService
 )
 {
     AgentProvider       = aAgentProvider;
     ProofService        = aProofService;
     ProvisioningService = aProvisioningService;
     MessageService      = aMessageService;
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DefaultEphemeralChallengeService"/> class.
 /// </summary>
 /// <param name="eventAggregator">The event aggregator.</param>
 /// <param name="proofService">The proof service.</param>
 /// <param name="recordService">The record service.</param>
 /// <param name="provisioningService">The provisioning service.</param>
 /// <param name="logger">The logger.</param>
 public DefaultEphemeralChallengeService(
     IEventAggregator eventAggregator,
     IProofService proofService,
     IWalletRecordService recordService,
     IProvisioningService provisioningService,
     ILogger <DefaultEphemeralChallengeService> logger)
 {
     EventAggregator     = eventAggregator;
     ProofService        = proofService;
     RecordService       = recordService;
     ProvisioningService = provisioningService;
     Logger = logger;
 }
Ejemplo n.º 15
0
        public static async Task <(ProofRecord holderProofRecord, ProofRecord requestorProofRecord)> RequestorInitiatedProofProtocolAsync(
            IProofService proofService,
            IProducerConsumerCollection <AgentMessage> messages,
            ConnectionRecord holderConnection, ConnectionRecord requestorConnection,
            IAgentContext holderContext,
            IAgentContext requestorContext, ProofRequest proofRequestObject)
        {
            //Requestor sends a proof request
            var(message, requestorProofRecord) = await proofService.CreateRequestAsync(requestorContext, proofRequestObject, requestorConnection.Id);

            messages.TryAdd(message);

            return(await ProofProtocolAsync(proofService, messages, holderConnection, requestorConnection, holderContext, requestorContext, requestorProofRecord));
        }
Ejemplo n.º 16
0
 public ProofRequestsViewModel(IUserDialogs userDialogs,
                               INavigationService navigationService,
                               IAgentProvider agentContextProvider,
                               IProofService proofService,
                               IConnectionService connectionService,
                               IEventAggregator eventAggregator,
                               ILifetimeScope scope) : base("Proof Requests", userDialogs, navigationService)
 {
     _connectionService    = connectionService;
     _agentContextProvider = agentContextProvider;
     _proofService         = proofService;
     this.eventAggregator  = eventAggregator;
     _scope = scope;
 }
Ejemplo n.º 17
0
        public ProofTests()
        {
            var recordService = new DefaultWalletRecordService();
            var ledgerService = new DefaultLedgerService(new DefaultLedgerSigningService());

            _eventAggregator = new EventAggregator();

            var messageService = new DefaultMessageService(new Mock <ILogger <DefaultMessageService> >().Object, new IMessageDispatcher[] { });

            var provisioning   = ServiceUtils.GetDefaultMockProvisioningService();
            var paymentService = new DefaultPaymentService();

            var clientFactory = new Mock <IHttpClientFactory>();

            clientFactory.Setup(x => x.CreateClient(It.IsAny <string>()))
            .Returns(new HttpClient());

            var tailsService = new DefaultTailsService(ledgerService, clientFactory.Object);

            _schemaService = new DefaultSchemaService(provisioning, recordService, ledgerService, paymentService, tailsService);

            _connectionService = new DefaultConnectionService(
                _eventAggregator,
                recordService,
                provisioning,
                new Mock <ILogger <DefaultConnectionService> >().Object);

            _credentialService = new DefaultCredentialService(
                _eventAggregator,
                ledgerService,
                _connectionService,
                recordService,
                _schemaService,
                tailsService,
                provisioning,
                paymentService,
                messageService,
                new Mock <ILogger <DefaultCredentialService> >().Object);

            _proofService = new DefaultProofService(
                _eventAggregator,
                _connectionService,
                recordService,
                provisioning,
                ledgerService,
                tailsService,
                messageService,
                new Mock <ILogger <DefaultProofService> >().Object);
        }
 public CreateProofRequestsHandler
 (
     IAgentProvider aAgentProvider,
     IProofService aProofService,
     IProvisioningService aProvisioningService,
     IConnectionService aConnectionService,
     IMessageService aMessageService
 )
 {
     AgentProvider       = aAgentProvider;
     ProofService        = aProofService;
     ProvisioningService = aProvisioningService;
     ConnectionService   = aConnectionService;
     MessageService      = aMessageService;
 }
Ejemplo n.º 19
0
        public MainViewModel(
            IUserDialogs userDialogs,
            INavigationService navigationService,
            HomeViewModel homeViewModel,
            MessagesViewModel messagesViewModel,
            IAgentProvider agentContextProvider,
            ConnectionsViewModel connectionsViewModel,
            CredentialsViewModel credentialsViewModel,
            IEventAggregator eventAggregator,
            IProofService proofService,
            IProofAssembler proofAssembler,
            IWalletRecordService recordService,
            IRequestPresentationFiller requestPresentationFiller,
            AccountViewModel accountViewModel,
            ProofRequestsViewModel proofRequestsViewModel,
            CreateInvitationViewModel createInvitationViewModel
            ) : base(
                nameof(MainViewModel),
                userDialogs,
                navigationService
                )
        {
            Home                       = homeViewModel;
            Messages                   = messagesViewModel;
            Connections                = connectionsViewModel;
            Credentials                = credentialsViewModel;
            Account                    = accountViewModel;
            ProofRequests              = proofRequestsViewModel;
            CreateInvitation           = createInvitationViewModel;
            _eventAggregator           = eventAggregator;
            _proofService              = proofService;
            _recordService             = recordService;
            _agentContextProvider      = agentContextProvider;
            _requestPresentationFiller = requestPresentationFiller;
            _proofAssembler            = proofAssembler;
            MessagingCenter.Subscribe <object>(this, "ScanInvite", async(sender) =>
            {
                await ScanInvite();
            });

            _subscription = _eventAggregator.GetEventByType <ServiceMessageProcessingEvent>()
                            .Where(x => x.MessageType == MessageTypes.PresentProofNames.RequestPresentation || x.MessageType == "https://didcomm.org/present-proof/1.0/request-presentation")
                            .Subscribe(async x =>
            {
                await DisplayRequestPresentation(x.RecordId);
            });
        }
Ejemplo n.º 20
0
        /// <summary>Retrieves a proof record by its thread id.</summary>
        /// <param name="proofService">Proof service.</param>
        /// <param name="context">The context.</param>
        /// <param name="threadId">The thread id.</param>
        /// <returns>The proof record.</returns>
        public static async Task <ProofRecord> GetByThreadIdAsync(
            this IProofService proofService, IAgentContext context, string threadId)
        {
            var search = await proofService.ListAsync(context, SearchQuery.Equal(TagConstants.LastThreadId, threadId), 1);

            if (search.Count == 0)
            {
                throw new AgentFrameworkException(ErrorCode.RecordNotFound, $"Proof record not found by thread id : {threadId}");
            }

            if (search.Count > 1)
            {
                throw new AgentFrameworkException(ErrorCode.RecordInInvalidState, $"Multiple proof records found by thread id : {threadId}");
            }

            return(search.Single());
        }
Ejemplo n.º 21
0
 public ConnectionsViewModel(IUserDialogs userDialogs,
                             INavigationService navigationService,
                             IConnectionService connectionService,
                             IAgentProvider agentContextProvider,
                             IEventAggregator eventAggregator,
                             IProofService proofService,
                             IWalletRecordService recordService,
                             ILifetimeScope scope) :
     base(AppResources.ConnectionsPageTitle, userDialogs, navigationService)
 {
     _connectionService    = connectionService;
     _agentContextProvider = agentContextProvider;
     _eventAggregator      = eventAggregator;
     _proofService         = proofService;
     _recordService        = recordService;
     _scope = scope;
 }
Ejemplo n.º 22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TransactionService"/> class.
 /// </summary>
 /// <param name="recordService">The record service.</param>
 /// <param name="provisioningService">The provisioning service.</param>
 /// <param name="messageService">The message service.</param>
 /// <param name="connectionService">The connection service.</param>
 /// <param name="credentialService">The credential service.</param>
 /// <param name="proofService">The proof service.</param>
 /// <param name="logger">The logger.</param>
 public TransactionService(
     IWalletRecordService recordService,
     IProvisioningService provisioningService,
     IMessageService messageService,
     IConnectionService connectionService,
     ICredentialService credentialService,
     IProofService proofService,
     ILogger <TransactionService> logger)
 {
     ProvisioningService = provisioningService;
     MessageService      = messageService;
     ConnectionService   = connectionService;
     CredentialService   = credentialService;
     ProofService        = proofService;
     Logger        = logger;
     RecordService = recordService;
 }
Ejemplo n.º 23
0
 public NotificationViewModel(IUserDialogs userDialogs,
                              INavigationService navigationService,
                              IAgentProvider agentProvider,
                              ICredentialService credentialService,
                              IConnectionService connectionService,
                              IMessageService messageService,
                              CloudWalletService cloudWalletService,
                              IProofService proofService,
                              ILifetimeScope scope,
                              IEventAggregator eventAggregator) : base(nameof(NotificationViewModel), userDialogs, navigationService)
 {
     _agentProvider      = agentProvider;
     _credentialService  = credentialService;
     _proofService       = proofService;
     _connectionService  = connectionService;
     _cloudWalletService = cloudWalletService;
     _scope           = scope;
     _eventAggregator = eventAggregator;
     Title            = "Notification";
 }
Ejemplo n.º 24
0
        public static async Task <(ProofRecord holderProofRecord, ProofRecord requestorProofRecord)> ProposerInitiatedProofProtocolAsync(
            IProofService proofService,
            IProducerConsumerCollection <AgentMessage> messages,
            ConnectionRecord holderConnection, ConnectionRecord requestorConnection,
            IAgentContext holderContext, IAgentContext requestorContext,
            ProofProposal proofProposalObject)
        {
            // Holder sends a proof proposal
            var(holderProposalMessage, holderProofProposalRecord) = await proofService.CreateProposalAsync(holderContext, proofProposalObject, holderConnection.Id);

            messages.TryAdd(holderProposalMessage);
            Assert.True(holderProofProposalRecord.State == ProofState.Proposed);
            // Requestor accepts the proposal and builds a proofRequest
            var requestorProposalMessage = FindContentMessage <ProposePresentationMessage>(messages);

            Assert.NotNull(requestorProposalMessage);

            //Requestor stores the proof proposal
            var requestorProofProposalRecord = await proofService.ProcessProposalAsync(requestorContext, requestorProposalMessage, requestorConnection);

            Assert.Equal(ProofState.Proposed, requestorProofProposalRecord.State);
            var proposal = requestorProofProposalRecord.ProposalJson.ToObject <ProofProposal>();

            Assert.Equal("Hello, World", proposal.Comment);
            Assert.NotNull(proposal.ProposedAttributes);
            Console.WriteLine(requestorProofProposalRecord.ProposalJson);
            // Requestor sends a proof request
            var(requestorRequestMessage, requestorProofRequestRecord) = await proofService.CreateRequestFromProposalAsync(
                requestorContext,
                new ProofRequestParameters
            {
                Name    = "Test",
                Version = "1.0"
            },
                requestorProofProposalRecord.Id, requestorConnection.Id);

            messages.TryAdd(requestorRequestMessage);
            Assert.Equal(ProofState.Requested, requestorProofRequestRecord.State);

            return(await ProofProtocolAsync(proofService, messages, holderConnection, requestorConnection, holderContext, requestorContext, requestorProofRequestRecord));
        }
Ejemplo n.º 25
0
        public ProofRequestViewModel(IUserDialogs userDialogs,
                                     INavigationService navigationService,
                                     IProofService proofService,
                                     IAgentProvider agentProvider,
                                     IMessageService messageService,
                                     IEventAggregator eventAggregator,
                                     IConnectionService connectionService, ProofRecord proofRequestRecord) : base(nameof(ProofRequestViewModel), userDialogs, navigationService)
        {
            Title               = "Proof Request";
            _proofService       = proofService;
            _agentProvider      = agentProvider;
            _messageService     = messageService;
            _connectionService  = connectionService;
            _proofRequestRecord = proofRequestRecord;
            _eventAggregator    = eventAggregator;
            _proofRequest       = _proofRequestRecord.RequestJson.ToObject <ProofRequest>();

            if (_proofRequestRecord.CreatedAtUtc != null)
            {
                IssuedDate = (DateTime)_proofRequestRecord.CreatedAtUtc;
            }
        }
Ejemplo n.º 26
0
        public NodeSync(SyncSettings settings)
        {
            _settings     = settings;
            _proofService = _settings.Provider.GetService <IProofService>();

            var network = settings.Network ?? Network.Main;

            _logger = settings.Logger;
            _appDir = settings.AppDir;
            _wallet = new SyncWallet(settings.Wallet, network);
            //var parameters = new NodeConnectionParameters();
            //parameters.TemplateBehaviors.Add(new AddressManagerBehavior(GetAddressManager()));
            //_group = new NodesGroup(_settings.Network, parameters, new NodeRequirement()
            //{
            //    RequiredServices = NodeServices.Network
            //});
            //_group.MaximumNodeConnection = 4;
            //_logger.Information("Connecting to nodes ");
            //_group.Connect();

            _logger.Information("Initiated node sync");
        }
Ejemplo n.º 27
0
        public ProofTests()
        {
            var recordService = new DefaultWalletRecordService();
            var ledgerService = new DefaultLedgerService();

            _eventAggregator = new EventAggregator();

            var provisioning = ServiceUtils.GetDefaultMockProvisioningService();

            var tailsService = new DefaultTailsService(ledgerService, new HttpClientHandler());

            _schemaService = new DefaultSchemaService(provisioning, recordService, ledgerService, tailsService);

            _connectionService = new DefaultConnectionService(
                _eventAggregator,
                recordService,
                provisioning,
                new Mock <ILogger <DefaultConnectionService> >().Object);

            _credentialService = new DefaultCredentialService(
                _eventAggregator,
                ledgerService,
                _connectionService,
                recordService,
                _schemaService,
                tailsService,
                provisioning,
                new Mock <ILogger <DefaultCredentialService> >().Object);

            _proofService = new DefaultProofService(
                _eventAggregator,
                _connectionService,
                recordService,
                provisioning,
                ledgerService,
                tailsService,
                new Mock <ILogger <DefaultProofService> >().Object);
        }
Ejemplo n.º 28
0
        public PresentProofController(

            IProofService proofService,
            IWalletRecordService recordService,
            IEventAggregator eventAggregator,
            IProvisioningService provisionService,
            IConnectionService connectionService,
            IAgentProvider agentContextProvider,
            IMessageService messageService,
            IMemoryCache memoryCache,
            ILogger <PresentProofController> logger

            )
        {
            _proofService         = proofService;
            _recordService        = recordService;
            _eventAggregator      = eventAggregator;
            _provisionService     = provisionService;
            _connectionService    = connectionService;
            _agentContextProvider = agentContextProvider;
            _messageService       = messageService;
            _proofCache           = memoryCache;
            _logger = logger;
        }
Ejemplo n.º 29
0
 /// <summary>Retrieves a list of accepted proof records.</summary>
 /// <param name="proofService">The proof service.</param>
 /// <param name="context">The context.</param>
 /// <param name="count">The count.</param>
 /// <returns></returns>
 public static Task <List <ProofRecord> > ListAcceptedAsync(this IProofService proofService,
                                                            IAgentContext context, int count = 100)
 => proofService.ListAsync(context,
                           SearchQuery.Equal(nameof(ProofRecord.State), ProofState.Accepted.ToString("G")), count);
Ejemplo n.º 30
0
 public DefaultProofHandler(IProofService proofService)
 {
     _proofService = proofService;
 }