Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Issuer Id to CredentialSetRecord for mDoc #245

Merged
merged 2 commits into from
Jan 6, 2025
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
using WalletFramework.Core.Credentials;
using WalletFramework.Core.Functional;
using WalletFramework.Core.Json;
using WalletFramework.Core.String;
using WalletFramework.MdocLib;
using WalletFramework.MdocVc;
using WalletFramework.Oid4Vc.Oid4Vci.Issuer.Models;
using WalletFramework.SdJwtVc.Models;
using WalletFramework.SdJwtVc.Models.Records;
using WalletFramework.SdJwtVc.Models.StatusList;
Expand Down Expand Up @@ -139,7 +141,8 @@ public static void AddSdJwtData(

public static void AddMDocData(
this CredentialSetRecord credentialSetRecord,
MdocRecord mdocRecord)
MdocRecord mdocRecord,
CredentialIssuerId credentialIssuerId)
{
credentialSetRecord.MDocCredentialType = mdocRecord.DocType;
credentialSetRecord.State = mdocRecord.CredentialState;
Expand All @@ -151,7 +154,9 @@ public static void AddMDocData(

if (credentialSetRecord.ExpiresAt.IsNone)
credentialSetRecord.ExpiresAt = mdocRecord.ExpiresAt.ToOption();
//TODO: Add issuerId

if (credentialSetRecord.IssuerId.IsNullOrEmpty())
credentialSetRecord.IssuerId = credentialIssuerId.ToString();
}

public static CredentialSetId GetCredentialSetId(this CredentialSetRecord credentialSetRecord) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ await credential.Value.Match(
credentialSet.GetCredentialSetId(), creds.Count > 1);
await _mdocStorage.Add(record);

credentialSet.AddMDocData(record);
credentialSet.AddMDocData(record, issuerMetadata.CredentialIssuer);
});
}
},
Expand Down Expand Up @@ -415,7 +415,7 @@ await credential.Value.Match(
credentialSet.GetCredentialSetId(), creds.Count > 1);
await _mdocStorage.Add(record);

credentialSet.AddMDocData(record);
credentialSet.AddMDocData(record, session.AuthorizationData.IssuerMetadata.CredentialIssuer);
});
}
},
Expand Down Expand Up @@ -534,7 +534,7 @@ select credentialsOrTransactionId.Match<OneOf<List<ICredential>, TransactionId>>
var record = mdoc.Decoded.ToRecord(displays, response.KeyId,
credentialSetRecord.GetCredentialSetId(), creds.Count > 1);

credentialSetRecord.AddMDocData(record);
credentialSetRecord.AddMDocData(record, session.AuthorizationData.IssuerMetadata.CredentialIssuer);

token = token.Match<OneOf<OAuthToken, DPopToken>>(
oAuth =>
Expand Down
Loading