Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/WalletFramework.Oid4Vc/Oid4Vp/Models/WalletMetadata.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace WalletFramework.Oid4Vc.Oid4Vp.Models;
Expand Down Expand Up @@ -47,11 +48,11 @@ public static WalletMetadata CreateDefault()

public string ToJsonString()
{
return new JObject
return JsonConvert.SerializeObject(new JObject
{
[VpFormatsSupportedIdentifier] = JObject.FromObject(VpFormatsSupported),
[ClientIdPrefixesSupportedIdentifier] = new JArray {ClientIdPrefixesSupported.Select(x => x.AsString())},
[ClientIdSchemesSupportedIdentifier] = new JArray {ClientIdPrefixesSupported.Select(x => x.AsString())},
}.ToString();
});
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using LanguageExt;
using WalletFramework.Core.Base64Url;
using WalletFramework.Core.Functional;
using WalletFramework.Core.Functional.Enumerable;
using WalletFramework.Oid4Vc.Oid4Vp.Errors;
using WalletFramework.Oid4Vc.Oid4Vp.Models;
using WalletFramework.Oid4Vc.Oid4Vp.TransactionDatas.Errors;
Expand Down Expand Up @@ -123,24 +122,21 @@ internal static Validation<AuthorizationRequestCancellation, PresentationRequest

foreach (var txData in transactionDatas)
{
var findings = indexedCandidates.Where(tuple =>
var found = indexedCandidates.FirstOrDefault(tuple =>
{
return new[] { tuple.candidate }.FindCandidateForTransactionData(txData).IsSuccess;
}).ToList();
});

if (findings.IsEmpty())
if (found == default)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

null instead of default

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not viable because its a tuple

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does default mean then ?

{
return new InvalidTransactionDataError(
$"No credentials found that satisfy the transaction data with type {txData.GetTransactionDataType().AsString()}",
presentationRequest).ToInvalid<PresentationRequest>();
}

// Update the candidate with the transaction data
foreach (var found in findings)
{
var updated = found.candidate.AddTransactionDatas([txData]);
updatedCandidates[(found.setIdx, found.candIdx)] = updated;
}
var updated = found.candidate.AddTransactionDatas([txData]);
updatedCandidates[(found.setIdx, found.candIdx)] = updated;
}

// Reconstruct sets with updated candidates
Expand Down
Loading