Exemple #1
0
        protected async Task FormSubmit()
        {
            try{
                credentialContract = await AgencyServiceClient.CreateCredentialAsync(new CredentialOfferParameters {
                    DefinitionId      = "QfuwopKZiKRhJaRY3YadPu:3:CL:15913:default",
                    AutomaticIssuance = true,
                    CredentialValues  = new Dictionary <string, string> {
                        { "virus", credentialModel.virus },
                        { "checktime", credentialModel.checktime },
                        { "checkedlocation", credentialModel.checkedlocation },
                        { "checkedby", credentialModel.checkedby },
                        { "checkedfacility", credentialModel.checkedfacility },
                        { "diagnosismethod", credentialModel.diagnosismethod },
                        { "issued", credentialModel.issued },
                        { "expiry", credentialModel.expiry }
                    }
                });

                FormReady = false;
            }catch (System.Exception e)
            {
                var err = e;
            }
            if (FormReady)
            {
            }
            StateHasChanged();
        }
        protected async override Task OnInitializedAsync()
        {
            var options = new ServiceClientOptions();

            options.AccessToken     = "Us8PhNscIfESqf-GsNTUk0fqirRivRRBDZ4aavvv8Ao";
            options.AgencyBaseUri   = "https://api.streetcred.id/agency/v1";
            options.SubscriptionKey = "ebacdad1a9a140bb9af6321cdedddb5e";
            AgencyServiceClient     = new AgencyServiceClient(
                baseUri: new Uri("https://api.streetcred.id/agency/v1"),
                credentials: new StreetcredClientCredentials(Options.Create(options)));
            Ready = true;
        }
Exemple #3
0
 /// <summary>
 /// Adds the required services for access to Streetcred's API's including Agency and Custodian services.
 /// </summary>
 /// <param name="services">The services.</param>
 /// <param name="configure">The configure.</param>
 /// <returns></returns>
 public static IServiceCollection AddStreetcredClient(this IServiceCollection services, Action <ServiceClientOptions> configure)
 {
     services.Configure(configure);
     services.AddSingleton <StreetcredClientCredentials>();
     services.AddSingleton <IAgencyServiceClient, AgencyServiceClient>(provider =>
     {
         var options          = provider.GetRequiredService <IOptions <ServiceClientOptions> >().Value;
         var agencyClient     = new AgencyServiceClient(provider.GetRequiredService <StreetcredClientCredentials>());
         agencyClient.BaseUri = options.AgencyBaseUri == null ? agencyClient.BaseUri : new Uri(options.AgencyBaseUri);
         return(agencyClient);
     });
     services.AddSingleton <ICustodianServiceClient, CustodianServiceClient>(provider =>
     {
         var options             = provider.GetRequiredService <IOptions <ServiceClientOptions> >().Value;
         var custodianClient     = new CustodianServiceClient(provider.GetRequiredService <StreetcredClientCredentials>());
         custodianClient.BaseUri = options.CustodianBaseUri == null ? custodianClient.BaseUri : new Uri(options.CustodianBaseUri);
         return(custodianClient);
     });
     return(services);
 }
Exemple #4
0
        protected async override Task OnInitializedAsync()
        {
            try{
                // Get a QR for the verification
                verificationRequest = await AgencyServiceClient.CreateVerificationFromPolicyAsync("ab6adaa7-4d2d-4b6d-5a09-08d7e7b71754");

                StateHasChanged();
                verificationResponse = await Polly.Policy.HandleResult <VerificationContract>(r => r.IsValid != true)
                                       .WaitAndRetryAsync(100, _ => TimeSpan.FromSeconds(4))
                                       .ExecuteAsync(async() => await AgencyServiceClient.GetVerificationAsync(verificationRequest.VerificationId));

                if (verificationResponse.IsValid == true)
                {
                    FormReady           = true;
                    verificationRequest = null;
                    StateHasChanged();
                }
            }
            catch (Exception e) {
                var err = e;
            }
        }