Skip to content

Commit 113afad

Browse files
committed
revert tx data linking behaviour (only take one)
Signed-off-by: Johannes Tuerk <johannes.tuerk@lissi.id>
1 parent 5f6c934 commit 113afad

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/WalletFramework.Oid4Vc/Oid4Vp/TransactionDatas/TransactionDataFun.cs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using LanguageExt;
22
using WalletFramework.Core.Base64Url;
33
using WalletFramework.Core.Functional;
4-
using WalletFramework.Core.Functional.Enumerable;
54
using WalletFramework.Oid4Vc.Oid4Vp.Errors;
65
using WalletFramework.Oid4Vc.Oid4Vp.Models;
76
using WalletFramework.Oid4Vc.Oid4Vp.TransactionDatas.Errors;
@@ -123,24 +122,21 @@ internal static Validation<AuthorizationRequestCancellation, PresentationRequest
123122

124123
foreach (var txData in transactionDatas)
125124
{
126-
var findings = indexedCandidates.Where(tuple =>
125+
var found = indexedCandidates.FirstOrDefault(tuple =>
127126
{
128127
return new[] { tuple.candidate }.FindCandidateForTransactionData(txData).IsSuccess;
129-
}).ToList();
128+
});
130129

131-
if (findings.IsEmpty())
130+
if (found == default)
132131
{
133132
return new InvalidTransactionDataError(
134133
$"No credentials found that satisfy the transaction data with type {txData.GetTransactionDataType().AsString()}",
135134
presentationRequest).ToInvalid<PresentationRequest>();
136135
}
137136

138137
// Update the candidate with the transaction data
139-
foreach (var found in findings)
140-
{
141-
var updated = found.candidate.AddTransactionDatas([txData]);
142-
updatedCandidates[(found.setIdx, found.candIdx)] = updated;
143-
}
138+
var updated = found.candidate.AddTransactionDatas([txData]);
139+
updatedCandidates[(found.setIdx, found.candIdx)] = updated;
144140
}
145141

146142
// Reconstruct sets with updated candidates

0 commit comments

Comments
 (0)