@credo-ts/openid4vc 0.6.0-pr-2134-20241217213340 → 0.6.0-pr-2195-20250217170804
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/build/openid4vc-holder/OpenId4VcHolderApi.d.ts +61 -11
- package/build/openid4vc-holder/OpenId4VcHolderApi.js +17 -19
- package/build/openid4vc-holder/OpenId4VcHolderApi.js.map +1 -1
- package/build/openid4vc-holder/OpenId4VcHolderModule.js +1 -1
- package/build/openid4vc-holder/OpenId4VcHolderModule.js.map +1 -1
- package/build/openid4vc-holder/OpenId4VciHolderService.d.ts +7 -8
- package/build/openid4vc-holder/OpenId4VciHolderService.js +60 -45
- package/build/openid4vc-holder/OpenId4VciHolderService.js.map +1 -1
- package/build/openid4vc-holder/OpenId4VciHolderServiceOptions.d.ts +3 -3
- package/build/openid4vc-holder/OpenId4VciHolderServiceOptions.js +1 -1
- package/build/openid4vc-holder/OpenId4VciHolderServiceOptions.js.map +1 -1
- package/build/openid4vc-holder/OpenId4vcSiopHolderService.d.ts +59 -13
- package/build/openid4vc-holder/OpenId4vcSiopHolderService.js +232 -172
- package/build/openid4vc-holder/OpenId4vcSiopHolderService.js.map +1 -1
- package/build/openid4vc-holder/OpenId4vcSiopHolderServiceOptions.d.ts +18 -1
- package/build/openid4vc-issuer/OpenId4VcIssuerApi.d.ts +196 -46
- package/build/openid4vc-issuer/OpenId4VcIssuerApi.js +8 -19
- package/build/openid4vc-issuer/OpenId4VcIssuerApi.js.map +1 -1
- package/build/openid4vc-issuer/OpenId4VcIssuerModule.js +3 -3
- package/build/openid4vc-issuer/OpenId4VcIssuerModule.js.map +1 -1
- package/build/openid4vc-issuer/OpenId4VcIssuerModuleConfig.d.ts +13 -13
- package/build/openid4vc-issuer/OpenId4VcIssuerModuleConfig.js +19 -40
- package/build/openid4vc-issuer/OpenId4VcIssuerModuleConfig.js.map +1 -1
- package/build/openid4vc-issuer/OpenId4VcIssuerService.d.ts +198 -48
- package/build/openid4vc-issuer/OpenId4VcIssuerService.js +45 -37
- package/build/openid4vc-issuer/OpenId4VcIssuerService.js.map +1 -1
- package/build/openid4vc-issuer/OpenId4VcIssuerServiceOptions.d.ts +8 -3
- package/build/openid4vc-issuer/repository/OpenId4VcIssuanceSessionRecord.d.ts +1 -1
- package/build/openid4vc-issuer/repository/OpenId4VcIssuanceSessionRecord.js +26 -12
- package/build/openid4vc-issuer/repository/OpenId4VcIssuanceSessionRecord.js.map +1 -1
- package/build/openid4vc-issuer/repository/OpenId4VcIssuerRecord.js +19 -22
- package/build/openid4vc-issuer/repository/OpenId4VcIssuerRecord.js.map +1 -1
- package/build/openid4vc-issuer/router/accessTokenEndpoint.js +11 -9
- package/build/openid4vc-issuer/router/accessTokenEndpoint.js.map +1 -1
- package/build/openid4vc-issuer/router/authorizationChallengeEndpoint.js +17 -6
- package/build/openid4vc-issuer/router/authorizationChallengeEndpoint.js.map +1 -1
- package/build/openid4vc-issuer/router/authorizationServerMetadataEndpoint.js +1 -1
- package/build/openid4vc-issuer/router/authorizationServerMetadataEndpoint.js.map +1 -1
- package/build/openid4vc-issuer/router/credentialEndpoint.js +11 -9
- package/build/openid4vc-issuer/router/credentialEndpoint.js.map +1 -1
- package/build/openid4vc-issuer/router/issuerMetadataEndpoint.js +7 -3
- package/build/openid4vc-issuer/router/issuerMetadataEndpoint.js.map +1 -1
- package/build/openid4vc-issuer/util/txCode.js +2 -3
- package/build/openid4vc-issuer/util/txCode.js.map +1 -1
- package/build/openid4vc-verifier/OpenId4VcSiopVerifierService.d.ts +21 -7
- package/build/openid4vc-verifier/OpenId4VcSiopVerifierService.js +499 -263
- package/build/openid4vc-verifier/OpenId4VcSiopVerifierService.js.map +1 -1
- package/build/openid4vc-verifier/OpenId4VcSiopVerifierServiceOptions.d.ts +23 -3
- package/build/openid4vc-verifier/OpenId4VcVerifierApi.d.ts +3 -3
- package/build/openid4vc-verifier/OpenId4VcVerifierApi.js +11 -18
- package/build/openid4vc-verifier/OpenId4VcVerifierApi.js.map +1 -1
- package/build/openid4vc-verifier/OpenId4VcVerifierModule.js +3 -3
- package/build/openid4vc-verifier/OpenId4VcVerifierModule.js.map +1 -1
- package/build/openid4vc-verifier/OpenId4VcVerifierModuleConfig.js +11 -8
- package/build/openid4vc-verifier/OpenId4VcVerifierModuleConfig.js.map +1 -1
- package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartyEventEmitter.d.ts +23 -4
- package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartyEventEmitter.js +25 -29
- package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartyEventEmitter.js.map +1 -1
- package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartySessionManager.js +4 -6
- package/build/openid4vc-verifier/repository/OpenId4VcRelyingPartySessionManager.js.map +1 -1
- package/build/openid4vc-verifier/repository/OpenId4VcVerificationSessionRecord.js +11 -6
- package/build/openid4vc-verifier/repository/OpenId4VcVerificationSessionRecord.js.map +1 -1
- package/build/openid4vc-verifier/repository/OpenId4VcVerifierRecord.js +7 -5
- package/build/openid4vc-verifier/repository/OpenId4VcVerifierRecord.js.map +1 -1
- package/build/openid4vc-verifier/router/authorizationEndpoint.js +5 -104
- package/build/openid4vc-verifier/router/authorizationEndpoint.js.map +1 -1
- package/build/shared/callbacks.d.ts +16 -5
- package/build/shared/callbacks.js +120 -24
- package/build/shared/callbacks.js.map +1 -1
- package/build/shared/issuerMetadataUtils.d.ts +102 -144
- package/build/shared/models/index.d.ts +10 -8
- package/build/shared/models/index.js +5 -5
- package/build/shared/models/index.js.map +1 -1
- package/build/shared/router/context.d.ts +2 -2
- package/build/shared/router/context.js +5 -5
- package/build/shared/router/context.js.map +1 -1
- package/build/shared/router/tenants.js +1 -2
- package/build/shared/router/tenants.js.map +1 -1
- package/build/shared/utils.d.ts +6 -6
- package/build/shared/utils.js +22 -61
- package/build/shared/utils.js.map +1 -1
- package/package.json +7 -6
- package/build/shared/transform.d.ts +0 -5
- package/build/shared/transform.js +0 -73
- package/build/shared/transform.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { OpenId4VciCredentialConfigurationsSupported, OpenId4VciCredentialConfigurationsSupportedWithFormats } from './models';
|
|
2
|
-
import { type CredentialConfigurationsSupported } from '@
|
|
2
|
+
import { type CredentialConfigurationsSupported } from '@openid4vc/oid4vci';
|
|
3
3
|
/**
|
|
4
4
|
* Returns all entries from the credential offer with the associated metadata resolved.
|
|
5
5
|
*/
|
|
@@ -12,147 +12,105 @@ export declare function getAllowedAndRequestedScopeValues(options: {
|
|
|
12
12
|
allowedScopes: string[];
|
|
13
13
|
}): string[];
|
|
14
14
|
export declare function getCredentialConfigurationsSupportedForScopes(credentialConfigurationsSupported: CredentialConfigurationsSupported, scopes: string[]): {
|
|
15
|
-
[k: string]: ({
|
|
16
|
-
format: "
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
} | undefined;
|
|
117
|
-
} & {
|
|
118
|
-
[key: string]: unknown;
|
|
119
|
-
};
|
|
120
|
-
order?: string[] | undefined;
|
|
121
|
-
} | ({
|
|
122
|
-
format: string;
|
|
123
|
-
} & {
|
|
124
|
-
[key: string]: unknown;
|
|
125
|
-
})) & {
|
|
126
|
-
format: string;
|
|
127
|
-
display?: ({
|
|
128
|
-
name: string;
|
|
129
|
-
description?: string | undefined;
|
|
130
|
-
locale?: string | undefined;
|
|
131
|
-
logo?: ({
|
|
132
|
-
uri?: string | undefined;
|
|
133
|
-
alt_text?: string | undefined;
|
|
134
|
-
} & {
|
|
135
|
-
[key: string]: unknown;
|
|
136
|
-
}) | undefined;
|
|
137
|
-
background_color?: string | undefined;
|
|
138
|
-
background_image?: ({
|
|
139
|
-
uri?: string | undefined;
|
|
140
|
-
} & {
|
|
141
|
-
[key: string]: unknown;
|
|
142
|
-
}) | undefined;
|
|
143
|
-
text_color?: string | undefined;
|
|
144
|
-
} & {
|
|
145
|
-
[key: string]: unknown;
|
|
146
|
-
})[] | undefined;
|
|
147
|
-
scope?: string | undefined;
|
|
148
|
-
cryptographic_binding_methods_supported?: string[] | undefined;
|
|
149
|
-
credential_signing_alg_values_supported?: string[] | undefined;
|
|
150
|
-
proof_types_supported?: {
|
|
151
|
-
[x: string]: {
|
|
152
|
-
proof_signing_alg_values_supported: string[];
|
|
153
|
-
};
|
|
154
|
-
} | undefined;
|
|
155
|
-
} & {
|
|
156
|
-
[key: string]: unknown;
|
|
157
|
-
};
|
|
15
|
+
[k: string]: import("zod").objectOutputType<{
|
|
16
|
+
format: import("zod").ZodString;
|
|
17
|
+
scope: import("zod").ZodOptional<import("zod").ZodString>;
|
|
18
|
+
cryptographic_binding_methods_supported: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
19
|
+
credential_signing_alg_values_supported: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
20
|
+
proof_types_supported: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodUnion<[import("zod").ZodLiteral<"jwt">, import("zod").ZodLiteral<"attestation">, import("zod").ZodString]>, import("zod").ZodObject<{
|
|
21
|
+
proof_signing_alg_values_supported: import("zod").ZodArray<import("zod").ZodString, "many">;
|
|
22
|
+
key_attestations_required: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
23
|
+
key_storage: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodUnion<[import("zod").ZodEnum<["iso_18045_high", "iso_18045_moderate", "iso_18045_enhanced-basic", "iso_18045_basic"]>, import("zod").ZodString]>, "many">>;
|
|
24
|
+
user_authentication: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodUnion<[import("zod").ZodEnum<["iso_18045_high", "iso_18045_moderate", "iso_18045_enhanced-basic", "iso_18045_basic"]>, import("zod").ZodString]>, "many">>;
|
|
25
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
26
|
+
key_storage: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodUnion<[import("zod").ZodEnum<["iso_18045_high", "iso_18045_moderate", "iso_18045_enhanced-basic", "iso_18045_basic"]>, import("zod").ZodString]>, "many">>;
|
|
27
|
+
user_authentication: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodUnion<[import("zod").ZodEnum<["iso_18045_high", "iso_18045_moderate", "iso_18045_enhanced-basic", "iso_18045_basic"]>, import("zod").ZodString]>, "many">>;
|
|
28
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
29
|
+
key_storage: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodUnion<[import("zod").ZodEnum<["iso_18045_high", "iso_18045_moderate", "iso_18045_enhanced-basic", "iso_18045_basic"]>, import("zod").ZodString]>, "many">>;
|
|
30
|
+
user_authentication: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodUnion<[import("zod").ZodEnum<["iso_18045_high", "iso_18045_moderate", "iso_18045_enhanced-basic", "iso_18045_basic"]>, import("zod").ZodString]>, "many">>;
|
|
31
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
32
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
33
|
+
proof_signing_alg_values_supported: string[];
|
|
34
|
+
key_attestations_required?: import("zod").objectOutputType<{
|
|
35
|
+
key_storage: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodUnion<[import("zod").ZodEnum<["iso_18045_high", "iso_18045_moderate", "iso_18045_enhanced-basic", "iso_18045_basic"]>, import("zod").ZodString]>, "many">>;
|
|
36
|
+
user_authentication: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodUnion<[import("zod").ZodEnum<["iso_18045_high", "iso_18045_moderate", "iso_18045_enhanced-basic", "iso_18045_basic"]>, import("zod").ZodString]>, "many">>;
|
|
37
|
+
}, import("zod").ZodTypeAny, "passthrough"> | undefined;
|
|
38
|
+
}, {
|
|
39
|
+
proof_signing_alg_values_supported: string[];
|
|
40
|
+
key_attestations_required?: import("zod").objectInputType<{
|
|
41
|
+
key_storage: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodUnion<[import("zod").ZodEnum<["iso_18045_high", "iso_18045_moderate", "iso_18045_enhanced-basic", "iso_18045_basic"]>, import("zod").ZodString]>, "many">>;
|
|
42
|
+
user_authentication: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodUnion<[import("zod").ZodEnum<["iso_18045_high", "iso_18045_moderate", "iso_18045_enhanced-basic", "iso_18045_basic"]>, import("zod").ZodString]>, "many">>;
|
|
43
|
+
}, import("zod").ZodTypeAny, "passthrough"> | undefined;
|
|
44
|
+
}>>>;
|
|
45
|
+
display: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
46
|
+
name: import("zod").ZodString;
|
|
47
|
+
locale: import("zod").ZodOptional<import("zod").ZodString>;
|
|
48
|
+
logo: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
49
|
+
uri: import("zod").ZodOptional<import("zod").ZodString>;
|
|
50
|
+
alt_text: import("zod").ZodOptional<import("zod").ZodString>;
|
|
51
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
52
|
+
uri: import("zod").ZodOptional<import("zod").ZodString>;
|
|
53
|
+
alt_text: import("zod").ZodOptional<import("zod").ZodString>;
|
|
54
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
55
|
+
uri: import("zod").ZodOptional<import("zod").ZodString>;
|
|
56
|
+
alt_text: import("zod").ZodOptional<import("zod").ZodString>;
|
|
57
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
58
|
+
description: import("zod").ZodOptional<import("zod").ZodString>;
|
|
59
|
+
background_color: import("zod").ZodOptional<import("zod").ZodString>;
|
|
60
|
+
background_image: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
61
|
+
uri: import("zod").ZodOptional<import("zod").ZodString>;
|
|
62
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
63
|
+
uri: import("zod").ZodOptional<import("zod").ZodString>;
|
|
64
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
65
|
+
uri: import("zod").ZodOptional<import("zod").ZodString>;
|
|
66
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
67
|
+
text_color: import("zod").ZodOptional<import("zod").ZodString>;
|
|
68
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
69
|
+
name: import("zod").ZodString;
|
|
70
|
+
locale: import("zod").ZodOptional<import("zod").ZodString>;
|
|
71
|
+
logo: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
72
|
+
uri: import("zod").ZodOptional<import("zod").ZodString>;
|
|
73
|
+
alt_text: import("zod").ZodOptional<import("zod").ZodString>;
|
|
74
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
75
|
+
uri: import("zod").ZodOptional<import("zod").ZodString>;
|
|
76
|
+
alt_text: import("zod").ZodOptional<import("zod").ZodString>;
|
|
77
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
78
|
+
uri: import("zod").ZodOptional<import("zod").ZodString>;
|
|
79
|
+
alt_text: import("zod").ZodOptional<import("zod").ZodString>;
|
|
80
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
81
|
+
description: import("zod").ZodOptional<import("zod").ZodString>;
|
|
82
|
+
background_color: import("zod").ZodOptional<import("zod").ZodString>;
|
|
83
|
+
background_image: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
84
|
+
uri: import("zod").ZodOptional<import("zod").ZodString>;
|
|
85
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
86
|
+
uri: import("zod").ZodOptional<import("zod").ZodString>;
|
|
87
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
88
|
+
uri: import("zod").ZodOptional<import("zod").ZodString>;
|
|
89
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
90
|
+
text_color: import("zod").ZodOptional<import("zod").ZodString>;
|
|
91
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
92
|
+
name: import("zod").ZodString;
|
|
93
|
+
locale: import("zod").ZodOptional<import("zod").ZodString>;
|
|
94
|
+
logo: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
95
|
+
uri: import("zod").ZodOptional<import("zod").ZodString>;
|
|
96
|
+
alt_text: import("zod").ZodOptional<import("zod").ZodString>;
|
|
97
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
98
|
+
uri: import("zod").ZodOptional<import("zod").ZodString>;
|
|
99
|
+
alt_text: import("zod").ZodOptional<import("zod").ZodString>;
|
|
100
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
101
|
+
uri: import("zod").ZodOptional<import("zod").ZodString>;
|
|
102
|
+
alt_text: import("zod").ZodOptional<import("zod").ZodString>;
|
|
103
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
104
|
+
description: import("zod").ZodOptional<import("zod").ZodString>;
|
|
105
|
+
background_color: import("zod").ZodOptional<import("zod").ZodString>;
|
|
106
|
+
background_image: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
107
|
+
uri: import("zod").ZodOptional<import("zod").ZodString>;
|
|
108
|
+
}, "passthrough", import("zod").ZodTypeAny, import("zod").objectOutputType<{
|
|
109
|
+
uri: import("zod").ZodOptional<import("zod").ZodString>;
|
|
110
|
+
}, import("zod").ZodTypeAny, "passthrough">, import("zod").objectInputType<{
|
|
111
|
+
uri: import("zod").ZodOptional<import("zod").ZodString>;
|
|
112
|
+
}, import("zod").ZodTypeAny, "passthrough">>>;
|
|
113
|
+
text_color: import("zod").ZodOptional<import("zod").ZodString>;
|
|
114
|
+
}, import("zod").ZodTypeAny, "passthrough">>, "many">>;
|
|
115
|
+
}, import("zod").ZodTypeAny, "passthrough">;
|
|
158
116
|
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import type { AccessTokenResponse } from '@
|
|
2
|
-
import type { CredentialConfigurationSupported, CredentialConfigurationSupportedWithFormats, CredentialIssuerMetadata, CredentialIssuerMetadataDisplayEntry, CredentialOfferPreAuthorizedCodeGrantTxCode, CredentialRequest, CredentialRequestFormatSpecific, CredentialRequestWithFormats, IssuerMetadataResult, ParseCredentialRequestReturn
|
|
3
|
-
import
|
|
4
|
-
|
|
1
|
+
import type { AccessTokenResponse } from '@openid4vc/oauth2';
|
|
2
|
+
import type { CredentialConfigurationSupported, CredentialConfigurationSupportedWithFormats, CredentialIssuerMetadata, CredentialIssuerMetadataDisplayEntry, CredentialOfferObject, CredentialOfferPreAuthorizedCodeGrantTxCode, CredentialRequest, CredentialRequestFormatSpecific, CredentialRequestWithFormats, IssuerMetadataResult, ParseCredentialRequestReturn } from '@openid4vc/oid4vci';
|
|
3
|
+
import { Openid4vpAuthorizationResponse, Openid4vpAuthorizationResponseDcApi, ResolvedOpenid4vpAuthRequest } from '@openid4vc/oid4vp';
|
|
4
|
+
import type { AuthorizationRequestPayload, IDTokenPayload } from '@sphereon/did-auth-siop';
|
|
5
|
+
export { authorizationCodeGrantIdentifier, preAuthorizedCodeGrantIdentifier } from '@openid4vc/oauth2';
|
|
6
|
+
export { Openid4vpAuthorizationRequest } from '@openid4vc/oid4vp';
|
|
5
7
|
export type OpenId4VciCredentialConfigurationSupportedWithFormats = CredentialConfigurationSupportedWithFormats;
|
|
6
8
|
export type OpenId4VciCredentialConfigurationSupported = CredentialConfigurationSupported;
|
|
7
9
|
export type OpenId4VciCredentialConfigurationsSupported = Record<string, OpenId4VciCredentialConfigurationSupported>;
|
|
@@ -16,11 +18,11 @@ export type OpenId4VciCredentialIssuerMetadataDisplay = CredentialIssuerMetadata
|
|
|
16
18
|
export type OpenId4VciCredentialRequest = CredentialRequest;
|
|
17
19
|
export type OpenId4VciCredentialRequestWithFormats = CredentialRequestWithFormats;
|
|
18
20
|
export type OpenId4VciCredentialOfferPayload = CredentialOfferObject;
|
|
19
|
-
export type OpenId4VcSiopVerifiedAuthorizationRequest =
|
|
21
|
+
export type OpenId4VcSiopVerifiedAuthorizationRequest = ResolvedOpenid4vpAuthRequest;
|
|
20
22
|
export type OpenId4VcSiopAuthorizationRequestPayload = AuthorizationRequestPayload;
|
|
21
|
-
export type OpenId4VcSiopAuthorizationResponsePayload =
|
|
23
|
+
export type OpenId4VcSiopAuthorizationResponsePayload = Openid4vpAuthorizationResponse | Openid4vpAuthorizationResponseDcApi['data'];
|
|
22
24
|
export type OpenId4VcSiopIdTokenPayload = IDTokenPayload;
|
|
23
|
-
export * from './OpenId4VcJwtIssuer';
|
|
24
25
|
export * from './CredentialHolderBinding';
|
|
25
|
-
export * from './OpenId4VciCredentialFormatProfile';
|
|
26
26
|
export * from './OpenId4VciAuthorizationServerConfig';
|
|
27
|
+
export * from './OpenId4VciCredentialFormatProfile';
|
|
28
|
+
export * from './OpenId4VcJwtIssuer';
|
|
@@ -14,12 +14,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
18
|
-
var oauth2_1 = require("@
|
|
19
|
-
Object.defineProperty(exports, "preAuthorizedCodeGrantIdentifier", { enumerable: true, get: function () { return oauth2_1.preAuthorizedCodeGrantIdentifier; } });
|
|
17
|
+
exports.preAuthorizedCodeGrantIdentifier = exports.authorizationCodeGrantIdentifier = void 0;
|
|
18
|
+
var oauth2_1 = require("@openid4vc/oauth2");
|
|
20
19
|
Object.defineProperty(exports, "authorizationCodeGrantIdentifier", { enumerable: true, get: function () { return oauth2_1.authorizationCodeGrantIdentifier; } });
|
|
21
|
-
|
|
20
|
+
Object.defineProperty(exports, "preAuthorizedCodeGrantIdentifier", { enumerable: true, get: function () { return oauth2_1.preAuthorizedCodeGrantIdentifier; } });
|
|
22
21
|
__exportStar(require("./CredentialHolderBinding"), exports);
|
|
23
|
-
__exportStar(require("./OpenId4VciCredentialFormatProfile"), exports);
|
|
24
22
|
__exportStar(require("./OpenId4VciAuthorizationServerConfig"), exports);
|
|
23
|
+
__exportStar(require("./OpenId4VciCredentialFormatProfile"), exports);
|
|
24
|
+
__exportStar(require("./OpenId4VcJwtIssuer"), exports);
|
|
25
25
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/shared/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/shared/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAiBA,4CAAsG;AAA7F,0HAAA,gCAAgC,OAAA;AAAE,0HAAA,gCAAgC,OAAA;AAiC3E,4DAAyC;AACzC,wEAAqD;AACrD,sEAAmD;AACnD,uDAAoC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Oauth2ErrorCodes, Oauth2ServerErrorResponseError } from '@
|
|
1
|
+
import type { Oauth2ErrorCodes, Oauth2ServerErrorResponseError } from '@openid4vc/oauth2';
|
|
2
2
|
import type { AgentContext, Logger } from '@credo-ts/core';
|
|
3
3
|
import type { Response, Request, NextFunction } from 'express';
|
|
4
|
-
import { Oauth2ResourceUnauthorizedError } from '@
|
|
4
|
+
import { Oauth2ResourceUnauthorizedError } from '@openid4vc/oauth2';
|
|
5
5
|
export interface OpenId4VcRequest<RC extends Record<string, unknown> = Record<string, never>> extends Request {
|
|
6
6
|
requestContext?: RC & OpenId4VcRequestContext;
|
|
7
7
|
}
|
|
@@ -7,7 +7,7 @@ exports.sendNotFoundResponse = sendNotFoundResponse;
|
|
|
7
7
|
exports.sendErrorResponse = sendErrorResponse;
|
|
8
8
|
exports.sendJsonResponse = sendJsonResponse;
|
|
9
9
|
exports.getRequestContext = getRequestContext;
|
|
10
|
-
const oauth2_1 = require("@
|
|
10
|
+
const oauth2_1 = require("@openid4vc/oauth2");
|
|
11
11
|
const core_1 = require("@credo-ts/core");
|
|
12
12
|
function sendUnauthorizedError(response, next, logger, error, status) {
|
|
13
13
|
const errorMessage = error instanceof Error ? error.message : error;
|
|
@@ -22,7 +22,7 @@ function sendUnauthorizedError(response, next, logger, error, status) {
|
|
|
22
22
|
]);
|
|
23
23
|
response
|
|
24
24
|
.setHeader('WWW-Authenticate', unauhorizedError.toHeaderValue())
|
|
25
|
-
.status(status
|
|
25
|
+
.status(status ?? 403)
|
|
26
26
|
.send();
|
|
27
27
|
next(error);
|
|
28
28
|
}
|
|
@@ -49,7 +49,7 @@ function sendNotFoundResponse(response, next, logger, internalReason) {
|
|
|
49
49
|
next(new core_1.CredoError(internalReason));
|
|
50
50
|
}
|
|
51
51
|
function sendErrorResponse(response, next, logger, status, message, error, additionalPayload) {
|
|
52
|
-
const body =
|
|
52
|
+
const body = { error: message, ...(error instanceof Error && { cause: error.message }), ...additionalPayload };
|
|
53
53
|
logger.warn(`[OID4VC] Sending error response: ${JSON.stringify(body)}`, {
|
|
54
54
|
error,
|
|
55
55
|
});
|
|
@@ -61,8 +61,8 @@ function sendJsonResponse(response, next,
|
|
|
61
61
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
62
62
|
body, contentType, status) {
|
|
63
63
|
response
|
|
64
|
-
.setHeader('Content-Type', contentType
|
|
65
|
-
.status(status
|
|
64
|
+
.setHeader('Content-Type', contentType ?? 'application/json')
|
|
65
|
+
.status(status ?? 200)
|
|
66
66
|
.send(JSON.stringify(body));
|
|
67
67
|
next();
|
|
68
68
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/shared/router/context.ts"],"names":[],"mappings":";;AAeA,sDAyBC;AAED,0DAYC;AACD,wEAYC;AAED,oDAKC;AAED,8CAmBC;AAED,4CAcC;AAGD,8CAKC;AAnHD,
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../src/shared/router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AAC,KAAK,CAAC,CAAC,CAAC,IAAI,iBAAU,CAAC,mDAAmD,CAAC,CAAA;IACtG,IAAI,CAAC,UAAU,CAAC,CAAA;AAClB,CAAC;AAED,SAAgB,gBAAgB,CAC9B,QAAkB,EAClB,IAAkB;AAClB,8DAA8D;AAC9D,IAAS,EACT,WAAoB,EACpB,MAAe;IAEf,QAAQ;SACL,SAAS,CAAC,cAAc,EAAE,WAAW,IAAI,kBAAkB,CAAC;SAC5D,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC;SACrB,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAA;IAE7B,IAAI,EAAE,CAAA;AACR,CAAC;AAED,8DAA8D;AAC9D,SAAgB,iBAAiB,CAAkC,OAAU;IAC3E,MAAM,cAAc,GAAG,OAAO,CAAC,cAAc,CAAA;IAC7C,IAAI,CAAC,cAAc;QAAE,MAAM,IAAI,iBAAU,CAAC,0BAA0B,CAAC,CAAA;IAErE,OAAO,cAAc,CAAA;AACvB,CAAC"}
|
|
@@ -31,7 +31,6 @@ async function getAgentContextForActorId(rootAgentContext, actorId) {
|
|
|
31
31
|
* the same agent.
|
|
32
32
|
*/
|
|
33
33
|
async function storeActorIdForContextCorrelationId(agentContext, actorId) {
|
|
34
|
-
var _a;
|
|
35
34
|
// It's kind of hacky, but we add support for the tenants module specifically here to map an actorId to
|
|
36
35
|
// a specific tenant. Otherwise we have to expose /:contextCorrelationId/:actorId in all the public URLs
|
|
37
36
|
// which is of course not so nice.
|
|
@@ -39,7 +38,7 @@ async function storeActorIdForContextCorrelationId(agentContext, actorId) {
|
|
|
39
38
|
// We don't want to query the tenant record if the current context is the root context
|
|
40
39
|
if (tenantsApi && tenantsApi.rootAgentContext.contextCorrelationId !== agentContext.contextCorrelationId) {
|
|
41
40
|
const tenantRecord = await tenantsApi.getTenantById(agentContext.contextCorrelationId);
|
|
42
|
-
const currentOpenId4VcActorIds =
|
|
41
|
+
const currentOpenId4VcActorIds = tenantRecord.metadata.get(OPENID4VC_ACTOR_IDS_METADATA_KEY) ?? [];
|
|
43
42
|
const openId4VcActorIds = [...currentOpenId4VcActorIds, actorId];
|
|
44
43
|
tenantRecord.metadata.set(OPENID4VC_ACTOR_IDS_METADATA_KEY, openId4VcActorIds);
|
|
45
44
|
tenantRecord.setTag(OPENID4VC_ACTOR_IDS_METADATA_KEY, openId4VcActorIds);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tenants.js","sourceRoot":"","sources":["../../../src/shared/router/tenants.ts"],"names":[],"mappings":";;AAOA,8DAmBC;AAYD,kFAiBC;AApDD,yCAAwE;AAExE,MAAM,gCAAgC,GAAG,8BAA8B,CAAA;AAEhE,KAAK,UAAU,yBAAyB,CAAC,gBAA8B,EAAE,OAAe;IAC7F,uFAAuF;IACvF,oFAAoF;IACpF,uFAAuF;IACvF,MAAM,UAAU,GAAG,IAAA,4BAAqB,EAAgB,gBAAgB,EAAE,eAAe,CAAC,CAAA;IAC1F,IAAI,UAAU,EAAE,CAAC;QACf,MAAM,CAAC,MAAM,CAAC,GAAG,MAAM,UAAU,CAAC,kBAAkB,CAAC;YACnD,CAAC,gCAAgC,CAAC,EAAE,CAAC,OAAO,CAAC;SAC9C,CAAC,CAAA;QAEF,IAAI,MAAM,EAAE,CAAC;YACX,MAAM,oBAAoB,GAAG,gBAAgB,CAAC,iBAAiB,CAAC,OAAO,CACrE,uBAAgB,CAAC,oBAAoB,CACtC,CAAA;YACD,OAAO,oBAAoB,CAAC,sCAAsC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;QAC/E,CAAC;IACH,CAAC;IAED,OAAO,gBAAgB,CAAA;AACzB,CAAC;AAED;;;;;;;;;GASG;AACI,KAAK,UAAU,mCAAmC,CAAC,YAA0B,EAAE,OAAe
|
|
1
|
+
{"version":3,"file":"tenants.js","sourceRoot":"","sources":["../../../src/shared/router/tenants.ts"],"names":[],"mappings":";;AAOA,8DAmBC;AAYD,kFAiBC;AApDD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AC,QAAQ,CAAC,GAAG,CAAC,gCAAgC,EAAE,iBAAiB,CAAC,CAAA;QAC9E,YAAY,CAAC,MAAM,CAAC,gCAAgC,EAAE,iBAAiB,CAAC,CAAA;QACxE,MAAM,UAAU,CAAC,YAAY,CAAC,YAAY,CAAC,CAAA;IAC7C,CAAC;AACH,CAAC"}
|
package/build/shared/utils.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type { OpenId4VcIssuerX5c, OpenId4VcJwtIssuer } from './models';
|
|
2
1
|
import type { AgentContext, DidPurpose, JwaSignatureAlgorithm, Key } from '@credo-ts/core';
|
|
3
|
-
import type {
|
|
4
|
-
import
|
|
2
|
+
import type { OpenId4VcIssuerX5c, OpenId4VcJwtIssuer } from './models';
|
|
3
|
+
import { JwtSigner, JwtSignerX5c } from '@openid4vc/oauth2';
|
|
5
4
|
/**
|
|
6
5
|
* Returns the JWA Signature Algorithms that are supported by the wallet.
|
|
7
6
|
*
|
|
@@ -12,11 +11,12 @@ import type { DPoPJwtIssuerWithContext, CreateJwtCallback, JwtIssuer } from '@sp
|
|
|
12
11
|
*/
|
|
13
12
|
export declare function getSupportedJwaSignatureAlgorithms(agentContext: AgentContext): JwaSignatureAlgorithm[];
|
|
14
13
|
export declare function getKeyFromDid(agentContext: AgentContext, didUrl: string, allowedPurposes?: DidPurpose[]): Promise<Key>;
|
|
15
|
-
export declare function getVerifyJwtCallback(agentContext: AgentContext): VerifyJwtCallback;
|
|
16
|
-
export declare function getCreateJwtCallback(agentContext: AgentContext): CreateJwtCallback<DPoPJwtIssuerWithContext | VpJwtIssuerWithContext>;
|
|
17
14
|
export declare function openIdTokenIssuerToJwtIssuer(agentContext: AgentContext, openId4VcTokenIssuer: Exclude<OpenId4VcJwtIssuer, OpenId4VcIssuerX5c> | (OpenId4VcIssuerX5c & {
|
|
18
15
|
issuer: string;
|
|
19
|
-
})): Promise<
|
|
16
|
+
})): Promise<Exclude<JwtSigner, JwtSignerX5c> | (JwtSignerX5c & {
|
|
17
|
+
issuer: string;
|
|
18
|
+
})>;
|
|
20
19
|
export declare function getProofTypeFromKey(agentContext: AgentContext, key: Key): string;
|
|
21
20
|
export declare function addSecondsToDate(date: Date, seconds: number): Date;
|
|
22
21
|
export declare function dateToSeconds(date: Date): number;
|
|
22
|
+
export declare function parseIfJson<T>(input: T): T | Record<string, unknown>;
|
package/build/shared/utils.js
CHANGED
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getSupportedJwaSignatureAlgorithms = getSupportedJwaSignatureAlgorithms;
|
|
4
4
|
exports.getKeyFromDid = getKeyFromDid;
|
|
5
|
-
exports.getVerifyJwtCallback = getVerifyJwtCallback;
|
|
6
|
-
exports.getCreateJwtCallback = getCreateJwtCallback;
|
|
7
5
|
exports.openIdTokenIssuerToJwtIssuer = openIdTokenIssuerToJwtIssuer;
|
|
8
6
|
exports.getProofTypeFromKey = getProofTypeFromKey;
|
|
9
7
|
exports.addSecondsToDate = addSecondsToDate;
|
|
10
8
|
exports.dateToSeconds = dateToSeconds;
|
|
9
|
+
exports.parseIfJson = parseIfJson;
|
|
11
10
|
const core_1 = require("@credo-ts/core");
|
|
12
11
|
/**
|
|
13
12
|
* Returns the JWA Signature Algorithms that are supported by the wallet.
|
|
@@ -35,66 +34,10 @@ async function getKeyFromDid(agentContext, didUrl, allowedPurposes = ['authentic
|
|
|
35
34
|
const verificationMethod = didDocument.dereferenceKey(didUrl, allowedPurposes);
|
|
36
35
|
return (0, core_1.getKeyFromVerificationMethod)(verificationMethod);
|
|
37
36
|
}
|
|
38
|
-
function getVerifyJwtCallback(agentContext) {
|
|
39
|
-
return async (jwtVerifier, jwt) => {
|
|
40
|
-
const jwsService = agentContext.dependencyManager.resolve(core_1.JwsService);
|
|
41
|
-
if (jwtVerifier.method === 'did') {
|
|
42
|
-
const key = await getKeyFromDid(agentContext, jwtVerifier.didUrl);
|
|
43
|
-
const jwk = (0, core_1.getJwkFromKey)(key);
|
|
44
|
-
const res = await jwsService.verifyJws(agentContext, { jws: jwt.raw, jwkResolver: () => jwk });
|
|
45
|
-
return res.isValid;
|
|
46
|
-
}
|
|
47
|
-
else if (jwtVerifier.method === 'x5c' || jwtVerifier.method === 'jwk') {
|
|
48
|
-
const res = await jwsService.verifyJws(agentContext, { jws: jwt.raw });
|
|
49
|
-
return res.isValid;
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
throw new Error(`Unsupported jwt verifier method: '${jwtVerifier.method}'`);
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
function getCreateJwtCallback(agentContext) {
|
|
57
|
-
return async (jwtIssuer, jwt) => {
|
|
58
|
-
const jwsService = agentContext.dependencyManager.resolve(core_1.JwsService);
|
|
59
|
-
if (jwtIssuer.method === 'did') {
|
|
60
|
-
const key = await getKeyFromDid(agentContext, jwtIssuer.didUrl);
|
|
61
|
-
const jws = await jwsService.createJwsCompact(agentContext, {
|
|
62
|
-
protectedHeaderOptions: Object.assign(Object.assign({}, jwt.header), { alg: jwtIssuer.alg, jwk: undefined }),
|
|
63
|
-
payload: core_1.JwtPayload.fromJson(jwt.payload),
|
|
64
|
-
key,
|
|
65
|
-
});
|
|
66
|
-
return jws;
|
|
67
|
-
}
|
|
68
|
-
else if (jwtIssuer.method === 'jwk') {
|
|
69
|
-
if (!jwtIssuer.jwk.kty) {
|
|
70
|
-
throw new core_1.CredoError('Missing required key type (kty) in the jwk.');
|
|
71
|
-
}
|
|
72
|
-
const jwk = (0, core_1.getJwkFromJson)(jwtIssuer.jwk);
|
|
73
|
-
const key = jwk.key;
|
|
74
|
-
const jws = await jwsService.createJwsCompact(agentContext, {
|
|
75
|
-
protectedHeaderOptions: Object.assign(Object.assign({}, jwt.header), { jwk, alg: jwtIssuer.alg }),
|
|
76
|
-
payload: core_1.JwtPayload.fromJson(jwt.payload),
|
|
77
|
-
key,
|
|
78
|
-
});
|
|
79
|
-
return jws;
|
|
80
|
-
}
|
|
81
|
-
else if (jwtIssuer.method === 'x5c') {
|
|
82
|
-
const leafCertificate = core_1.X509Service.getLeafCertificate(agentContext, { certificateChain: jwtIssuer.x5c });
|
|
83
|
-
const jws = await jwsService.createJwsCompact(agentContext, {
|
|
84
|
-
protectedHeaderOptions: Object.assign(Object.assign({}, jwt.header), { alg: jwtIssuer.alg, jwk: undefined }),
|
|
85
|
-
payload: core_1.JwtPayload.fromJson(jwt.payload),
|
|
86
|
-
key: leafCertificate.publicKey,
|
|
87
|
-
});
|
|
88
|
-
return jws;
|
|
89
|
-
}
|
|
90
|
-
throw new Error(`Unsupported jwt issuer method '${jwtIssuer.method}'`);
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
37
|
async function openIdTokenIssuerToJwtIssuer(agentContext, openId4VcTokenIssuer) {
|
|
94
|
-
var _a;
|
|
95
38
|
if (openId4VcTokenIssuer.method === 'did') {
|
|
96
39
|
const key = await getKeyFromDid(agentContext, openId4VcTokenIssuer.didUrl);
|
|
97
|
-
const alg = (
|
|
40
|
+
const alg = (0, core_1.getJwkClassFromKeyType)(key.keyType)?.supportedSignatureAlgorithms[0];
|
|
98
41
|
if (!alg)
|
|
99
42
|
throw new core_1.CredoError(`No supported signature algorithms for key type: ${key.keyType}`);
|
|
100
43
|
return {
|
|
@@ -126,14 +69,21 @@ async function openIdTokenIssuerToJwtIssuer(agentContext, openId4VcTokenIssuer)
|
|
|
126
69
|
: 'there are no SAN-DNS names';
|
|
127
70
|
throw new Error(`The 'iss' claim in the payload does not match a 'SAN-URI' or 'SAN-DNS' name in the x5c certificate. 'iss' value is '${openId4VcTokenIssuer.issuer}', ${sanUriMessage}, ${sanDnsMessage} (for SAN-DNS only domain has to match)`);
|
|
128
71
|
}
|
|
129
|
-
return
|
|
72
|
+
return {
|
|
73
|
+
...openId4VcTokenIssuer,
|
|
74
|
+
alg,
|
|
75
|
+
};
|
|
130
76
|
}
|
|
131
77
|
else if (openId4VcTokenIssuer.method === 'jwk') {
|
|
132
78
|
const alg = openId4VcTokenIssuer.jwk.supportedSignatureAlgorithms[0];
|
|
133
79
|
if (!alg) {
|
|
134
80
|
throw new core_1.CredoError(`No supported signature algorithms for key type: '${openId4VcTokenIssuer.jwk.keyType}'`);
|
|
135
81
|
}
|
|
136
|
-
return
|
|
82
|
+
return {
|
|
83
|
+
...openId4VcTokenIssuer,
|
|
84
|
+
publicJwk: openId4VcTokenIssuer.jwk.toJson(),
|
|
85
|
+
alg,
|
|
86
|
+
};
|
|
137
87
|
}
|
|
138
88
|
throw new core_1.CredoError(`Unsupported jwt issuer method '${openId4VcTokenIssuer.method}'`);
|
|
139
89
|
}
|
|
@@ -151,4 +101,15 @@ function addSecondsToDate(date, seconds) {
|
|
|
151
101
|
function dateToSeconds(date) {
|
|
152
102
|
return Math.floor(date.getTime() / 1000);
|
|
153
103
|
}
|
|
104
|
+
function parseIfJson(input) {
|
|
105
|
+
if (typeof input !== 'string') {
|
|
106
|
+
return input;
|
|
107
|
+
}
|
|
108
|
+
try {
|
|
109
|
+
// Try to parse the string as JSON
|
|
110
|
+
return JSON.parse(input);
|
|
111
|
+
}
|
|
112
|
+
catch (error) { }
|
|
113
|
+
return input;
|
|
114
|
+
}
|
|
154
115
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/shared/utils.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/shared/utils.ts"],"names":[],"mappings":";;AAuBA,gFAaC;AAED,sCAUC;AAED,oEAkEC;AAED,kDASC;AAED,4CAEC;AAED,sCAEC;AAED,kCAWC;AAhJD,yCASuB;AAEvB;;;;;;;GAOG;AACH,SAAgB,kCAAkC,CAAC,YAA0B;IAC3E,MAAM,iBAAiB,GAAG,YAAY,CAAC,MAAM,CAAC,iBAAiB,CAAA;IAE/D,4EAA4E;IAC5E,MAAM,+BAA+B,GA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