Skip to content
Merged
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
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
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 @@ -122,21 +123,24 @@ internal static Validation<AuthorizationRequestCancellation, PresentationRequest

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

if (found == default)
if (findings.IsEmpty())
{
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
var updated = found.candidate.AddTransactionDatas([txData]);
updatedCandidates[(found.setIdx, found.candIdx)] = updated;
foreach (var found in findings)
{
var updated = found.candidate.AddTransactionDatas([txData]);
updatedCandidates[(found.setIdx, found.candIdx)] = updated;
}
}

// Reconstruct sets with updated candidates
Expand Down
Loading