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();
        }
Exemple #2
0
        public async Task <string> GetDriverLicenseCredential(string username)
        {
            if (!await _driverLicenseService.HasIdentityDriverLicense(username))
            {
                throw new ArgumentException("user has no valid driver license");
            }

            var driverLicense = await _driverLicenseService.GetDriverLicense(username);

            if (!string.IsNullOrEmpty(driverLicense.DriverLicenseCredentials))
            {
                return(driverLicense.DriverLicenseCredentials);
            }

            string connectionId      = null; // Can be null | <connection identifier>
            bool   automaticIssuance = false;
            IDictionary <string, string> credentialValues = new Dictionary <String, String>()
            {
                { "Issued At", driverLicense.IssuedAt.ToString() },
                { "Name", driverLicense.Name },
                { "First Name", driverLicense.FirstName },
                { "Date of Birth", driverLicense.DateOfBirth.Date.ToString() },
                { "License Type", driverLicense.LicenseType }
            };

            CredentialContract credential = await _credentialServiceClient
                                            .CreateCredentialAsync(new CredentialOfferParameters
            {
                DefinitionId      = _configuration["Trinsic:CredentialTemplateDefinitionId"],
                ConnectionId      = connectionId,
                AutomaticIssuance = automaticIssuance,
                CredentialValues  = credentialValues
            });

            driverLicense.DriverLicenseCredentials = credential.OfferUrl;
            await _driverLicenseService.UpdateDriverLicense(driverLicense);

            return(credential.OfferUrl);
        }