Skip to content

Commit c809215

Browse files
JoTiTuDindexx
andauthored
Align IssuerMetadata with VCI 1.0 spec (#438)
* support credential_metadata in issuer metadata and drop AttributeOrder support Signed-off-by: Johannes Tuerk <johannes.tuerk@lissi.id> * clean attribute order Signed-off-by: Johannes Tuerk <johannes.tuerk@lissi.id> * Merge branch 'v3.0.0' of github.com:openwallet-foundation-labs/wallet-framework-dotnet into algin-isser-metadata-with-oid4vci1.0 Signed-off-by: Johannes Tuerk <johannes.tuerk@lissi.id> * Add CredentialsSet id as index to SdJwt and MDoc records Signed-off-by: Johannes Tuerk <johannes.tuerk@lissi.id> * Fix the issuance for the PID (associate SdJwt AND MDocs with PID) Signed-off-by: Johannes Tuerk <johannes.tuerk@lissi.id> * implement requested changes Signed-off-by: Johannes Tuerk <johannes.tuerk@lissi.id> * minimal cleanup Signed-off-by: Kevin <kevin.dinh@lissi.id> * Revert Vctmetadata ClaimDisplay removal Signed-off-by: Johannes Tuerk <johannes.tuerk@lissi.id> --------- Signed-off-by: Johannes Tuerk <johannes.tuerk@lissi.id> Signed-off-by: Kevin <kevin.dinh@lissi.id> Co-authored-by: Kevin <kevin.dinh@lissi.id>
1 parent 52aea5a commit c809215

File tree

49 files changed

+515
-1233
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+515
-1233
lines changed

src/WalletFramework.Core/ClaimPaths/ClaimPath.cs

Lines changed: 51 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
using System.Text;
2+
using LanguageExt;
13
using WalletFramework.Core.ClaimPaths.Errors;
24
using WalletFramework.Core.Functional;
35
using WalletFramework.Core.Path;
@@ -31,18 +33,61 @@ from components in array.TraverseAll(ClaimPathComponent.Create)
3133
from path in FromComponents(components)
3234
select path;
3335
}
36+
37+
public static JArray ToJArray(ClaimPath claimPath)
38+
{
39+
var array = new JArray();
40+
foreach (var component in claimPath.GetPathComponents())
41+
{
42+
component.Match(
43+
key =>
44+
{
45+
array.Add(new JValue(key));
46+
return Unit.Default;
47+
},
48+
index =>
49+
{
50+
array.Add(new JValue(index));
51+
return Unit.Default;
52+
},
53+
_ =>
54+
{
55+
array.Add(JValue.CreateNull());
56+
return Unit.Default;
57+
}
58+
);
59+
}
60+
return array;
61+
}
3462
}
3563

3664
public static class ClaimPathFun
3765
{
3866
public static JsonPath ToJsonPath(this ClaimPath claimPath)
3967
{
40-
var jsonPath = "$." + string.Join('.', claimPath.GetPathComponents().Select(x =>
68+
var jsonPath = new StringBuilder();
69+
jsonPath.Append('$');
70+
71+
foreach (var component in claimPath.GetPathComponents())
4172
{
42-
if (x.IsKey) return x.AsKey();
43-
if (x.IsIndex) return x.AsIndex()?.ToString();
44-
return null;
45-
}).Where(x => x is not null));
46-
return JsonPath.ValidJsonPath(jsonPath).UnwrapOrThrow();
73+
component.Match(
74+
key =>
75+
{
76+
jsonPath.Append($".{key}");
77+
return Unit.Default;
78+
},
79+
integer =>
80+
{
81+
jsonPath.Append($"[{integer}]");
82+
return Unit.Default;
83+
},
84+
_ =>
85+
{
86+
jsonPath.Append("[*]");
87+
return Unit.Default;
88+
});
89+
}
90+
91+
return JsonPath.ValidJsonPath(jsonPath.ToString()).UnwrapOrThrow();
4792
}
4893
}

src/WalletFramework.Core/Credentials/CredentialSetId.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ private CredentialSetId(string value)
1313
}
1414

1515
public string AsString() => Value;
16+
17+
public Guid AsGuid() => Guid.Parse(Value);
1618

1719
public override string ToString() => Value;
1820

src/WalletFramework.MdocVc/ClaimDisplay.cs

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/WalletFramework.MdocVc/Display/MdocDisplay.cs

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/WalletFramework.MdocVc/Display/MdocLogo.cs

Lines changed: 0 additions & 17 deletions
This file was deleted.

src/WalletFramework.MdocVc/Display/MdocName.cs

Lines changed: 0 additions & 22 deletions
This file was deleted.

src/WalletFramework.MdocVc/Display/Serialization/MdocDisplaySerializationConstants.cs

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/WalletFramework.MdocVc/Display/Serialization/MdocDisplaySerializer.cs

Lines changed: 0 additions & 179 deletions
This file was deleted.

src/WalletFramework.MdocVc/MdocCredential.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,13 @@
33
using WalletFramework.Core.Credentials.Abstractions;
44
using WalletFramework.Core.Cryptography.Models;
55
using WalletFramework.MdocLib;
6-
using WalletFramework.MdocVc.Display;
76

87
namespace WalletFramework.MdocVc;
98

109
public record MdocCredential(
1110
Mdoc Mdoc,
1211
CredentialId CredentialId,
1312
CredentialSetId CredentialSetId,
14-
Option<List<MdocDisplay>> Displays,
1513
KeyId KeyId,
1614
CredentialState CredentialState,
1715
bool OneTimeUse,

src/WalletFramework.MdocVc/MdocCredentialExtensions.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,21 @@
33
using WalletFramework.Core.Credentials;
44
using WalletFramework.Core.Cryptography.Models;
55
using WalletFramework.MdocLib;
6-
using WalletFramework.MdocVc.Display;
76

87
namespace WalletFramework.MdocVc;
98

109
public static class MdocCredentialExtensions
1110
{
1211
public static MdocCredential ToMdocCredential(
1312
this Mdoc mdoc,
14-
Option<List<MdocDisplay>> displays,
1513
KeyId keyId,
1614
CredentialSetId credentialSetId,
1715
CredentialState credentialState,
1816
bool oneTimeUse,
1917
Option<DateTime> expiresAt,
2018
CredentialId credentialId)
2119
{
22-
return new MdocCredential(mdoc, credentialId, credentialSetId, displays, keyId, credentialState, oneTimeUse, expiresAt);
20+
return new MdocCredential(mdoc, credentialId, credentialSetId, keyId, credentialState, oneTimeUse, expiresAt);
2321
}
2422

2523
public static string ToJsonString(this MdocCredential mdocCredential)

0 commit comments

Comments
 (0)