/// <summary> /// Reference https://github.com/hyperledger/aries-framework-dotnet/blob/master/test/Hyperledger.Aries.Tests/Protocols/ProofTests.cs#L644 /// </summary> public async Task GetRequestedAttributes() { try { RequestedAttributes.Clear(); if (ProofRequest.RequestedAttributes == null) { return; } var context = await agentContextProvider.GetContextAsync(); //Get any Available Credentials for each requested attribute foreach (var requestedAttribute in ProofRequest.RequestedAttributes) { List <Credential> attributeCredentials = await proofService.ListCredentialsForProofRequestAsync(context, ProofRequest, requestedAttribute.Key); var attribute = scope.Resolve <ProofRequestAttributeViewModel>( new NamedParameter("name", requestedAttribute.Value.Name ?? string.Join(", ", requestedAttribute.Value.Names)), new NamedParameter("isPredicate", false), new NamedParameter("attributeCredentials", attributeCredentials), new NamedParameter("referent", requestedAttribute.Key) ); RequestedAttributes.Add(attribute); } //TODO: Implement Predicate and Restrictions related functionlity } catch (Exception xx) { } }
private AuthenticationResults PrepareAuthenticationResultsResponse() { RequestedAttributes attributes1 = new RequestedAttributes(CommonTestData.BASIC_USER_INFO, CommonTestData.CUSTOM_IDENTIFIER, CommonTestData.SSN_USER_INFO, null, CommonTestData.DATE_OF_BIRTH, CommonTestData.RELYING_PARTY_USER_ID, CommonTestData.EMAIL, CommonTestData.ORGANISATION_ID); AuthenticationResult firstResponse = new AuthenticationResult(CommonTestData.REFERENCE, TransactionStatus.STARTED, CommonTestData.DETAILS, attributes1); RequestedAttributes attributes2 = new RequestedAttributes(null, CommonTestData.CUSTOM_IDENTIFIER, null, null, null, null, null, null); AuthenticationResult secondResponse = new AuthenticationResult(CommonTestData.REFERENCE, TransactionStatus.DELIVERED_TO_MOBILE, CommonTestData.DETAILS, attributes2); List <AuthenticationResult> responses = new List <AuthenticationResult> { firstResponse, secondResponse }; return(new AuthenticationResults(responses)); }
/// <summary> /// Reference https://github.com/hyperledger/aries-framework-dotnet/blob/master/src/Hyperledger.Aries.TestHarness/AgentScenarios.cs#L214 /// </summary> private async Task CreatePresentation() { base.IsBusy = true; var dialog = UserDialogs.Instance.Loading("Presenting Proof..."); try { var requestedCredentials = new RequestedCredentials(); var requestedAttributes = RequestedAttributes.Where(x => x.SelectedCredential != null && !x.IsPredicate) .Select(y => new KeyValuePair <string, RequestedAttribute>(y.AttributeReferent, new RequestedAttribute { CredentialId = y.SelectedCredential.Credential.CredentialInfo.Referent, Revealed = true }) ).ToDictionary(z => z.Key, z => z.Value); //TODO: Implement Predicate related functionlity if (requestedAttributes != null && requestedAttributes.Count > 0) { requestedCredentials.RequestedAttributes = requestedAttributes; var context = await agentContextProvider.GetContextAsync(); if (requestPresentationMessage != null) { var result = await proofService.CreatePresentationAsync(context, requestPresentationMessage, requestedCredentials); } else { var(proofMsg, holderRecord) = await proofService.CreatePresentationAsync(context, proofRecord.Id, requestedCredentials); await messageService.SendAsync(context, proofMsg, connection); } } eventAggregator.Publish(new ApplicationEvent() { Type = ApplicationEventType.RefreshProofRequests }); await NavigationService.NavigateBackAsync(); } catch (Exception exception) { await Application.Current.MainPage.DisplayAlert("Error", exception.Message, "Ok"); } finally { base.IsBusy = false; dialog?.Hide(); dialog?.Dispose(); } }
public override string ToString() { var sb = new StringBuilder(); sb.Append("SELECT "); sb.Append(string.Join(",", RequestedAttributes.Select(r => r.ToString()))); sb.Append(" FROM "); sb.Append(string.Join(",", Source.ToString())); if (!(WhereClause is NullWhereClause)) { sb.Append(" WHERE "); sb.Append(WhereClause); } //sb.AppendLine(";"); return(sb.ToString()); }
public AuthenticationResult(string authRef, TransactionStatus status, string details, RequestedAttributes requestedAttributes) { this.AuthRef = authRef; this.Status = status; this.Details = details; this.RequestedAttributes = requestedAttributes; }