@owf/eudi-sca 0.0.0 → 0.2.0-alpha-20260422114341
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/dist/index.d.mts +96 -75
- package/dist/index.mjs +328 -26
- package/dist/index.mjs.map +1 -1
- package/package.json +14 -17
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/dist/index.d.mts
CHANGED
|
@@ -1,80 +1,80 @@
|
|
|
1
1
|
import { CredentialIssuerMetadata } from "@openid4vc/openid4vci";
|
|
2
|
-
import z from "zod";
|
|
2
|
+
import z$1 from "zod";
|
|
3
3
|
|
|
4
4
|
//#region src/crypto.d.ts
|
|
5
5
|
type JwtSignatureVerifier = (x5c: Array<string>, toBeVerified: string, signature: Uint8Array) => Promise<void>;
|
|
6
6
|
//#endregion
|
|
7
7
|
//#region src/issuerMetadata.d.ts
|
|
8
|
-
declare const zCredentialIssuerMetadataWithMetadataUri: z.ZodObject<{
|
|
9
|
-
credential_issuer: z.ZodURL;
|
|
10
|
-
authorization_servers: z.ZodOptional<z.ZodArray<z.ZodURL>>;
|
|
11
|
-
credential_endpoint: z.ZodURL;
|
|
12
|
-
deferred_credential_endpoint: z.ZodOptional<z.ZodURL>;
|
|
13
|
-
notification_endpoint: z.ZodOptional<z.ZodURL>;
|
|
14
|
-
nonce_endpoint: z.ZodOptional<z.ZodURL>;
|
|
15
|
-
credential_response_encryption: z.ZodOptional<z.ZodObject<{
|
|
16
|
-
alg_values_supported: z.ZodArray<z.ZodString>;
|
|
17
|
-
enc_values_supported: z.ZodArray<z.ZodString>;
|
|
18
|
-
encryption_required: z.ZodBoolean;
|
|
19
|
-
}, z.core.$loose>>;
|
|
20
|
-
batch_credential_issuance: z.ZodOptional<z.ZodObject<{
|
|
21
|
-
batch_size: z.ZodNumber;
|
|
22
|
-
}, z.core.$loose>>;
|
|
23
|
-
display: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
24
|
-
name: z.ZodOptional<z.ZodString>;
|
|
25
|
-
locale: z.ZodOptional<z.ZodString>;
|
|
26
|
-
logo: z.ZodOptional<z.ZodObject<{
|
|
27
|
-
uri: z.ZodOptional<z.ZodUnion<[z.ZodURL, z.ZodString]>>;
|
|
28
|
-
alt_text: z.ZodOptional<z.ZodString>;
|
|
29
|
-
}, z.core.$loose>>;
|
|
30
|
-
}, z.core.$loose>>>;
|
|
31
|
-
credential_configurations_supported: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
32
|
-
format: z.ZodString;
|
|
33
|
-
scope: z.ZodOptional<z.ZodString>;
|
|
34
|
-
cryptographic_binding_methods_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
35
|
-
credential_signing_alg_values_supported: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString>, z.ZodArray<z.ZodNumber>]>>;
|
|
36
|
-
proof_types_supported: z.ZodOptional<z.ZodRecord<z.ZodUnion<readonly [z.ZodLiteral<"jwt">, z.ZodLiteral<"attestation">, z.ZodString]>, z.ZodObject<{
|
|
37
|
-
proof_signing_alg_values_supported: z.ZodArray<z.ZodString>;
|
|
38
|
-
key_attestations_required: z.ZodOptional<z.ZodObject<{
|
|
39
|
-
key_storage: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodEnum<{
|
|
8
|
+
declare const zCredentialIssuerMetadataWithMetadataUri: z$1.ZodObject<{
|
|
9
|
+
credential_issuer: z$1.ZodURL;
|
|
10
|
+
authorization_servers: z$1.ZodOptional<z$1.ZodArray<z$1.ZodURL>>;
|
|
11
|
+
credential_endpoint: z$1.ZodURL;
|
|
12
|
+
deferred_credential_endpoint: z$1.ZodOptional<z$1.ZodURL>;
|
|
13
|
+
notification_endpoint: z$1.ZodOptional<z$1.ZodURL>;
|
|
14
|
+
nonce_endpoint: z$1.ZodOptional<z$1.ZodURL>;
|
|
15
|
+
credential_response_encryption: z$1.ZodOptional<z$1.ZodObject<{
|
|
16
|
+
alg_values_supported: z$1.ZodArray<z$1.ZodString>;
|
|
17
|
+
enc_values_supported: z$1.ZodArray<z$1.ZodString>;
|
|
18
|
+
encryption_required: z$1.ZodBoolean;
|
|
19
|
+
}, z$1.core.$loose>>;
|
|
20
|
+
batch_credential_issuance: z$1.ZodOptional<z$1.ZodObject<{
|
|
21
|
+
batch_size: z$1.ZodNumber;
|
|
22
|
+
}, z$1.core.$loose>>;
|
|
23
|
+
display: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
|
|
24
|
+
name: z$1.ZodOptional<z$1.ZodString>;
|
|
25
|
+
locale: z$1.ZodOptional<z$1.ZodString>;
|
|
26
|
+
logo: z$1.ZodOptional<z$1.ZodObject<{
|
|
27
|
+
uri: z$1.ZodOptional<z$1.ZodUnion<[z$1.ZodURL, z$1.ZodString]>>;
|
|
28
|
+
alt_text: z$1.ZodOptional<z$1.ZodString>;
|
|
29
|
+
}, z$1.core.$loose>>;
|
|
30
|
+
}, z$1.core.$loose>>>;
|
|
31
|
+
credential_configurations_supported: z$1.ZodRecord<z$1.ZodString, z$1.ZodObject<{
|
|
32
|
+
format: z$1.ZodString;
|
|
33
|
+
scope: z$1.ZodOptional<z$1.ZodString>;
|
|
34
|
+
cryptographic_binding_methods_supported: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString>>;
|
|
35
|
+
credential_signing_alg_values_supported: z$1.ZodOptional<z$1.ZodUnion<[z$1.ZodArray<z$1.ZodString>, z$1.ZodArray<z$1.ZodNumber>]>>;
|
|
36
|
+
proof_types_supported: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodUnion<readonly [z$1.ZodLiteral<"jwt">, z$1.ZodLiteral<"attestation">, z$1.ZodString]>, z$1.ZodObject<{
|
|
37
|
+
proof_signing_alg_values_supported: z$1.ZodArray<z$1.ZodString>;
|
|
38
|
+
key_attestations_required: z$1.ZodOptional<z$1.ZodObject<{
|
|
39
|
+
key_storage: z$1.ZodOptional<z$1.ZodArray<z$1.ZodUnion<readonly [z$1.ZodEnum<{
|
|
40
40
|
iso_18045_high: "iso_18045_high";
|
|
41
41
|
iso_18045_moderate: "iso_18045_moderate";
|
|
42
42
|
"iso_18045_enhanced-basic": "iso_18045_enhanced-basic";
|
|
43
43
|
iso_18045_basic: "iso_18045_basic";
|
|
44
|
-
}>, z.ZodString]>>>;
|
|
45
|
-
user_authentication: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodEnum<{
|
|
44
|
+
}>, z$1.ZodString]>>>;
|
|
45
|
+
user_authentication: z$1.ZodOptional<z$1.ZodArray<z$1.ZodUnion<readonly [z$1.ZodEnum<{
|
|
46
46
|
iso_18045_high: "iso_18045_high";
|
|
47
47
|
iso_18045_moderate: "iso_18045_moderate";
|
|
48
48
|
"iso_18045_enhanced-basic": "iso_18045_enhanced-basic";
|
|
49
49
|
iso_18045_basic: "iso_18045_basic";
|
|
50
|
-
}>, z.ZodString]>>>;
|
|
51
|
-
}, z.core.$loose>>;
|
|
52
|
-
}, z.core.$strip>>>;
|
|
53
|
-
credential_metadata: z.ZodOptional<z.ZodObject<{
|
|
54
|
-
display: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
55
|
-
name: z.ZodString;
|
|
56
|
-
locale: z.ZodOptional<z.ZodString>;
|
|
57
|
-
logo: z.ZodOptional<z.ZodObject<{
|
|
58
|
-
uri: z.ZodOptional<z.ZodUnion<[z.ZodURL, z.ZodString]>>;
|
|
59
|
-
alt_text: z.ZodOptional<z.ZodString>;
|
|
60
|
-
}, z.core.$loose>>;
|
|
61
|
-
description: z.ZodOptional<z.ZodString>;
|
|
62
|
-
background_color: z.ZodOptional<z.ZodString>;
|
|
63
|
-
background_image: z.ZodOptional<z.ZodObject<{
|
|
64
|
-
uri: z.ZodOptional<z.ZodUnion<[z.ZodURL, z.ZodString]>>;
|
|
65
|
-
}, z.core.$loose>>;
|
|
66
|
-
text_color: z.ZodOptional<z.ZodString>;
|
|
67
|
-
}, z.core.$loose>>>;
|
|
68
|
-
}, z.core.$loose>>;
|
|
69
|
-
}, z.core.$loose>>;
|
|
70
|
-
credential_metadata_uri: z.ZodOptional<z.ZodURL>;
|
|
71
|
-
}, z.core.$loose>;
|
|
50
|
+
}>, z$1.ZodString]>>>;
|
|
51
|
+
}, z$1.core.$loose>>;
|
|
52
|
+
}, z$1.core.$strip>>>;
|
|
53
|
+
credential_metadata: z$1.ZodOptional<z$1.ZodObject<{
|
|
54
|
+
display: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
|
|
55
|
+
name: z$1.ZodString;
|
|
56
|
+
locale: z$1.ZodOptional<z$1.ZodString>;
|
|
57
|
+
logo: z$1.ZodOptional<z$1.ZodObject<{
|
|
58
|
+
uri: z$1.ZodOptional<z$1.ZodUnion<[z$1.ZodURL, z$1.ZodString]>>;
|
|
59
|
+
alt_text: z$1.ZodOptional<z$1.ZodString>;
|
|
60
|
+
}, z$1.core.$loose>>;
|
|
61
|
+
description: z$1.ZodOptional<z$1.ZodString>;
|
|
62
|
+
background_color: z$1.ZodOptional<z$1.ZodString>;
|
|
63
|
+
background_image: z$1.ZodOptional<z$1.ZodObject<{
|
|
64
|
+
uri: z$1.ZodOptional<z$1.ZodUnion<[z$1.ZodURL, z$1.ZodString]>>;
|
|
65
|
+
}, z$1.core.$loose>>;
|
|
66
|
+
text_color: z$1.ZodOptional<z$1.ZodString>;
|
|
67
|
+
}, z$1.core.$loose>>>;
|
|
68
|
+
}, z$1.core.$loose>>;
|
|
69
|
+
}, z$1.core.$loose>>;
|
|
70
|
+
credential_metadata_uri: z$1.ZodOptional<z$1.ZodURL>;
|
|
71
|
+
}, z$1.core.$loose>;
|
|
72
72
|
/**
|
|
73
73
|
*
|
|
74
74
|
* Additional check for the Credential Issuer Metadata to see if there is a `credential_metadata_uri` available
|
|
75
75
|
*
|
|
76
76
|
*/
|
|
77
|
-
declare const parseCredentialMetadataUri: (cim: CredentialIssuerMetadata | Record<string, unknown>) => z.infer<typeof zCredentialIssuerMetadataWithMetadataUri> & CredentialIssuerMetadata;
|
|
77
|
+
declare const parseCredentialMetadataUri: (cim: CredentialIssuerMetadata | Record<string, unknown>) => z$1.infer<typeof zCredentialIssuerMetadataWithMetadataUri> & CredentialIssuerMetadata;
|
|
78
78
|
type IssuerMetadataWithCredentialMetadataUri = ReturnType<typeof parseCredentialMetadataUri>;
|
|
79
79
|
//#endregion
|
|
80
80
|
//#region src/credentialMetadata.d.ts
|
|
@@ -91,22 +91,28 @@ declare enum ValueType {
|
|
|
91
91
|
MiniMarkdown = "mini_markdown",
|
|
92
92
|
Url = "url"
|
|
93
93
|
}
|
|
94
|
-
declare const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
94
|
+
declare const CredentialMetadataDisplaySchema: z$1.ZodArray<z$1.ZodObject<{
|
|
95
|
+
locale: z$1.ZodOptional<z$1.ZodString>;
|
|
96
|
+
name: z$1.ZodString;
|
|
97
|
+
display_type: z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodEnum<typeof ValueType>, z$1.ZodString]>>;
|
|
98
|
+
}, z$1.core.$strip>>;
|
|
99
|
+
type CredentialMetadataDisplay = z$1.infer<typeof CredentialMetadataDisplaySchema>;
|
|
100
|
+
declare const CredentialMetadataSchema: z$1.ZodObject<{
|
|
101
|
+
transaction_data_types: z$1.ZodRecord<z$1.ZodString, z$1.ZodObject<{
|
|
102
|
+
claims: z$1.ZodArray<z$1.ZodObject<{
|
|
103
|
+
path: z$1.ZodArray<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodNull]>>;
|
|
104
|
+
mandatory: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
105
|
+
display: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
|
|
106
|
+
locale: z$1.ZodOptional<z$1.ZodString>;
|
|
107
|
+
name: z$1.ZodString;
|
|
108
|
+
display_type: z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodEnum<typeof ValueType>, z$1.ZodString]>>;
|
|
109
|
+
}, z$1.core.$strip>>>;
|
|
110
|
+
value_type: z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodEnum<typeof ValueType>, z$1.ZodString]>>;
|
|
111
|
+
}, z$1.core.$strip>>;
|
|
112
|
+
ui_labels: z$1.ZodUnknown;
|
|
113
|
+
}, z$1.core.$catchall<z$1.ZodUnknown>>>;
|
|
114
|
+
}, z$1.core.$strip>;
|
|
115
|
+
type CredentialMetadata = z$1.infer<typeof CredentialMetadataSchema>;
|
|
110
116
|
declare const parseCredentialMetadata: (credentialMetadata: Record<string, unknown>) => {
|
|
111
117
|
transaction_data_types: Record<string, {
|
|
112
118
|
[x: string]: unknown;
|
|
@@ -125,5 +131,20 @@ declare const parseCredentialMetadata: (credentialMetadata: Record<string, unkno
|
|
|
125
131
|
};
|
|
126
132
|
declare function fetchCredentialMetadata(verifier: JwtSignatureVerifier, credentialMetadataSource: string | IssuerMetadataWithCredentialMetadataUri, customFetcher?: typeof fetch, langCode?: string): Promise<CredentialMetadata & CredentialIssuerMetadata>;
|
|
127
133
|
//#endregion
|
|
128
|
-
|
|
134
|
+
//#region src/transactionData.d.ts
|
|
135
|
+
declare const TransactionDataSchema: z$1.ZodObject<{
|
|
136
|
+
type: z$1.ZodString;
|
|
137
|
+
credential_ids: z$1.ZodArray<z$1.ZodString>;
|
|
138
|
+
transaction_hash_alg: z$1.ZodOptional<z$1.ZodString>;
|
|
139
|
+
payload: z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>;
|
|
140
|
+
}, z$1.core.$strip>;
|
|
141
|
+
type TransactionData = z$1.infer<typeof TransactionDataSchema>;
|
|
142
|
+
type PayloadWithDisplayInfo = Record<string, {
|
|
143
|
+
value: unknown;
|
|
144
|
+
valueType?: string;
|
|
145
|
+
display?: CredentialMetadataDisplay;
|
|
146
|
+
}>;
|
|
147
|
+
declare const matchTransactionDataToTransactionDataType: (transactionData: Array<string>, credentialMetadata: Record<string, unknown>) => Record<string, PayloadWithDisplayInfo>;
|
|
148
|
+
//#endregion
|
|
149
|
+
export { type CredentialMetadata, type CredentialMetadataDisplay, type PayloadWithDisplayInfo, type TransactionData, ValueType, fetchCredentialMetadata, matchTransactionDataToTransactionDataType, parseCredentialMetadata, parseCredentialMetadataUri };
|
|
129
150
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { zCredentialIssuerMetadataSchema } from "@openid4vc/openid4vci";
|
|
2
|
-
import { base64url, decodeJwt } from "@owf/identity-common";
|
|
3
|
-
import z from "zod";
|
|
2
|
+
import { base64url, bytesToString, decodeJwt } from "@owf/identity-common";
|
|
3
|
+
import z$1, { z } from "zod";
|
|
4
4
|
//#region src/credentialMetadata.ts
|
|
5
5
|
let ValueType = /* @__PURE__ */ function(ValueType) {
|
|
6
6
|
ValueType["Boolean"] = "boolean";
|
|
@@ -18,16 +18,18 @@ let ValueType = /* @__PURE__ */ function(ValueType) {
|
|
|
18
18
|
}({});
|
|
19
19
|
const valueTypeValues = Object.values(ValueType).join("|");
|
|
20
20
|
const valueTypeRegex = new RegExp(`^template:(${valueTypeValues})$`);
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
21
|
+
const urnRegex = /^urn:eudi:sca:[^:]+:[^:]+(:[^:]+)*:[^:]+$/;
|
|
22
|
+
const CredentialMetadataDisplaySchema = z$1.array(z$1.object({
|
|
23
|
+
locale: z$1.string().optional(),
|
|
24
|
+
name: z$1.string(),
|
|
25
|
+
display_type: z$1.union([z$1.enum(ValueType), z$1.string().regex(valueTypeRegex)]).optional()
|
|
26
|
+
})).min(1);
|
|
27
|
+
const CredentialMetadataClaimsDataTypeSchema = z$1.object({
|
|
28
|
+
claims: z$1.array(z$1.object({
|
|
29
|
+
path: z$1.array(z$1.union([z$1.string(), z$1.null()])),
|
|
30
|
+
mandatory: z$1.boolean().optional(),
|
|
31
|
+
display: CredentialMetadataDisplaySchema.optional(),
|
|
32
|
+
value_type: z$1.union([z$1.enum(ValueType), z$1.string()]).optional()
|
|
31
33
|
}).superRefine((val, ctx) => {
|
|
32
34
|
if (!val.display && val.value_type !== void 0) ctx.addIssue({
|
|
33
35
|
code: "custom",
|
|
@@ -35,8 +37,9 @@ const CredentialMetadataSchema = z.object({ transaction_data_types: z.record(z.s
|
|
|
35
37
|
path: ["value_type"]
|
|
36
38
|
});
|
|
37
39
|
})),
|
|
38
|
-
ui_labels: z.unknown()
|
|
39
|
-
}).catchall(z.unknown())
|
|
40
|
+
ui_labels: z$1.unknown()
|
|
41
|
+
}).catchall(z$1.unknown());
|
|
42
|
+
const CredentialMetadataSchema = z$1.object({ transaction_data_types: z$1.record(z$1.string().regex(urnRegex), CredentialMetadataClaimsDataTypeSchema) });
|
|
40
43
|
const parseCredentialMetadata = (credentialMetadata) => {
|
|
41
44
|
return CredentialMetadataSchema.parse(credentialMetadata);
|
|
42
45
|
};
|
|
@@ -57,17 +60,17 @@ async function fetchCredentialMetadata(verifier, credentialMetadataSource, custo
|
|
|
57
60
|
const validateJwt = async (jwt, credentialMetadataUri, verifier) => {
|
|
58
61
|
const { header: h, payload: p, signature } = decodeJwt(jwt);
|
|
59
62
|
const [headerString, payloadString] = jwt.split(".");
|
|
60
|
-
const header = z.object({
|
|
61
|
-
x5c: z.array(z.string()),
|
|
62
|
-
typ: z.literal("credential-metadata+jwt")
|
|
63
|
+
const header = z$1.object({
|
|
64
|
+
x5c: z$1.array(z$1.string()),
|
|
65
|
+
typ: z$1.literal("credential-metadata+jwt")
|
|
63
66
|
}).parse(h);
|
|
64
|
-
const payload = z.object({
|
|
65
|
-
iss: z.string(),
|
|
66
|
-
sub: z.string().min(1, { message: "sub must be a non-empty credential type identifier" }),
|
|
67
|
-
format: z.enum(["dc+sd-jwt", "mso_mdoc"], { message: "format must be a valid OID4VCI credential format identifier" }),
|
|
68
|
-
iat: z.number().int().positive({ message: "iat must be a positive Unix timestamp" }),
|
|
69
|
-
exp: z.number().int().positive({ message: "exp must be a positive Unix timestamp" }),
|
|
70
|
-
credential_metadata_uri: z.url({ message: "credential_metadata_uri must be a valid URL" }),
|
|
67
|
+
const payload = z$1.object({
|
|
68
|
+
iss: z$1.string(),
|
|
69
|
+
sub: z$1.string().min(1, { message: "sub must be a non-empty credential type identifier" }),
|
|
70
|
+
format: z$1.enum(["dc+sd-jwt", "mso_mdoc"], { message: "format must be a valid OID4VCI credential format identifier" }),
|
|
71
|
+
iat: z$1.number().int().positive({ message: "iat must be a positive Unix timestamp" }),
|
|
72
|
+
exp: z$1.number().int().positive({ message: "exp must be a positive Unix timestamp" }),
|
|
73
|
+
credential_metadata_uri: z$1.url({ message: "credential_metadata_uri must be a valid URL" }),
|
|
71
74
|
credential_metadata: zCredentialIssuerMetadataSchema
|
|
72
75
|
}).refine((data) => data.exp > data.iat, {
|
|
73
76
|
message: "exp must be after iat",
|
|
@@ -87,7 +90,7 @@ const validateJwt = async (jwt, credentialMetadataUri, verifier) => {
|
|
|
87
90
|
};
|
|
88
91
|
//#endregion
|
|
89
92
|
//#region src/issuerMetadata.ts
|
|
90
|
-
const zCredentialIssuerMetadataWithMetadataUri = zCredentialIssuerMetadataSchema.extend({ credential_metadata_uri: z.url().optional() });
|
|
93
|
+
const zCredentialIssuerMetadataWithMetadataUri = zCredentialIssuerMetadataSchema.extend({ credential_metadata_uri: z$1.url().optional() });
|
|
91
94
|
/**
|
|
92
95
|
*
|
|
93
96
|
* Additional check for the Credential Issuer Metadata to see if there is a `credential_metadata_uri` available
|
|
@@ -95,6 +98,305 @@ const zCredentialIssuerMetadataWithMetadataUri = zCredentialIssuerMetadataSchema
|
|
|
95
98
|
*/
|
|
96
99
|
const parseCredentialMetadataUri = (cim) => zCredentialIssuerMetadataWithMetadataUri.parse(cim);
|
|
97
100
|
//#endregion
|
|
98
|
-
|
|
101
|
+
//#region src/utils.ts
|
|
102
|
+
const ISO4217_CODES = [
|
|
103
|
+
"AED",
|
|
104
|
+
"AFN",
|
|
105
|
+
"ALL",
|
|
106
|
+
"AMD",
|
|
107
|
+
"ANG",
|
|
108
|
+
"AOA",
|
|
109
|
+
"ARS",
|
|
110
|
+
"AUD",
|
|
111
|
+
"AWG",
|
|
112
|
+
"AZN",
|
|
113
|
+
"BAM",
|
|
114
|
+
"BBD",
|
|
115
|
+
"BDT",
|
|
116
|
+
"BGN",
|
|
117
|
+
"BHD",
|
|
118
|
+
"BIF",
|
|
119
|
+
"BMD",
|
|
120
|
+
"BND",
|
|
121
|
+
"BOB",
|
|
122
|
+
"BRL",
|
|
123
|
+
"BSD",
|
|
124
|
+
"BTN",
|
|
125
|
+
"BWP",
|
|
126
|
+
"BYN",
|
|
127
|
+
"BZD",
|
|
128
|
+
"CAD",
|
|
129
|
+
"CDF",
|
|
130
|
+
"CHF",
|
|
131
|
+
"CLP",
|
|
132
|
+
"CNY",
|
|
133
|
+
"COP",
|
|
134
|
+
"CRC",
|
|
135
|
+
"CUP",
|
|
136
|
+
"CVE",
|
|
137
|
+
"CZK",
|
|
138
|
+
"DJF",
|
|
139
|
+
"DKK",
|
|
140
|
+
"DOP",
|
|
141
|
+
"DZD",
|
|
142
|
+
"EGP",
|
|
143
|
+
"ERN",
|
|
144
|
+
"ETB",
|
|
145
|
+
"EUR",
|
|
146
|
+
"FJD",
|
|
147
|
+
"FKP",
|
|
148
|
+
"GBP",
|
|
149
|
+
"GEL",
|
|
150
|
+
"GHS",
|
|
151
|
+
"GIP",
|
|
152
|
+
"GMD",
|
|
153
|
+
"GNF",
|
|
154
|
+
"GTQ",
|
|
155
|
+
"GYD",
|
|
156
|
+
"HKD",
|
|
157
|
+
"HNL",
|
|
158
|
+
"HTG",
|
|
159
|
+
"HUF",
|
|
160
|
+
"IDR",
|
|
161
|
+
"ILS",
|
|
162
|
+
"INR",
|
|
163
|
+
"IQD",
|
|
164
|
+
"IRR",
|
|
165
|
+
"ISK",
|
|
166
|
+
"JMD",
|
|
167
|
+
"JOD",
|
|
168
|
+
"JPY",
|
|
169
|
+
"KES",
|
|
170
|
+
"KGS",
|
|
171
|
+
"KHR",
|
|
172
|
+
"KMF",
|
|
173
|
+
"KPW",
|
|
174
|
+
"KRW",
|
|
175
|
+
"KWD",
|
|
176
|
+
"KYD",
|
|
177
|
+
"KZT",
|
|
178
|
+
"LAK",
|
|
179
|
+
"LBP",
|
|
180
|
+
"LKR",
|
|
181
|
+
"LRD",
|
|
182
|
+
"LSL",
|
|
183
|
+
"LYD",
|
|
184
|
+
"MAD",
|
|
185
|
+
"MDL",
|
|
186
|
+
"MGA",
|
|
187
|
+
"MKD",
|
|
188
|
+
"MMK",
|
|
189
|
+
"MNT",
|
|
190
|
+
"MOP",
|
|
191
|
+
"MRU",
|
|
192
|
+
"MUR",
|
|
193
|
+
"MVR",
|
|
194
|
+
"MWK",
|
|
195
|
+
"MXN",
|
|
196
|
+
"MYR",
|
|
197
|
+
"MZN",
|
|
198
|
+
"NAD",
|
|
199
|
+
"NGN",
|
|
200
|
+
"NIO",
|
|
201
|
+
"NOK",
|
|
202
|
+
"NPR",
|
|
203
|
+
"NZD",
|
|
204
|
+
"OMR",
|
|
205
|
+
"PAB",
|
|
206
|
+
"PEN",
|
|
207
|
+
"PGK",
|
|
208
|
+
"PHP",
|
|
209
|
+
"PKR",
|
|
210
|
+
"PLN",
|
|
211
|
+
"PYG",
|
|
212
|
+
"QAR",
|
|
213
|
+
"RON",
|
|
214
|
+
"RSD",
|
|
215
|
+
"RUB",
|
|
216
|
+
"RWF",
|
|
217
|
+
"SAR",
|
|
218
|
+
"SBD",
|
|
219
|
+
"SCR",
|
|
220
|
+
"SDG",
|
|
221
|
+
"SEK",
|
|
222
|
+
"SGD",
|
|
223
|
+
"SHP",
|
|
224
|
+
"SLE",
|
|
225
|
+
"SOS",
|
|
226
|
+
"SRD",
|
|
227
|
+
"SSP",
|
|
228
|
+
"STN",
|
|
229
|
+
"SVC",
|
|
230
|
+
"SYP",
|
|
231
|
+
"SZL",
|
|
232
|
+
"THB",
|
|
233
|
+
"TJS",
|
|
234
|
+
"TMT",
|
|
235
|
+
"TND",
|
|
236
|
+
"TOP",
|
|
237
|
+
"TRY",
|
|
238
|
+
"TTD",
|
|
239
|
+
"TVD",
|
|
240
|
+
"TWD",
|
|
241
|
+
"TZS",
|
|
242
|
+
"UAH",
|
|
243
|
+
"UGX",
|
|
244
|
+
"USD",
|
|
245
|
+
"UYU",
|
|
246
|
+
"UZS",
|
|
247
|
+
"VES",
|
|
248
|
+
"VND",
|
|
249
|
+
"VUV",
|
|
250
|
+
"WST",
|
|
251
|
+
"XAF",
|
|
252
|
+
"XCD",
|
|
253
|
+
"XOF",
|
|
254
|
+
"XPF",
|
|
255
|
+
"YER",
|
|
256
|
+
"ZAR",
|
|
257
|
+
"ZMW",
|
|
258
|
+
"ZWL"
|
|
259
|
+
];
|
|
260
|
+
const Iso4217CurrencyCode = z.enum(ISO4217_CODES);
|
|
261
|
+
const Iso4217Amount = z.string().regex(/^\d+\.\d+ [A-Z]{3}$/).refine((val) => ISO4217_CODES.includes(val.split(" ")[1]), { message: "Invalid ISO4217 currency code" });
|
|
262
|
+
const getJsonPathValueAndKey = (query, data) => {
|
|
263
|
+
if (query.length === 0) return void 0;
|
|
264
|
+
if (typeof data !== "object" || data === null) return void 0;
|
|
265
|
+
const [head, ...tail] = query;
|
|
266
|
+
const entries = head === null ? Object.entries(data) : [[head, data[head]]];
|
|
267
|
+
for (const [key, child] of entries) {
|
|
268
|
+
if (tail.length === 0) {
|
|
269
|
+
if (child === void 0) return void 0;
|
|
270
|
+
return {
|
|
271
|
+
key,
|
|
272
|
+
value: child
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
const result = getJsonPathValueAndKey(tail, child);
|
|
276
|
+
if (result !== void 0) return result;
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
//#endregion
|
|
280
|
+
//#region src/transactionData.ts
|
|
281
|
+
const TRANSACTION_DATA_SCA_PREFIX = "urn:eudi:sca:";
|
|
282
|
+
const TransactionDataSchema = z$1.object({
|
|
283
|
+
type: z$1.string(),
|
|
284
|
+
credential_ids: z$1.array(z$1.string()),
|
|
285
|
+
transaction_hash_alg: z$1.string().optional(),
|
|
286
|
+
payload: z$1.record(z$1.string(), z$1.unknown())
|
|
287
|
+
});
|
|
288
|
+
const parseTransactionData = (txnData) => {
|
|
289
|
+
const decoded = JSON.parse(bytesToString(base64url.decode(txnData)));
|
|
290
|
+
return TransactionDataSchema.parse(decoded);
|
|
291
|
+
};
|
|
292
|
+
const __matchTransactionDataToTransactionDataType = (transactionData, credentialMetadata) => {
|
|
293
|
+
const transactionDataTypes = Object.entries(credentialMetadata.transaction_data_types).reduce((prev, [key, value]) => {
|
|
294
|
+
if (key.startsWith("urn:eudi:sca:")) prev[key] = value;
|
|
295
|
+
return prev;
|
|
296
|
+
}, {});
|
|
297
|
+
if (Object.keys(transactionData).length === 0) throw new Error(`No transaction data found with the required prefix of '${TRANSACTION_DATA_SCA_PREFIX}'`);
|
|
298
|
+
return transactionData.reduce((prev, td) => {
|
|
299
|
+
const transactionDataType = transactionDataTypes[td.type];
|
|
300
|
+
if (!transactionDataType) throw new Error(`Could not find transaction data type in credential metadata for key '${td.type}'`);
|
|
301
|
+
const claims = transactionDataType.claims.reduce((prev, { path, mandatory, value_type, display }) => {
|
|
302
|
+
const jsonPathValueAndKey = getJsonPathValueAndKey(path, td.payload);
|
|
303
|
+
if (!jsonPathValueAndKey) return prev;
|
|
304
|
+
if (value_type && value_type === "label_only" && mandatory) return prev;
|
|
305
|
+
const doesValueTypeMatch = value_type ? matchValueTypeToValue(value_type, jsonPathValueAndKey.value) : true;
|
|
306
|
+
const isValid = !!jsonPathValueAndKey && doesValueTypeMatch;
|
|
307
|
+
if (mandatory ? mandatory === isValid : isValid) prev[jsonPathValueAndKey.key] = {
|
|
308
|
+
valueType: value_type,
|
|
309
|
+
value: jsonPathValueAndKey.value,
|
|
310
|
+
display
|
|
311
|
+
};
|
|
312
|
+
return prev;
|
|
313
|
+
}, {});
|
|
314
|
+
if (!transactionDataType.claims.filter(({ mandatory }) => mandatory).every(({ path, value_type }) => {
|
|
315
|
+
if (value_type && value_type === "label_only") return true;
|
|
316
|
+
const jsonPathValueAndKey = getJsonPathValueAndKey(path, td.payload);
|
|
317
|
+
if (!jsonPathValueAndKey) return false;
|
|
318
|
+
return value_type ? matchValueTypeToValue(value_type, jsonPathValueAndKey.value) : true;
|
|
319
|
+
})) {
|
|
320
|
+
const invalidClaims = transactionDataType.claims.filter(({ path, mandatory, value_type }) => {
|
|
321
|
+
if (!mandatory) return false;
|
|
322
|
+
const jsonPathValueAndKey = getJsonPathValueAndKey(path, td.payload);
|
|
323
|
+
if (!jsonPathValueAndKey) return true;
|
|
324
|
+
if (value_type && value_type === "label_only") return true;
|
|
325
|
+
return !(value_type ? matchValueTypeToValue(value_type, jsonPathValueAndKey.value) : true);
|
|
326
|
+
});
|
|
327
|
+
throw new Error(`Credential is not compatible. Missing paths: [${invalidClaims.map(({ path }) => `[${path.join(", ")}]`).join(", ")}]`);
|
|
328
|
+
}
|
|
329
|
+
prev[td.type] = claims;
|
|
330
|
+
return prev;
|
|
331
|
+
}, {});
|
|
332
|
+
};
|
|
333
|
+
const matchTransactionDataToTransactionDataType = (transactionData, credentialMetadata) => {
|
|
334
|
+
return __matchTransactionDataToTransactionDataType(transactionData.map((td) => {
|
|
335
|
+
try {
|
|
336
|
+
return parseTransactionData(td);
|
|
337
|
+
} catch {
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
}).filter((td) => td !== void 0), parseCredentialMetadata(credentialMetadata));
|
|
341
|
+
};
|
|
342
|
+
const matchValueTypeToValue = (valueType, value) => {
|
|
343
|
+
switch (valueType) {
|
|
344
|
+
case "boolean": return typeof value === "boolean";
|
|
345
|
+
case "frequency": return typeof value === "string" && [
|
|
346
|
+
"INDA",
|
|
347
|
+
"DAIL",
|
|
348
|
+
"WEEK",
|
|
349
|
+
"TOWK",
|
|
350
|
+
"TWMN",
|
|
351
|
+
"MNTH",
|
|
352
|
+
"TOMN",
|
|
353
|
+
"QUTR",
|
|
354
|
+
"FOMN",
|
|
355
|
+
"SEMI",
|
|
356
|
+
"YEAR",
|
|
357
|
+
"TYEA"
|
|
358
|
+
].includes(value);
|
|
359
|
+
case "image": try {
|
|
360
|
+
return typeof value === "string" && !!z$1.url().parse(value);
|
|
361
|
+
} catch {
|
|
362
|
+
return false;
|
|
363
|
+
}
|
|
364
|
+
case "iso_date": try {
|
|
365
|
+
return typeof value === "string" && !!z$1.iso.date().parse(value);
|
|
366
|
+
} catch {
|
|
367
|
+
return false;
|
|
368
|
+
}
|
|
369
|
+
case "iso_time": try {
|
|
370
|
+
return typeof value === "string" && !!z$1.iso.time().parse(value);
|
|
371
|
+
} catch {
|
|
372
|
+
return false;
|
|
373
|
+
}
|
|
374
|
+
case "iso_date_time": try {
|
|
375
|
+
return typeof value === "string" && !!z$1.iso.datetime().parse(value);
|
|
376
|
+
} catch {
|
|
377
|
+
return false;
|
|
378
|
+
}
|
|
379
|
+
case "iso_currency": try {
|
|
380
|
+
return typeof value === "string" && !!Iso4217CurrencyCode.parse(value);
|
|
381
|
+
} catch {
|
|
382
|
+
return false;
|
|
383
|
+
}
|
|
384
|
+
case "iso_currency_amount": try {
|
|
385
|
+
return typeof value === "string" && !!Iso4217Amount.parse(value);
|
|
386
|
+
} catch {
|
|
387
|
+
return false;
|
|
388
|
+
}
|
|
389
|
+
case "label_only": return true;
|
|
390
|
+
case "mini_markdown": return typeof value === "string";
|
|
391
|
+
case "url": try {
|
|
392
|
+
return typeof value === "string" && !!z$1.url().parse(value);
|
|
393
|
+
} catch {
|
|
394
|
+
return false;
|
|
395
|
+
}
|
|
396
|
+
default: return true;
|
|
397
|
+
}
|
|
398
|
+
};
|
|
399
|
+
//#endregion
|
|
400
|
+
export { ValueType, fetchCredentialMetadata, matchTransactionDataToTransactionDataType, parseCredentialMetadata, parseCredentialMetadataUri };
|
|
99
401
|
|
|
100
402
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/credentialMetadata.ts","../src/issuerMetadata.ts"],"sourcesContent":["import { type CredentialIssuerMetadata, zCredentialIssuerMetadataSchema } from '@openid4vc/openid4vci'\nimport { base64url, decodeJwt } from '@owf/identity-common'\nimport z from 'zod'\nimport type { JwtSignatureVerifier } from './crypto'\nimport type { IssuerMetadataWithCredentialMetadataUri } from './issuerMetadata'\n\nexport enum ValueType {\n Boolean = 'boolean',\n Frequency = 'frequency',\n Image = 'image',\n IsoDate = 'iso_date',\n IsoTime = 'iso_time',\n IsoDateTime = 'iso_date_time',\n IsoCurrency = 'iso_currency',\n IsoCurrencyAmount = 'iso_currency_amount',\n LabelOnly = 'label_only',\n MiniMarkdown = 'mini_markdown',\n Url = 'url',\n}\n\nconst valueTypeValues = Object.values(ValueType).join('|')\nconst valueTypeRegex = new RegExp(`^template:(${valueTypeValues})$`)\nconst urnRegex = /^urn:eudi:sca:[^:]+:[^:]+(:[^:]+)*:[^:]+$/\n\nconst CredentialMetadataSchema = z.object({\n transaction_data_types: z.record(\n z.string().regex(urnRegex),\n z\n .object({\n claims: z.array(\n z\n .object({\n path: z.array(z.union([z.string(), z.null()])),\n mandatory: z.boolean().optional(),\n display: z\n .array(\n z.object({\n locale: z.string().optional(),\n name: z.string(),\n display_type: z.union([z.enum(ValueType), z.string().regex(valueTypeRegex)]).optional(),\n })\n )\n .min(1)\n .optional(),\n value_type: z.union([z.enum(ValueType), z.string().regex(valueTypeRegex)]).optional(),\n })\n .superRefine((val, ctx) => {\n if (!val.display && val.value_type !== undefined) {\n ctx.addIssue({\n code: 'custom',\n message: 'value_type must not be used on claims without a display array',\n path: ['value_type'],\n })\n }\n })\n ),\n ui_labels: z.unknown(),\n })\n .catchall(z.unknown())\n ),\n})\n\nexport type CredentialMetadata = z.infer<typeof CredentialMetadataSchema>\n\nexport const parseCredentialMetadata = (credentialMetadata: Record<string, unknown>) => {\n const cm = CredentialMetadataSchema.parse(credentialMetadata)\n return cm\n}\n\nexport async function fetchCredentialMetadata(\n verifier: JwtSignatureVerifier,\n credentialMetadataSource: string | IssuerMetadataWithCredentialMetadataUri,\n customFetcher = fetch,\n langCode?: string\n): Promise<CredentialMetadata & CredentialIssuerMetadata> {\n const uri =\n typeof credentialMetadataSource === 'string'\n ? credentialMetadataSource\n : credentialMetadataSource.credential_metadata_uri\n if (!uri) {\n throw Error('credential_metadata_uri is not defined on the issuer metadata')\n }\n\n const response = await customFetcher(uri, {\n headers: {\n Accept: 'application/jwt',\n ...(langCode ? { 'Accept-Language': langCode } : {}),\n },\n })\n\n const payload = await validateJwt(await response.text(), uri, verifier)\n\n return CredentialMetadataSchema.extend(zCredentialIssuerMetadataSchema.shape).parse(payload.credential_metadata)\n}\n\n/**\n *\n * @todo validate the sub, iss, x5c chain\n *\n */\nconst validateJwt = async (jwt: string, credentialMetadataUri: string, verifier: JwtSignatureVerifier) => {\n const { header: h, payload: p, signature } = decodeJwt(jwt)\n const [headerString, payloadString] = jwt.split('.')\n\n const header = z.object({ x5c: z.array(z.string()), typ: z.literal('credential-metadata+jwt') }).parse(h)\n const payload = z\n .object({\n iss: z.string(),\n sub: z.string().min(1, { message: 'sub must be a non-empty credential type identifier' }),\n format: z.enum(['dc+sd-jwt', 'mso_mdoc'], {\n message: 'format must be a valid OID4VCI credential format identifier',\n }),\n iat: z.number().int().positive({ message: 'iat must be a positive Unix timestamp' }),\n exp: z.number().int().positive({ message: 'exp must be a positive Unix timestamp' }),\n credential_metadata_uri: z.url({ message: 'credential_metadata_uri must be a valid URL' }),\n credential_metadata: zCredentialIssuerMetadataSchema,\n })\n .refine((data) => data.exp > data.iat, { message: 'exp must be after iat', path: ['exp'] })\n .refine((data) => new Date(data.exp) < new Date(), { message: 'exp must be after iat', path: ['exp'] })\n .refine(\n (data) => {\n return data.credential_metadata_uri === credentialMetadataUri\n },\n {\n message: `credential_metadata_uri must match source '${credentialMetadataUri}'`,\n path: ['credential_metadata_uri'],\n }\n )\n .parse(p)\n\n const toBeVerified = `${headerString}.${payloadString}`\n\n await verifier(header.x5c, toBeVerified, base64url.decode(signature))\n\n return payload\n}\n","import { type CredentialIssuerMetadata, zCredentialIssuerMetadataSchema } from '@openid4vc/openid4vci'\nimport z from 'zod'\n\nconst zCredentialIssuerMetadataWithMetadataUri = zCredentialIssuerMetadataSchema.extend({\n credential_metadata_uri: z.url().optional(),\n})\n\n/**\n *\n * Additional check for the Credential Issuer Metadata to see if there is a `credential_metadata_uri` available\n *\n */\nexport const parseCredentialMetadataUri = (cim: CredentialIssuerMetadata | Record<string, unknown>) =>\n zCredentialIssuerMetadataWithMetadataUri.parse(cim) as z.infer<typeof zCredentialIssuerMetadataWithMetadataUri> &\n CredentialIssuerMetadata\n\nexport type IssuerMetadataWithCredentialMetadataUri = ReturnType<typeof parseCredentialMetadataUri>\n"],"mappings":";;;;AAMA,IAAY,YAAL,yBAAA,WAAA;AACL,WAAA,aAAA;AACA,WAAA,eAAA;AACA,WAAA,WAAA;AACA,WAAA,aAAA;AACA,WAAA,aAAA;AACA,WAAA,iBAAA;AACA,WAAA,iBAAA;AACA,WAAA,uBAAA;AACA,WAAA,eAAA;AACA,WAAA,kBAAA;AACA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C;EACE,SAAS,+CAA+C,sBAAsB;EAC9E,MAAM,CAAC,0BAA0B;EAClC,CACF,CACA,MAAM,EAAE;CAEX,MAAM,eAAe,GAAG,aAAa,GAAG;AAExC,OAAM,SAAS,OAAO,KAAK,cAAc,UAAU,OAAO,UAAU,CAAC;AAErE,QAAO;;;;ACnIT,MAAM,2CAA2C,gCAAgC,OAAO,EACtF,yBAAyB,EAAE,KAAK,CAAC,UAAU,EAC5C,CAAC;;;;;;AAOF,MAAa,8BAA8B,QACzC,yCAAyC,MAAM,IAAI"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["z","z","z"],"sources":["../src/credentialMetadata.ts","../src/issuerMetadata.ts","../src/utils.ts","../src/transactionData.ts"],"sourcesContent":["import { type CredentialIssuerMetadata, zCredentialIssuerMetadataSchema } from '@openid4vc/openid4vci'\nimport { base64url, decodeJwt } from '@owf/identity-common'\nimport z from 'zod'\nimport type { JwtSignatureVerifier } from './crypto'\nimport type { IssuerMetadataWithCredentialMetadataUri } from './issuerMetadata'\n\nexport enum ValueType {\n Boolean = 'boolean',\n Frequency = 'frequency',\n Image = 'image',\n IsoDate = 'iso_date',\n IsoTime = 'iso_time',\n IsoDateTime = 'iso_date_time',\n IsoCurrency = 'iso_currency',\n IsoCurrencyAmount = 'iso_currency_amount',\n LabelOnly = 'label_only',\n MiniMarkdown = 'mini_markdown',\n Url = 'url',\n}\n\nconst valueTypeValues = Object.values(ValueType).join('|')\nconst valueTypeRegex = new RegExp(`^template:(${valueTypeValues})$`)\nconst urnRegex = /^urn:eudi:sca:[^:]+:[^:]+(:[^:]+)*:[^:]+$/\n\nconst CredentialMetadataDisplaySchema = z\n .array(\n z.object({\n locale: z.string().optional(),\n name: z.string(),\n display_type: z.union([z.enum(ValueType), z.string().regex(valueTypeRegex)]).optional(),\n })\n )\n .min(1)\n\nexport type CredentialMetadataDisplay = z.infer<typeof CredentialMetadataDisplaySchema>\n\nexport const CredentialMetadataClaimsDataTypeSchema = z\n .object({\n claims: z.array(\n z\n .object({\n path: z.array(z.union([z.string(), z.null()])),\n mandatory: z.boolean().optional(),\n display: CredentialMetadataDisplaySchema.optional(),\n value_type: z.union([z.enum(ValueType), z.string()]).optional(),\n })\n .superRefine((val, ctx) => {\n if (!val.display && val.value_type !== undefined) {\n ctx.addIssue({\n code: 'custom',\n message: 'value_type must not be used on claims without a display array',\n path: ['value_type'],\n })\n }\n })\n ),\n ui_labels: z.unknown(),\n })\n .catchall(z.unknown())\n\nexport type CredentialMetadataClaimsDataType = z.infer<typeof CredentialMetadataClaimsDataTypeSchema>\n\nconst CredentialMetadataSchema = z.object({\n transaction_data_types: z.record(z.string().regex(urnRegex), CredentialMetadataClaimsDataTypeSchema),\n})\n\nexport type CredentialMetadata = z.infer<typeof CredentialMetadataSchema>\n\nexport const parseCredentialMetadata = (credentialMetadata: Record<string, unknown>) => {\n const cm = CredentialMetadataSchema.parse(credentialMetadata)\n return cm\n}\n\nexport async function fetchCredentialMetadata(\n verifier: JwtSignatureVerifier,\n credentialMetadataSource: string | IssuerMetadataWithCredentialMetadataUri,\n customFetcher = fetch,\n langCode?: string\n): Promise<CredentialMetadata & CredentialIssuerMetadata> {\n const uri =\n typeof credentialMetadataSource === 'string'\n ? credentialMetadataSource\n : credentialMetadataSource.credential_metadata_uri\n if (!uri) {\n throw Error('credential_metadata_uri is not defined on the issuer metadata')\n }\n\n const response = await customFetcher(uri, {\n headers: {\n Accept: 'application/jwt',\n ...(langCode ? { 'Accept-Language': langCode } : {}),\n },\n })\n\n const payload = await validateJwt(await response.text(), uri, verifier)\n\n return CredentialMetadataSchema.extend(zCredentialIssuerMetadataSchema.shape).parse(payload.credential_metadata)\n}\n\n/**\n *\n * @todo validate the sub, iss, x5c chain\n *\n */\nconst validateJwt = async (jwt: string, credentialMetadataUri: string, verifier: JwtSignatureVerifier) => {\n const { header: h, payload: p, signature } = decodeJwt(jwt)\n const [headerString, payloadString] = jwt.split('.')\n\n const header = z.object({ x5c: z.array(z.string()), typ: z.literal('credential-metadata+jwt') }).parse(h)\n const payload = z\n .object({\n iss: z.string(),\n sub: z.string().min(1, { message: 'sub must be a non-empty credential type identifier' }),\n format: z.enum(['dc+sd-jwt', 'mso_mdoc'], {\n message: 'format must be a valid OID4VCI credential format identifier',\n }),\n iat: z.number().int().positive({ message: 'iat must be a positive Unix timestamp' }),\n exp: z.number().int().positive({ message: 'exp must be a positive Unix timestamp' }),\n credential_metadata_uri: z.url({ message: 'credential_metadata_uri must be a valid URL' }),\n credential_metadata: zCredentialIssuerMetadataSchema,\n })\n .refine((data) => data.exp > data.iat, { message: 'exp must be after iat', path: ['exp'] })\n .refine((data) => new Date(data.exp) < new Date(), { message: 'exp must be after iat', path: ['exp'] })\n .refine(\n (data) => {\n return data.credential_metadata_uri === credentialMetadataUri\n },\n {\n message: `credential_metadata_uri must match source '${credentialMetadataUri}'`,\n path: ['credential_metadata_uri'],\n }\n )\n .parse(p)\n\n const toBeVerified = `${headerString}.${payloadString}`\n\n await verifier(header.x5c, toBeVerified, base64url.decode(signature))\n\n return payload\n}\n","import { type CredentialIssuerMetadata, zCredentialIssuerMetadataSchema } from '@openid4vc/openid4vci'\nimport z from 'zod'\n\nconst zCredentialIssuerMetadataWithMetadataUri = zCredentialIssuerMetadataSchema.extend({\n credential_metadata_uri: z.url().optional(),\n})\n\n/**\n *\n * Additional check for the Credential Issuer Metadata to see if there is a `credential_metadata_uri` available\n *\n */\nexport const parseCredentialMetadataUri = (cim: CredentialIssuerMetadata | Record<string, unknown>) =>\n zCredentialIssuerMetadataWithMetadataUri.parse(cim) as z.infer<typeof zCredentialIssuerMetadataWithMetadataUri> &\n CredentialIssuerMetadata\n\nexport type IssuerMetadataWithCredentialMetadataUri = ReturnType<typeof parseCredentialMetadataUri>\n","import { z } from 'zod'\n\nconst ISO4217_CODES = [\n 'AED',\n 'AFN',\n 'ALL',\n 'AMD',\n 'ANG',\n 'AOA',\n 'ARS',\n 'AUD',\n 'AWG',\n 'AZN',\n 'BAM',\n 'BBD',\n 'BDT',\n 'BGN',\n 'BHD',\n 'BIF',\n 'BMD',\n 'BND',\n 'BOB',\n 'BRL',\n 'BSD',\n 'BTN',\n 'BWP',\n 'BYN',\n 'BZD',\n 'CAD',\n 'CDF',\n 'CHF',\n 'CLP',\n 'CNY',\n 'COP',\n 'CRC',\n 'CUP',\n 'CVE',\n 'CZK',\n 'DJF',\n 'DKK',\n 'DOP',\n 'DZD',\n 'EGP',\n 'ERN',\n 'ETB',\n 'EUR',\n 'FJD',\n 'FKP',\n 'GBP',\n 'GEL',\n 'GHS',\n 'GIP',\n 'GMD',\n 'GNF',\n 'GTQ',\n 'GYD',\n 'HKD',\n 'HNL',\n 'HTG',\n 'HUF',\n 'IDR',\n 'ILS',\n 'INR',\n 'IQD',\n 'IRR',\n 'ISK',\n 'JMD',\n 'JOD',\n 'JPY',\n 'KES',\n 'KGS',\n 'KHR',\n 'KMF',\n 'KPW',\n 'KRW',\n 'KWD',\n 'KYD',\n 'KZT',\n 'LAK',\n 'LBP',\n 'LKR',\n 'LRD',\n 'LSL',\n 'LYD',\n 'MAD',\n 'MDL',\n 'MGA',\n 'MKD',\n 'MMK',\n 'MNT',\n 'MOP',\n 'MRU',\n 'MUR',\n 'MVR',\n 'MWK',\n 'MXN',\n 'MYR',\n 'MZN',\n 'NAD',\n 'NGN',\n 'NIO',\n 'NOK',\n 'NPR',\n 'NZD',\n 'OMR',\n 'PAB',\n 'PEN',\n 'PGK',\n 'PHP',\n 'PKR',\n 'PLN',\n 'PYG',\n 'QAR',\n 'RON',\n 'RSD',\n 'RUB',\n 'RWF',\n 'SAR',\n 'SBD',\n 'SCR',\n 'SDG',\n 'SEK',\n 'SGD',\n 'SHP',\n 'SLE',\n 'SOS',\n 'SRD',\n 'SSP',\n 'STN',\n 'SVC',\n 'SYP',\n 'SZL',\n 'THB',\n 'TJS',\n 'TMT',\n 'TND',\n 'TOP',\n 'TRY',\n 'TTD',\n 'TVD',\n 'TWD',\n 'TZS',\n 'UAH',\n 'UGX',\n 'USD',\n 'UYU',\n 'UZS',\n 'VES',\n 'VND',\n 'VUV',\n 'WST',\n 'XAF',\n 'XCD',\n 'XOF',\n 'XPF',\n 'YER',\n 'ZAR',\n 'ZMW',\n 'ZWL',\n] as const\n\nexport const Iso4217CurrencyCode = z.enum(ISO4217_CODES)\n\nexport const Iso4217Amount = z\n .string()\n .regex(/^\\d+\\.\\d+ [A-Z]{3}$/)\n .refine((val) => ISO4217_CODES.includes(val.split(' ')[1] as (typeof ISO4217_CODES)[number]), {\n message: 'Invalid ISO4217 currency code',\n })\n\nexport const getJsonPathValueAndKey = (\n query: Array<string | null>,\n data: unknown\n): { key: string; value: unknown } | undefined => {\n if (query.length === 0) return undefined\n if (typeof data !== 'object' || data === null) return undefined\n const [head, ...tail] = query\n const entries =\n head === null\n ? Object.entries(data as Record<string, unknown>)\n : ([[head, (data as Record<string, unknown>)[head]]] as [string, unknown][])\n\n for (const [key, child] of entries) {\n if (tail.length === 0) {\n if (child === undefined) return undefined\n return { key, value: child }\n }\n const result = getJsonPathValueAndKey(tail, child)\n if (result !== undefined) return result\n }\n\n return undefined\n}\n","import { base64url, bytesToString } from '@owf/identity-common'\nimport z from 'zod'\nimport {\n type CredentialMetadata,\n type CredentialMetadataDisplay,\n parseCredentialMetadata,\n ValueType,\n} from './credentialMetadata'\nimport { getJsonPathValueAndKey, Iso4217Amount, Iso4217CurrencyCode } from './utils'\n\nexport const TRANSACTION_DATA_SCA_PREFIX = 'urn:eudi:sca:'\n\nconst TransactionDataSchema = z.object({\n type: z.string(),\n credential_ids: z.array(z.string()),\n transaction_hash_alg: z.string().optional(),\n payload: z.record(z.string(), z.unknown()),\n})\n\nexport type TransactionData = z.infer<typeof TransactionDataSchema>\n\nexport const parseTransactionData = (txnData: string) => {\n const decoded = JSON.parse(bytesToString(base64url.decode(txnData)))\n return TransactionDataSchema.parse(decoded)\n}\n\nexport type PayloadWithDisplayInfo = Record<\n string,\n {\n value: unknown\n valueType?: string\n display?: CredentialMetadataDisplay\n }\n>\n\nconst __matchTransactionDataToTransactionDataType = (\n transactionData: Array<TransactionData>,\n credentialMetadata: CredentialMetadata\n): Record<string, PayloadWithDisplayInfo> => {\n const transactionDataTypes = Object.entries(credentialMetadata.transaction_data_types).reduce<\n CredentialMetadata['transaction_data_types']\n >((prev, [key, value]) => {\n if (key.startsWith(TRANSACTION_DATA_SCA_PREFIX)) {\n prev[key] = value\n }\n return prev\n }, {})\n\n if (Object.keys(transactionData).length === 0) {\n throw new Error(`No transaction data found with the required prefix of '${TRANSACTION_DATA_SCA_PREFIX}'`)\n }\n\n return transactionData.reduce<Record<string, PayloadWithDisplayInfo>>((prev, td) => {\n const transactionDataType = transactionDataTypes[td.type]\n if (!transactionDataType) {\n throw new Error(`Could not find transaction data type in credential metadata for key '${td.type}'`)\n }\n\n const claims = transactionDataType.claims.reduce<PayloadWithDisplayInfo>(\n (prev, { path, mandatory, value_type, display }) => {\n const jsonPathValueAndKey = getJsonPathValueAndKey(path, td.payload)\n if (!jsonPathValueAndKey) return prev\n if (value_type && value_type === ValueType.LabelOnly && mandatory) return prev\n const doesValueTypeMatch = value_type ? matchValueTypeToValue(value_type, jsonPathValueAndKey.value) : true\n const isValid = !!jsonPathValueAndKey && doesValueTypeMatch\n const shouldBeAdded = mandatory ? mandatory === isValid : isValid\n\n if (shouldBeAdded) {\n prev[jsonPathValueAndKey.key] = {\n valueType: value_type,\n value: jsonPathValueAndKey.value,\n display,\n }\n }\n return prev\n },\n {}\n )\n\n const doClaimsPathMatchPayload = transactionDataType.claims\n .filter(({ mandatory }) => mandatory)\n .every(({ path, value_type }) => {\n if (value_type && value_type === ValueType.LabelOnly) return true\n const jsonPathValueAndKey = getJsonPathValueAndKey(path, td.payload)\n if (!jsonPathValueAndKey) return false\n return value_type ? matchValueTypeToValue(value_type, jsonPathValueAndKey.value) : true\n })\n\n if (!doClaimsPathMatchPayload) {\n const invalidClaims = transactionDataType.claims.filter(({ path, mandatory, value_type }) => {\n if (!mandatory) return false\n const jsonPathValueAndKey = getJsonPathValueAndKey(path, td.payload)\n if (!jsonPathValueAndKey) return true\n if (value_type && value_type === ValueType.LabelOnly) return true\n const doesValueTypeMatch = value_type ? matchValueTypeToValue(value_type, jsonPathValueAndKey.value) : true\n return !doesValueTypeMatch\n })\n throw new Error(\n `Credential is not compatible. Missing paths: [${invalidClaims\n .map(({ path }) => `[${path.join(', ')}]`)\n .join(', ')}]`\n )\n }\n\n prev[td.type] = claims\n\n return prev\n }, {})\n}\n\nexport const matchTransactionDataToTransactionDataType = (\n transactionData: Array<string>,\n credentialMetadata: Record<string, unknown>\n) => {\n const parsedTransactionData = transactionData\n .map((td) => {\n try {\n return parseTransactionData(td)\n } catch {\n return undefined\n }\n })\n .filter((td) => td !== undefined)\n const parsedCredentialMetadata = parseCredentialMetadata(credentialMetadata)\n return __matchTransactionDataToTransactionDataType(parsedTransactionData, parsedCredentialMetadata)\n}\n\nconst matchValueTypeToValue = (valueType: ValueType | string, value: unknown) => {\n switch (valueType) {\n case ValueType.Boolean:\n return typeof value === 'boolean'\n case ValueType.Frequency:\n return (\n typeof value === 'string' &&\n ['INDA', 'DAIL', 'WEEK', 'TOWK', 'TWMN', 'MNTH', 'TOMN', 'QUTR', 'FOMN', 'SEMI', 'YEAR', 'TYEA'].includes(value)\n )\n // TODO: deal with `#integrity` here.\n // If the URL is not a Data URL, the payload MUST contain a sibling claim at the same path suffixed with #integrity containing a [W3C.SRI] hash of the image content.\n case ValueType.Image:\n try {\n return typeof value === 'string' && !!z.url().parse(value)\n } catch {\n return false\n }\n case ValueType.IsoDate:\n try {\n return typeof value === 'string' && !!z.iso.date().parse(value)\n } catch {\n return false\n }\n case ValueType.IsoTime:\n try {\n return typeof value === 'string' && !!z.iso.time().parse(value)\n } catch {\n return false\n }\n case ValueType.IsoDateTime:\n try {\n return typeof value === 'string' && !!z.iso.datetime().parse(value)\n } catch {\n return false\n }\n case ValueType.IsoCurrency:\n try {\n return typeof value === 'string' && !!Iso4217CurrencyCode.parse(value)\n } catch {\n return false\n }\n case ValueType.IsoCurrencyAmount:\n try {\n return typeof value === 'string' && !!Iso4217Amount.parse(value)\n } catch {\n return false\n }\n case ValueType.LabelOnly:\n return true\n case ValueType.MiniMarkdown:\n return typeof value === 'string'\n case ValueType.Url:\n try {\n return typeof value === 'string' && !!z.url().parse(value)\n } catch {\n return false\n }\n default:\n // TODO: allow a way for consumers to add more validation here\n // add support for `template:${value_type}\n return true\n }\n}\n"],"mappings":";;;;AAMA,IAAY,YAAL,yBAAA,WAAA;AACL,WAAA,aAAA;AACA,WAAA,eAAA;AACA,WAAA,WAAA;AACA,WAAA,aAAA;AACA,WAAA,aAAA;AACA,WAAA,iBAAA;AACA,WAAA,iBAAA;AACA,WAAA,uBAAA;AACA,WAAA,eAAA;AACA,WAAA,kBAAA;AACA,WAAA,SAAA;;KACD;AAED,MAAM,kBAAkB,OAAO,OAAO,UAAU,CAAC,KAAK,IAAI;AAC1D,MAAM,iBAAiB,IAAI,OAAO,cAAc,gBAAgB,IAAI;AACpE,MAAM,WAAW;AAEjB,MAAM,kCAAkCA,IACrC,MACCA,IAAE,OAAO;CACP,QAAQA,IAAE,QAAQ,CAAC,UAAU;CAC7B,MAAMA,IAAE,QAAQ;CAChB,cAAcA,IAAE,MAAM,CAACA,IAAE,KAAK,UAAU,EAAEA,IAAE,QAAQ,CAAC,MAAM,eAAe,CAAC,CAAC,CAAC,UAAU;CACxF,CAAC,CACH,CACA,IAAI,EAAE;AAIT,MAAa,yCAAyCA,IACnD,OAAO;CACN,QAAQA,IAAE,MACRA,IACG,OAAO;EACN,MAAMA,IAAE,MAAMA,IAAE,MAAM,CAACA,IAAE,QAAQ,EAAEA,IAAE,MAAM,CAAC,CAAC,CAAC;EAC9C,WAAWA,IAAE,SAAS,CAAC,UAAU;EACjC,SAAS,gCAAgC,UAAU;EACnD,YAAYA,IAAE,MAAM,CAACA,IAAE,KAAK,UAAU,EAAEA,IAAE,QAAQ,CAAC,CAAC,CAAC,UAAU;EAChE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CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAa,sBAAsB,EAAE,KAAK,cAAc;AAExD,MAAa,gBAAgB,EAC1B,QAAQ,CACR,MAAM,sBAAsB,CAC5B,QAAQ,QAAQ,cAAc,SAAS,IAAI,MAAM,IAAI,CAAC,GAAqC,EAAE,EAC5F,SAAS,iCACV,CAAC;AAEJ,MAAa,0BACX,OACA,SACgD;AAChD,KAAI,MAAM,WAAW,EAAG,QAAO,KAAA;AAC/B,KAAI,OAAO,SAAS,YAAY,SAAS,KAAM,QAAO,KAAA;CACtD,MAAM,CAAC,MAAM,GAAG,QAAQ;CACxB,MAAM,UACJ,SAAS,OACL,OAAO,QAAQ,KAAgC,GAC9C,CAAC,CAAC,MAAO,KAAiC,MAAM,CAAC;AAExD,MAAK,MAAM,CAAC,KAAK,UAAU,SAAS;AAClC,MAAI,KAAK,WAAW,GAAG;AACrB,OAAI,UAAU,KAAA,EAAW,QAAO,KAAA;AAChC,UAAO;IAAE;IAAK,OAAO;IAAO;;EAE9B,MAAM,SAAS,uBAAuB,MAAM,MAAM;AAClD,MAAI,WAAW,KAAA,EAAW,QAAO;;;;;AClLrC,MAAa,8BAA8B;AAE3C,MAAM,wBAAwBC,IAAE,OAAO;CACrC,MAAMA,IAAE,QAAQ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AEX,KAAA,WACE,KAAI;AACF,UAAO,OAAO,UAAU,YAAY,CAAC,CAACA,IAAE,IAAI,MAAM,CAAC,MAAM,MAAM;UACzD;AACN,UAAO;;EAEX,KAAA,WACE,KAAI;AACF,UAAO,OAAO,UAAU,YAAY,CAAC,CAACA,IAAE,IAAI,MAAM,CAAC,MAAM,MAAM;UACzD;AACN,UAAO;;EAEX,KAAA,gBACE,KAAI;AACF,UAAO,OAAO,UAAU,YAAY,CAAC,CAACA,IAAE,IAAI,UAAU,CAAC,MAAM,MAAM;UAC7D;AACN,UAAO;;EAEX,KAAA,eACE,KAAI;AACF,UAAO,OAAO,UAAU,YAAY,CAAC,CAAC,oBAAoB,MAAM,MAAM;UAChE;AACN,UAAO;;EAEX,KAAA,sBACE,KAAI;AACF,UAAO,OAAO,UAAU,YAAY,CAAC,CAAC,cAAc,MAAM,MAAM;UAC1D;AACN,UAAO;;EAEX,KAAA,aACE,QAAO;EACT,KAAA,gBACE,QAAO,OAAO,UAAU;EAC1B,KAAA,MACE,KAAI;AACF,UAAO,OAAO,UAAU,YAAY,CAAC,CAACA,IAAE,KAAK,CAAC,MAAM,MAAM;UACpD;AACN,UAAO;;EAEX,QAGE,QAAO"}
|
package/package.json
CHANGED
|
@@ -1,44 +1,41 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@owf/eudi-sca",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0-alpha-20260422114341",
|
|
4
4
|
"description": "Tools and utilities for EUDI Strong Customer Authentication per TS12",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
7
7
|
],
|
|
8
8
|
"license": "Apache-2.0",
|
|
9
|
-
"exports":
|
|
9
|
+
"exports": {
|
|
10
|
+
".": "./dist/index.mjs",
|
|
11
|
+
"./package.json": "./package.json"
|
|
12
|
+
},
|
|
10
13
|
"homepage": "https://github.com/openwallet-foundation-labs/identity-common-ts/tree/main/packages/eudi-sca",
|
|
11
14
|
"repository": {
|
|
12
15
|
"type": "git",
|
|
13
16
|
"url": "https://github.com/openwallet-foundation-labs/identity-common-ts",
|
|
14
17
|
"directory": "packages/eudi-sca"
|
|
15
18
|
},
|
|
16
|
-
"publishConfig": {
|
|
17
|
-
"module": "./dist/index.mjs",
|
|
18
|
-
"types": "./dist/index.d.mts",
|
|
19
|
-
"exports": {
|
|
20
|
-
".": "./dist/index.mjs",
|
|
21
|
-
"./package.json": "./package.json"
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
19
|
"keywords": [
|
|
25
20
|
"sca",
|
|
26
21
|
"eudi",
|
|
27
22
|
"TS12",
|
|
28
23
|
"wallet"
|
|
29
24
|
],
|
|
30
|
-
"scripts": {
|
|
31
|
-
"build": "tsdown src/index.ts --format esm --dts --sourcemap"
|
|
32
|
-
},
|
|
33
25
|
"dependencies": {
|
|
34
26
|
"@openid4vc/openid4vci": "0.5.0-alpha-20260415063740",
|
|
35
|
-
"@owf/crypto": "
|
|
36
|
-
"@owf/identity-common": "
|
|
27
|
+
"@owf/crypto": "0.2.0-alpha-20260422114341",
|
|
28
|
+
"@owf/identity-common": "0.2.0-alpha-20260422114341",
|
|
37
29
|
"@owf/mdoc": "^0.6.0",
|
|
38
30
|
"@sd-jwt/core": "^0.19.0",
|
|
39
31
|
"zod": "^4.3.6"
|
|
40
32
|
},
|
|
41
33
|
"devDependencies": {
|
|
42
34
|
"nock": "^14.0.13"
|
|
43
|
-
}
|
|
44
|
-
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "tsdown src/index.ts --format esm --dts --sourcemap"
|
|
38
|
+
},
|
|
39
|
+
"module": "./dist/index.mjs",
|
|
40
|
+
"types": "./dist/index.d.mts"
|
|
41
|
+
}
|