@pagopa/io-react-native-wallet 0.2.8 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/commonjs/rp/__test__/index.test.js +145 -0
- package/lib/commonjs/rp/__test__/index.test.js.map +1 -1
- package/lib/commonjs/rp/index.js +33 -41
- package/lib/commonjs/rp/index.js.map +1 -1
- package/lib/commonjs/rp/types.js +11 -9
- package/lib/commonjs/rp/types.js.map +1 -1
- package/lib/commonjs/utils/jwk.js +35 -0
- package/lib/commonjs/utils/jwk.js.map +1 -1
- package/lib/commonjs/wallet-instance-attestation/issuing.js +1 -1
- package/lib/commonjs/wallet-instance-attestation/issuing.js.map +1 -1
- package/lib/commonjs/wallet-instance-attestation/types.js +6 -2
- package/lib/commonjs/wallet-instance-attestation/types.js.map +1 -1
- package/lib/module/rp/__test__/index.test.js +145 -0
- package/lib/module/rp/__test__/index.test.js.map +1 -1
- package/lib/module/rp/index.js +33 -41
- package/lib/module/rp/index.js.map +1 -1
- package/lib/module/rp/types.js +11 -9
- package/lib/module/rp/types.js.map +1 -1
- package/lib/module/utils/jwk.js +34 -0
- package/lib/module/utils/jwk.js.map +1 -1
- package/lib/module/wallet-instance-attestation/issuing.js +2 -2
- package/lib/module/wallet-instance-attestation/issuing.js.map +1 -1
- package/lib/module/wallet-instance-attestation/types.js +6 -2
- package/lib/module/wallet-instance-attestation/types.js.map +1 -1
- package/lib/typescript/rp/index.d.ts +8 -8
- package/lib/typescript/rp/index.d.ts.map +1 -1
- package/lib/typescript/rp/types.d.ts +260 -389
- package/lib/typescript/rp/types.d.ts.map +1 -1
- package/lib/typescript/utils/jwk.d.ts +9 -0
- package/lib/typescript/utils/jwk.d.ts.map +1 -1
- package/lib/typescript/wallet-instance-attestation/issuing.d.ts.map +1 -1
- package/lib/typescript/wallet-instance-attestation/types.d.ts +40 -4
- package/lib/typescript/wallet-instance-attestation/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/rp/__test__/index.test.ts +222 -0
- package/src/rp/index.ts +44 -54
- package/src/rp/types.ts +8 -7
- package/src/utils/jwk.ts +21 -0
- package/src/wallet-instance-attestation/issuing.ts +3 -2
- package/src/wallet-instance-attestation/types.ts +6 -2
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
var _ = require("..");
|
4
4
|
var _errors = require("../../utils/errors");
|
5
|
+
var _types = require("../types");
|
5
6
|
describe("decodeAuthRequestQR", () => {
|
6
7
|
it("should return authentication request URL", async () => {
|
7
8
|
const qrcode = "ZXVkaXc6Ly9hdXRob3JpemU/Y2xpZW50X2lkPWh0dHBzOi8vdmVyaWZpZXIuZXhhbXBsZS5vcmcmcmVxdWVzdF91cmk9aHR0cHM6Ly92ZXJpZmllci5leGFtcGxlLm9yZy9yZXF1ZXN0X3VyaQ==";
|
@@ -13,4 +14,148 @@ describe("decodeAuthRequestQR", () => {
|
|
13
14
|
expect(() => _.RelyingPartySolution.decodeAuthRequestQR(qrcode)).toThrowError(_errors.AuthRequestDecodeError);
|
14
15
|
});
|
15
16
|
});
|
17
|
+
describe("RpEntityConfiguration", () => {
|
18
|
+
it("should parse a valid confdsfashdhasd", async () => {
|
19
|
+
const pp = {
|
20
|
+
header: {
|
21
|
+
alg: "RS256",
|
22
|
+
kid: "9Cquk0X-fNPSdePQIgQcQZtD6J0IjIRrFigW2PPK_-w",
|
23
|
+
typ: "entity-statement+jwt"
|
24
|
+
},
|
25
|
+
payload: {
|
26
|
+
exp: 1692625747,
|
27
|
+
iat: 1692625387,
|
28
|
+
iss: "https://demo.proxy.eudi.wallet.developers.italia.it/OpenID4VP",
|
29
|
+
sub: "https://demo.proxy.eudi.wallet.developers.italia.it/OpenID4VP",
|
30
|
+
jwks: {
|
31
|
+
keys: [{
|
32
|
+
kty: "RSA",
|
33
|
+
kid: "9Cquk0X-fNPSdePQIgQcQZtD6J0IjIRrFigW2PPK_-w",
|
34
|
+
e: "AQAB",
|
35
|
+
n: "utqtxbs-jnK0cPsV7aRkkZKA9t4S-WSZa3nCZtYIKDpgLnR_qcpeF0diJZvKOqXmj2cXaKFUE-8uHKAHo7BL7T-Rj2x3vGESh7SG1pE0thDGlXj4yNsg0qNvCXtk703L2H3i1UXwx6nq1uFxD2EcOE4a6qDYBI16Zl71TUZktJwmOejoHl16CPWqDLGo9GUSk_MmHOV20m4wXWkB4qbvpWVY8H6b2a0rB1B1YPOs5ZLYarSYZgjDEg6DMtZ4NgiwZ-4N1aaLwyO-GLwt9Vf-NBKwoxeRyD3zWE2FXRFBbhKGksMrCGnFDsNl5JTlPjaM3kYyImE941ggcuc495m-Fw"
|
36
|
+
}]
|
37
|
+
},
|
38
|
+
metadata: {
|
39
|
+
wallet_relying_party: {
|
40
|
+
application_type: "web",
|
41
|
+
authorization_encrypted_response_alg: ["RSA-OAEP", "RSA-OAEP-256", "ECDH-ES", "ECDH-ES+A128KW", "ECDH-ES+A192KW", "ECDH-ES+A256KW"],
|
42
|
+
authorization_encrypted_response_enc: ["A128CBC-HS256", "A192CBC-HS384", "A256CBC-HS512", "A128GCM", "A192GCM", "A256GCM"],
|
43
|
+
authorization_signed_response_alg: ["RS256", "RS384", "RS512", "ES256", "ES384", "ES512"],
|
44
|
+
client_id: "https://demo.proxy.eudi.wallet.developers.italia.it/OpenID4VP",
|
45
|
+
client_name: "Name of an example organization",
|
46
|
+
contacts: ["ops@verifier.example.org"],
|
47
|
+
default_acr_values: ["https://www.spid.gov.it/SpidL2", "https://www.spid.gov.it/SpidL3"],
|
48
|
+
default_max_age: 1111,
|
49
|
+
id_token_encrypted_response_alg: ["RSA-OAEP", "RSA-OAEP-256", "ECDH-ES", "ECDH-ES+A128KW", "ECDH-ES+A192KW", "ECDH-ES+A256KW"],
|
50
|
+
id_token_encrypted_response_enc: ["A128CBC-HS256", "A192CBC-HS384", "A256CBC-HS512", "A128GCM", "A192GCM", "A256GCM"],
|
51
|
+
id_token_signed_response_alg: ["RS256", "RS384", "RS512", "ES256", "ES384", "ES512"],
|
52
|
+
presentation_definitions: [{
|
53
|
+
id: "pid-sd-jwt:unique_id+given_name+family_name",
|
54
|
+
input_descriptors: [{
|
55
|
+
id: "pid-sd-jwt:unique_id+given_name+family_name",
|
56
|
+
format: {
|
57
|
+
constraints: {
|
58
|
+
fields: [{
|
59
|
+
filter: {
|
60
|
+
const: "PersonIdentificationData",
|
61
|
+
type: "string"
|
62
|
+
},
|
63
|
+
path: ["$.sd-jwt.type"]
|
64
|
+
}, {
|
65
|
+
filter: {
|
66
|
+
type: "object"
|
67
|
+
},
|
68
|
+
path: ["$.sd-jwt.cnf"]
|
69
|
+
}, {
|
70
|
+
intent_to_retain: "true",
|
71
|
+
path: ["$.sd-jwt.family_name"]
|
72
|
+
}, {
|
73
|
+
intent_to_retain: "true",
|
74
|
+
path: ["$.sd-jwt.given_name"]
|
75
|
+
}, {
|
76
|
+
intent_to_retain: "true",
|
77
|
+
path: ["$.sd-jwt.unique_id"]
|
78
|
+
}],
|
79
|
+
limit_disclosure: "required"
|
80
|
+
},
|
81
|
+
jwt: {
|
82
|
+
alg: ["EdDSA", "ES256"]
|
83
|
+
}
|
84
|
+
}
|
85
|
+
}]
|
86
|
+
}, {
|
87
|
+
id: "mDL-sample-req",
|
88
|
+
input_descriptors: [{
|
89
|
+
format: {
|
90
|
+
constraints: {
|
91
|
+
fields: [{
|
92
|
+
filter: {
|
93
|
+
const: "org.iso.18013.5.1.mDL",
|
94
|
+
type: "string"
|
95
|
+
},
|
96
|
+
path: ["$.mdoc.doctype"]
|
97
|
+
}, {
|
98
|
+
filter: {
|
99
|
+
const: "org.iso.18013.5.1",
|
100
|
+
type: "string"
|
101
|
+
},
|
102
|
+
path: ["$.mdoc.namespace"]
|
103
|
+
}, {
|
104
|
+
intent_to_retain: "false",
|
105
|
+
path: ["$.mdoc.family_name"]
|
106
|
+
}, {
|
107
|
+
intent_to_retain: "false",
|
108
|
+
path: ["$.mdoc.portrait"]
|
109
|
+
}, {
|
110
|
+
intent_to_retain: "false",
|
111
|
+
path: ["$.mdoc.driving_privileges"]
|
112
|
+
}],
|
113
|
+
limit_disclosure: "required"
|
114
|
+
},
|
115
|
+
mso_mdoc: {
|
116
|
+
alg: ["EdDSA", "ES256"]
|
117
|
+
}
|
118
|
+
},
|
119
|
+
id: "mDL"
|
120
|
+
}]
|
121
|
+
}],
|
122
|
+
redirect_uris: ["https://demo.proxy.eudi.wallet.developers.italia.it/OpenID4VP/redirect-uri"],
|
123
|
+
request_uris: ["https://demo.proxy.eudi.wallet.developers.italia.it/OpenID4VP/request-uri"],
|
124
|
+
require_auth_time: true,
|
125
|
+
subject_type: "pairwise",
|
126
|
+
vp_formats: {
|
127
|
+
jwt_vp_json: {
|
128
|
+
alg: ["EdDSA", "ES256K"]
|
129
|
+
}
|
130
|
+
},
|
131
|
+
jwks: [{
|
132
|
+
crv: "P-256",
|
133
|
+
d: "KzQBowMMoPmSZe7G8QsdEWc1IvR2nsgE8qTOYmMcLtc",
|
134
|
+
kid: "dDwPWXz5sCtczj7CJbqgPGJ2qQ83gZ9Sfs-tJyULi6s",
|
135
|
+
use: "sig",
|
136
|
+
kty: "EC",
|
137
|
+
x: "TSO-KOqdnUj5SUuasdlRB2VVFSqtJOxuR5GftUTuBdk",
|
138
|
+
y: "ByWgQt1wGBSnF56jQqLdoO1xKUynMY-BHIDB3eXlR7"
|
139
|
+
}, {
|
140
|
+
kty: "RSA",
|
141
|
+
d: "QUZsh1NqvpueootsdSjFQz-BUvxwd3Qnzm5qNb-WeOsvt3rWMEv0Q8CZrla2tndHTJhwioo1U4NuQey7znijhZ177bUwPPxSW1r68dEnL2U74nKwwoYeeMdEXnUfZSPxzs7nY6b7vtyCoA-AjiVYFOlgKNAItspv1HxeyGCLhLYhKvS_YoTdAeLuegETU5D6K1xGQIuw0nS13Icjz79Y8jC10TX4FdZwdX-NmuIEDP5-s95V9DMENtVqJAVE3L-wO-NdDilyjyOmAbntgsCzYVGH9U3W_djh4t3qVFCv3r0S-DA2FD3THvlrFi655L0QHR3gu_Fbj3b9Ybtajpue_Q",
|
142
|
+
e: "AQAB",
|
143
|
+
use: "enc",
|
144
|
+
kid: "9Cquk0X-fNPSdePQIgQcQZtD6J0IjIRrFigW2PPK_-w",
|
145
|
+
n: "utqtxbs-jnK0cPsV7aRkkZKA9t4S-WSZa3nCZtYIKDpgLnR_qcpeF0diJZvKOqXmj2cXaKFUE-8uHKAHo7BL7T-Rj2x3vGESh7SG1pE0thDGlXj4yNsg0qNvCXtk703L2H3i1UXwx6nq1uFxD2EcOE4a6qDYBI16Zl71TUZktJwmOejoHl16CPWqDLGo9GUSk_MmHOV20m4wXWkB4qbvpWVY8H6b2a0rB1B1YPOs5ZLYarSYZgjDEg6DMtZ4NgiwZ-4N1aaLwyO-GLwt9Vf-NBKwoxeRyD3zWE2FXRFBbhKGksMrCGnFDsNl5JTlPjaM3kYyImE941ggcuc495m-Fw",
|
146
|
+
p: "2zmGXIMCEHPphw778YjVTar1eycih6fFSJ4I4bl1iq167GqO0PjlOx6CZ1-OdBTVU7HfrYRiUK_BnGRdPDn-DQghwwkB79ZdHWL14wXnpB5y-boHz_LxvjsEqXtuQYcIkidOGaMG68XNT1nM4F9a8UKFr5hHYT5_UIQSwsxlRQ0",
|
147
|
+
q: "2jMFt2iFrdaYabdXuB4QMboVjPvbLA-IVb6_0hSG_-EueGBvgcBxdFGIZaG6kqHqlB7qMsSzdptU0vn6IgmCZnX-Hlt6c5X7JB_q91PZMLTO01pbZ2Bk58GloalCHnw_mjPh0YPviH5jGoWM5RHyl_HDDMI-UeLkzP7ImxGizrM"
|
148
|
+
}]
|
149
|
+
}
|
150
|
+
},
|
151
|
+
authority_hints: ["https://demo.federation.eudi.wallet.developers.italia.it"]
|
152
|
+
}
|
153
|
+
};
|
154
|
+
const result = _types.RpEntityConfiguration.safeParse(pp);
|
155
|
+
if (result.success === false) {
|
156
|
+
throw result.error;
|
157
|
+
}
|
158
|
+
expect(result.success).toBe(true);
|
159
|
+
});
|
160
|
+
});
|
16
161
|
//# sourceMappingURL=index.test.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_","require","_errors","describe","it","qrcode","result","RelyingPartySolution","decodeAuthRequestQR","expect","requestURI","toEqual","toThrowError","AuthRequestDecodeError"],"sourceRoot":"../../../../src","sources":["rp/__test__/index.test.ts"],"mappings":";;AAAA,IAAAA,CAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;
|
1
|
+
{"version":3,"names":["_","require","_errors","_types","describe","it","qrcode","result","RelyingPartySolution","decodeAuthRequestQR","expect","requestURI","toEqual","toThrowError","AuthRequestDecodeError","pp","header","alg","kid","typ","payload","exp","iat","iss","sub","jwks","keys","kty","e","n","metadata","wallet_relying_party","application_type","authorization_encrypted_response_alg","authorization_encrypted_response_enc","authorization_signed_response_alg","client_id","client_name","contacts","default_acr_values","default_max_age","id_token_encrypted_response_alg","id_token_encrypted_response_enc","id_token_signed_response_alg","presentation_definitions","id","input_descriptors","format","constraints","fields","filter","const","type","path","intent_to_retain","limit_disclosure","jwt","mso_mdoc","redirect_uris","request_uris","require_auth_time","subject_type","vp_formats","jwt_vp_json","crv","d","use","x","y","p","q","authority_hints","RpEntityConfiguration","safeParse","success","error","toBe"],"sourceRoot":"../../../../src","sources":["rp/__test__/index.test.ts"],"mappings":";;AAAA,IAAAA,CAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEAG,QAAQ,CAAC,qBAAqB,EAAE,MAAM;EACpCC,EAAE,CAAC,0CAA0C,EAAE,YAAY;IACzD,MAAMC,MAAM,GACV,sJAAsJ;IACxJ,MAAMC,MAAM,GAAGC,sBAAoB,CAACC,mBAAmB,CAACH,MAAM,CAAC;IAC/DI,MAAM,CAACH,MAAM,CAACI,UAAU,CAAC,CAACC,OAAO,CAC/B,0CACF,CAAC;EACH,CAAC,CAAC;EACFP,EAAE,CAAC,wCAAwC,EAAE,YAAY;IACvD,MAAMC,MAAM,GAAG,0BAA0B;IACzCI,MAAM,CAAC,MAAMF,sBAAoB,CAACC,mBA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D;MAE9D;IACF,CAAC;IACD,MAAMhE,MAAM,GAAGiE,4BAAqB,CAACC,SAAS,CAAC1D,EAAE,CAAC;IAClD,IAAIR,MAAM,CAACmE,OAAO,KAAK,KAAK,EAAE;MAC5B,MAAMnE,MAAM,CAACoE,KAAK;IACpB;IACAjE,MAAM,CAACH,MAAM,CAACmE,OAAO,CAAC,CAACE,IAAI,CAAC,IAAI,CAAC;EACnC,CAAC,CAAC;AACJ,CAAC,CAAC"}
|
package/lib/commonjs/rp/index.js
CHANGED
@@ -79,9 +79,7 @@ class RelyingPartySolution {
|
|
79
79
|
* @throws {NoSuitableKeysFoundInEntityConfiguration} When the Request Object is signed with a key not listed in RP's entity configuration
|
80
80
|
*
|
81
81
|
*/
|
82
|
-
async getRequestObject(signedWalletInstanceDPoP, entity) {
|
83
|
-
const decodedJwtDPop = await (0, _ioReactNativeJwt.decode)(signedWalletInstanceDPoP);
|
84
|
-
const requestUri = decodedJwtDPop.payload.htu;
|
82
|
+
async getRequestObject(signedWalletInstanceDPoP, requestUri, entity) {
|
85
83
|
const response = await this.appFetch(requestUri, {
|
86
84
|
method: "GET",
|
87
85
|
headers: {
|
@@ -90,13 +88,14 @@ class RelyingPartySolution {
|
|
90
88
|
}
|
91
89
|
});
|
92
90
|
if (response.status === 200) {
|
93
|
-
const
|
94
|
-
const
|
91
|
+
const responseJson = await response.json();
|
92
|
+
const responseEncodedJwt = responseJson.response;
|
93
|
+
const responseJwt = (0, _ioReactNativeJwt.decode)(responseEncodedJwt);
|
95
94
|
|
96
95
|
// verify token signature according to RP's entity configuration
|
97
96
|
// to ensure the request object is authentic
|
98
97
|
{
|
99
|
-
const pubKey = entity.payload.jwks.
|
98
|
+
const pubKey = entity.payload.metadata.wallet_relying_party.jwks.find(_ref => {
|
100
99
|
let {
|
101
100
|
kid
|
102
101
|
} = _ref;
|
@@ -105,7 +104,7 @@ class RelyingPartySolution {
|
|
105
104
|
if (!pubKey) {
|
106
105
|
throw new _errors.NoSuitableKeysFoundInEntityConfiguration("Request Object signature verification");
|
107
106
|
}
|
108
|
-
await (0, _ioReactNativeJwt.verify)(
|
107
|
+
await (0, _ioReactNativeJwt.verify)(responseEncodedJwt, pubKey);
|
109
108
|
}
|
110
109
|
|
111
110
|
// parse request object it has the expected shape by specification
|
@@ -128,12 +127,16 @@ class RelyingPartySolution {
|
|
128
127
|
* @todo accept more than a Verified Credential
|
129
128
|
*
|
130
129
|
* @param requestObj The incoming request object, which the requirements for the requested authorization
|
130
|
+
* @param walletInstanceIdentifier The identifies of the wallt instance that is presenting
|
131
131
|
* @param presentation The Verified Credential containing user data along with the list of claims to be disclosed.
|
132
|
+
* @param signKeyId The kid of the key that will be used to sign
|
132
133
|
* @returns The unsigned Verified Presentation token
|
133
134
|
* @throws {ClaimsNotFoundBetweenDislosures} If the Verified Credential does not contain one or more requested claims.
|
134
135
|
*
|
135
136
|
*/
|
136
|
-
async prepareVpToken(requestObj, _ref2
|
137
|
+
async prepareVpToken(requestObj, walletInstanceIdentifier, _ref2,
|
138
|
+
// TODO: [SIW-353] support multiple presentations,
|
139
|
+
signKeyId) {
|
137
140
|
let [vc, claims] = _ref2;
|
138
141
|
// this throws if vc cannot satisfy all the requested claims
|
139
142
|
const {
|
@@ -144,14 +147,18 @@ class RelyingPartySolution {
|
|
144
147
|
// TODO: [SIW-359] check all requeste claims of the requestedObj are satisfied
|
145
148
|
|
146
149
|
const vp_token = new _ioReactNativeJwt.SignJWT({
|
147
|
-
vp
|
148
|
-
|
150
|
+
vp: vp,
|
151
|
+
jti: `${_reactNativeUuid.default.v4()}`,
|
152
|
+
iss: walletInstanceIdentifier,
|
153
|
+
nonce: requestObj.payload.nonce
|
154
|
+
}).setAudience(requestObj.payload.response_uri).setIssuedAt().setExpirationTime("1h").setProtectedHeader({
|
149
155
|
typ: "JWT",
|
150
|
-
alg: "ES256"
|
156
|
+
alg: "ES256",
|
157
|
+
kid: signKeyId
|
151
158
|
}).toSign();
|
152
|
-
const
|
159
|
+
const vc_scope = requestObj.payload.scope;
|
153
160
|
const presentation_submission = {
|
154
|
-
definition_id
|
161
|
+
definition_id: `${_reactNativeUuid.default.v4()}`,
|
155
162
|
id: `${_reactNativeUuid.default.v4()}`,
|
156
163
|
descriptor_map: paths.map(p => ({
|
157
164
|
id: vc_scope,
|
@@ -182,72 +189,57 @@ class RelyingPartySolution {
|
|
182
189
|
async sendAuthorizationResponse(requestObj, vp_token, presentation_submission, entity) {
|
183
190
|
// the request is an unsigned jws without iss, aud, exp
|
184
191
|
// https://openid.net/specs/openid-4-verifiable-presentations-1_0.html#name-signed-and-encrypted-respon
|
185
|
-
const jwk = this.
|
186
|
-
const enc = this.getEncryptionAlgByJwk(jwk);
|
192
|
+
const jwk = this.chooseRSAPublicKeyToEncrypt(entity);
|
187
193
|
const authzResponsePayload = JSON.stringify({
|
188
194
|
state: requestObj.payload.state,
|
189
195
|
presentation_submission,
|
196
|
+
nonce: requestObj.payload.nonce,
|
190
197
|
vp_token
|
191
198
|
});
|
192
199
|
const encrypted = await new _ioReactNativeJwt.EncryptJwe(authzResponsePayload, {
|
193
|
-
alg:
|
194
|
-
enc
|
200
|
+
alg: "RSA-OAEP-256",
|
201
|
+
enc: "A256CBC-HS512",
|
202
|
+
kid: jwk.kid
|
195
203
|
}).encrypt(jwk);
|
196
204
|
const formBody = new URLSearchParams({
|
197
205
|
response: encrypted
|
198
206
|
});
|
207
|
+
const body = formBody.toString();
|
199
208
|
const response = await this.appFetch(requestObj.payload.response_uri, {
|
200
209
|
method: "POST",
|
201
210
|
headers: {
|
202
211
|
"Content-Type": "application/x-www-form-urlencoded"
|
203
212
|
},
|
204
|
-
body
|
213
|
+
body
|
205
214
|
});
|
206
215
|
if (response.status === 200) {
|
207
|
-
return response.
|
216
|
+
return await response.json();
|
208
217
|
}
|
209
|
-
throw new _errors.IoWalletError(`Unable to send Authorization Response. Response code: ${response.status}`);
|
218
|
+
throw new _errors.IoWalletError(`Unable to send Authorization Response. Response: ${await response.text()} with code: ${response.status}`);
|
210
219
|
}
|
211
220
|
|
212
221
|
/**
|
213
|
-
* Select a public key from those provided by the RP.
|
214
|
-
* Keys with algorithm "RSA-OAEP-256" or "RSA-OAEP" are expected, the firsts to be preferred.
|
222
|
+
* Select a RSA public key from those provided by the RP to encrypt.
|
215
223
|
*
|
216
224
|
* @param entity The RP entity configuration
|
217
225
|
* @returns A suitable public key with its compatible encryption algorithm
|
218
226
|
* @throws {NoSuitableKeysFoundInEntityConfiguration} If entity do not contain any public key suitable for encrypting
|
219
227
|
*/
|
220
|
-
|
221
|
-
|
222
|
-
const [usingRsa256] = entity.payload.jwks.keys.filter(k => typeof k.alg === "string" && k.alg === "RSA-OAEP-256");
|
228
|
+
chooseRSAPublicKeyToEncrypt(entity) {
|
229
|
+
const [usingRsa256] = entity.payload.metadata.wallet_relying_party.jwks.filter(jwk => jwk.use === "enc" && jwk.kty === "RSA");
|
223
230
|
if (usingRsa256) {
|
224
231
|
return usingRsa256;
|
225
232
|
}
|
226
233
|
|
227
|
-
// Look for keys using "RSA-OAEP", and pick a random one
|
228
|
-
const [usingRsa] = entity.payload.jwks.keys.filter(k => typeof k.alg === "string" && k.alg === "RSA-OAEP");
|
229
|
-
if (usingRsa) {
|
230
|
-
return usingRsa;
|
231
|
-
}
|
232
|
-
|
233
234
|
// No suitable key has been found
|
234
235
|
throw new _errors.NoSuitableKeysFoundInEntityConfiguration("Encrypt with RP public key");
|
235
236
|
}
|
236
|
-
getEncryptionAlgByJwk(_ref3) {
|
237
|
-
let {
|
238
|
-
alg
|
239
|
-
} = _ref3;
|
240
|
-
if (alg === "RSA-OAEP-256") return "A256CBC-HS512";
|
241
|
-
if (alg === "RSA-OAEP") return "A128CBC-HS256";
|
242
|
-
const _ = alg;
|
243
|
-
throw new Error(`Invalid jwk algorithm: ${_}`);
|
244
|
-
}
|
245
237
|
|
246
238
|
/**
|
247
239
|
* Obtain the relying party entity configuration.
|
248
240
|
*/
|
249
241
|
async getEntityConfiguration() {
|
250
|
-
const wellKnownUrl =
|
242
|
+
const wellKnownUrl = this.relyingPartyBaseUrl + "/.well-known/openid-federation";
|
251
243
|
const response = await this.appFetch(wellKnownUrl, {
|
252
244
|
method: "GET"
|
253
245
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_errors","require","_ioReactNativeJwt","_types","_reactNativeUuid","_interopRequireDefault","_sdJwt","obj","__esModule","default","RelyingPartySolution","constructor","relyingPartyBaseUrl","walletInstanceAttestation","appFetch","arguments","length","undefined","fetch","decodeAuthRequestQR","qrcode","decoded","decodeBase64","decodedUrl","URL","protocol","resource","hostname","requestURI","searchParams","get","clientId","result","QRCodePayload","safeParse","success","data","AuthRequestDecodeError","error","message","getUnsignedWalletInstanceDPoP","walletInstanceAttestationJwk","authRequestUrl","SignJWT","jti","uuid","v4","htm","htu","ath","sha256ToBase64","setProtectedHeader","alg","jwk","typ","setIssuedAt","setExpirationTime","toSign","getRequestObject","signedWalletInstanceDPoP","entity","
|
1
|
+
{"version":3,"names":["_errors","require","_ioReactNativeJwt","_types","_reactNativeUuid","_interopRequireDefault","_sdJwt","obj","__esModule","default","RelyingPartySolution","constructor","relyingPartyBaseUrl","walletInstanceAttestation","appFetch","arguments","length","undefined","fetch","decodeAuthRequestQR","qrcode","decoded","decodeBase64","decodedUrl","URL","protocol","resource","hostname","requestURI","searchParams","get","clientId","result","QRCodePayload","safeParse","success","data","AuthRequestDecodeError","error","message","getUnsignedWalletInstanceDPoP","walletInstanceAttestationJwk","authRequestUrl","SignJWT","jti","uuid","v4","htm","htu","ath","sha256ToBase64","setProtectedHeader","alg","jwk","typ","setIssuedAt","setExpirationTime","toSign","getRequestObject","signedWalletInstanceDPoP","requestUri","entity","response","method","headers","Authorization","DPoP","status","responseJson","json","responseEncodedJwt","responseJwt","decodeJwt","pubKey","payload","metadata","wallet_relying_party","jwks","find","_ref","kid","protectedHeader","NoSuitableKeysFoundInEntityConfiguration","verify","requestObj","RequestObject","parse","header","IoWalletError","prepareVpToken","walletInstanceIdentifier","_ref2","signKeyId","vc","claims","token","vp","paths","disclose","vp_token","iss","nonce","setAudience","response_uri","vc_scope","scope","presentation_submission","definition_id","id","descriptor_map","map","p","path","format","sendAuthorizationResponse","chooseRSAPublicKeyToEncrypt","authzResponsePayload","JSON","stringify","state","encrypted","EncryptJwe","enc","encrypt","formBody","URLSearchParams","body","toString","text","usingRsa256","filter","use","kty","getEntityConfiguration","wellKnownUrl","responseText","RpEntityConfiguration","exports"],"sourceRoot":"../../../src","sources":["rp/index.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAKA,IAAAC,iBAAA,GAAAD,OAAA;AAQA,IAAAE,MAAA,GAAAF,OAAA;AAOA,IAAAG,gBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAEA,IAAAK,MAAA,GAAAL,OAAA;AAAqC,SAAAI,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAE9B,MAAMG,oBAAoB,CAAC;EAKhCC,WAAWA,CACTC,mBAA2B,EAC3BC,yBAAiC,EAEjC;IAAA,IADAC,QAA8B,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGG,KAAK;IAEtC,IAAI,CAACN,mBAAmB,GAAGA,mBAAmB;IAC9C,IAAI,CAACC,yBAAyB,GAAGA,yBAAyB;IAC1D,IAAI,CAACC,QAAQ,GAAGA,QAAQ;EAC1B;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACE,OAAOK,mBAAmBA,CAACC,MAAc,EAAiB;IACxD,MAAMC,OAAO,GAAG,IAAAC,8BAAY,EAACF,MAAM,CAAC;IACpC,MAAMG,UAAU,GAAG,IAAIC,GAAG,CAACH,OAAO,CAAC;IACnC,MAAMI,QAAQ,GAAGF,UAAU,CAACE,QAAQ;IACpC,MAAMC,QAAQ,GAAGH,UAAU,CAACI,QAAQ;IACpC,MAAM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ACqD,MAAM,CACrD7E,GAAG,IAAKA,GAAG,CAAC8E,GAAG,KAAK,KAAK,IAAI9E,GAAG,CAAC+E,GAAG,KAAK,KAC5C,CAAC;IAEH,IAAIH,WAAW,EAAE;MACf,OAAOA,WAAW;IACpB;;IAEA;IACA,MAAM,IAAI/C,gDAAwC,CAChD,4BACF,CAAC;EACH;;EAEA;AACF;AACA;EACE,MAAMmD,sBAAsBA,CAAA,EAAmC;IAC7D,MAAMC,YAAY,GAChB,IAAI,CAAC1H,mBAAmB,GAAG,gCAAgC;IAE7D,MAAMkD,QAAQ,GAAG,MAAM,IAAI,CAAChD,QAAQ,CAACwH,YAAY,EAAE;MACjDvE,MAAM,EAAE;IACV,CAAC,CAAC;IAEF,IAAID,QAAQ,CAACK,MAAM,KAAK,GAAG,EAAE;MAC3B,MAAMoE,YAAY,GAAG,MAAMzE,QAAQ,CAACkE,IAAI,CAAC,CAAC;MAC1C,MAAMzD,WAAW,GAAG,MAAM,IAAAC,wBAAS,EAAC+D,YAAY,CAAC;MACjD,OAAOC,4BAAqB,CAAClD,KAAK,CAAC;QACjCC,MAAM,EAAEhB,WAAW,CAACU,eAAe;QACnCP,OAAO,EAAEH,WAAW,CAACG;MACvB,CAAC,CAAC;IACJ;IAEA,MAAM,IAAIc,qBAAa,CACpB,4DAA2D1B,QAAQ,CAACK,MAAO,EAC9E,CAAC;EACH;AACF;AAACsE,OAAA,CAAA/H,oBAAA,GAAAA,oBAAA"}
|
package/lib/commonjs/rp/types.js
CHANGED
@@ -11,7 +11,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
11
11
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
12
12
|
const RequestObject = z.object({
|
13
13
|
header: z.object({
|
14
|
-
|
14
|
+
// FIXME: SIW-421 type field must be either required or omitted, optional isn't useful
|
15
|
+
typ: z.literal("JWT").optional(),
|
15
16
|
alg: z.string(),
|
16
17
|
kid: z.string(),
|
17
18
|
trust_chain: z.array(z.string())
|
@@ -52,25 +53,26 @@ const RpEntityConfiguration = z.object({
|
|
52
53
|
application_type: z.string(),
|
53
54
|
client_id: z.string(),
|
54
55
|
client_name: z.string(),
|
55
|
-
jwks: z.
|
56
|
-
keys: z.array(_jwk.JWK)
|
57
|
-
}),
|
56
|
+
jwks: z.array(_jwk.JWK),
|
58
57
|
contacts: z.array(z.string())
|
59
|
-
})
|
60
|
-
|
58
|
+
})
|
59
|
+
// FIXME: SIW-422 require federation_metadata field
|
60
|
+
// Actual RP implementation does not comply with the spec
|
61
|
+
/* federation_entity: z.object({
|
61
62
|
organization_name: z.string(),
|
62
63
|
homepage_uri: z.string(),
|
63
64
|
policy_uri: z.string(),
|
64
65
|
logo_uri: z.string(),
|
65
|
-
contacts: z.array(z.string())
|
66
|
-
})
|
66
|
+
contacts: z.array(z.string()),
|
67
|
+
}), */
|
67
68
|
}),
|
69
|
+
|
68
70
|
authority_hints: z.array(z.string())
|
69
71
|
})
|
70
72
|
});
|
71
73
|
exports.RpEntityConfiguration = RpEntityConfiguration;
|
72
74
|
const QRCodePayload = z.object({
|
73
|
-
protocol: z.
|
75
|
+
protocol: z.string(),
|
74
76
|
resource: z.string(),
|
75
77
|
// TODO: refine to known paths using literals
|
76
78
|
clientId: z.string(),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_jwk","require","_types","z","_interopRequireWildcard","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","RequestObject","object","header","typ","literal","alg","string","kid","trust_chain","array","payload","iss","iat","UnixTime","exp","state","nonce","response_uri","response_type","response_mode","client_id","client_id_scheme","scope","exports","RpEntityConfiguration","sub","jwks","keys","JWK","metadata","wallet_relying_party","application_type","client_name","contacts","
|
1
|
+
{"version":3,"names":["_jwk","require","_types","z","_interopRequireWildcard","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","RequestObject","object","header","typ","literal","optional","alg","string","kid","trust_chain","array","payload","iss","iat","UnixTime","exp","state","nonce","response_uri","response_type","response_mode","client_id","client_id_scheme","scope","exports","RpEntityConfiguration","sub","jwks","keys","JWK","metadata","wallet_relying_party","application_type","client_name","contacts","authority_hints","QRCodePayload","protocol","resource","clientId","requestURI"],"sourceRoot":"../../../src","sources":["rp/types.ts"],"mappings":";;;;;;AAAA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,CAAA,GAAAC,uBAAA,CAAAH,OAAA;AAAyB,SAAAI,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAF,wBAAAM,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAA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AAC,CAACyB,MAAM,CAAC;MACjB8B,oBAAoB,EAAEvD,CAAC,CAACyB,MAAM,CAAC;QAC7B+B,gBAAgB,EAAExD,CAAC,CAAC+B,MAAM,CAAC,CAAC;QAC5Bc,SAAS,EAAE7C,CAAC,CAAC+B,MAAM,CAAC,CAAC;QACrB0B,WAAW,EAAEzD,CAAC,CAAC+B,MAAM,CAAC,CAAC;QACvBoB,IAAI,EAAEnD,CAAC,CAACkC,KAAK,CAACmB,QAAG,CAAC;QAClBK,QAAQ,EAAE1D,CAAC,CAACkC,KAAK,CAAClC,CAAC,CAAC+B,MAAM,CAAC,CAAC;MAC9B,CAAC;MACD;MACA;MACA;AACN;AACA;AACA;AACA;AACA;AACA;IACI,CAAC,CAAC;;IACF4B,eAAe,EAAE3D,CAAC,CAACkC,KAAK,CAAClC,CAAC,CAAC+B,MAAM,CAAC,CAAC;EACrC,CAAC;AACH,CAAC,CAAC;AAACiB,OAAA,CAAAC,qBAAA,GAAAA,qBAAA;AAGI,MAAMW,aAAa,GAAG5D,CAAC,CAACyB,MAAM,CAAC;EACpCoC,QAAQ,EAAE7D,CAAC,CAAC+B,MAAM,CAAC,CAAC;EACpB+B,QAAQ,EAAE9D,CAAC,CAAC+B,MAAM,CAAC,CAAC;EAAE;EACtBgC,QAAQ,EAAE/D,CAAC,CAAC+B,MAAM,CAAC,CAAC;EACpBiC,UAAU,EAAEhE,CAAC,CAAC+B,MAAM,CAAC;AACvB,CAAC,CAAC;;AAEF;AACA;AACA;AAFAiB,OAAA,CAAAY,aAAA,GAAAA,aAAA"}
|
@@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.JWK = void 0;
|
7
|
+
exports.fixBase64EncodingOnKey = fixBase64EncodingOnKey;
|
8
|
+
var _ioReactNativeJwt = require("@pagopa/io-react-native-jwt");
|
7
9
|
var _zod = require("zod");
|
8
10
|
const JWK = _zod.z.object({
|
9
11
|
/** JWK "alg" (Algorithm) Parameter. */
|
@@ -41,5 +43,38 @@ const JWK = _zod.z.object({
|
|
41
43
|
/** JWK "x5u" (X.509 URL) Parameter. */
|
42
44
|
x5u: _zod.z.string().optional()
|
43
45
|
});
|
46
|
+
|
47
|
+
/**
|
48
|
+
* Ensure key values are encoded using base64url and not just base64, as defined in https://datatracker.ietf.org/doc/html/rfc7517
|
49
|
+
*
|
50
|
+
* @see https://datatracker.ietf.org/doc/html/rfc7517
|
51
|
+
*
|
52
|
+
* @param key The key to fix
|
53
|
+
* @returns THe same input key with fixed values
|
54
|
+
*/
|
44
55
|
exports.JWK = JWK;
|
56
|
+
function fixBase64EncodingOnKey(key) {
|
57
|
+
const {
|
58
|
+
x,
|
59
|
+
y,
|
60
|
+
e,
|
61
|
+
n,
|
62
|
+
...pk
|
63
|
+
} = key;
|
64
|
+
return {
|
65
|
+
...pk,
|
66
|
+
...(x ? {
|
67
|
+
x: (0, _ioReactNativeJwt.removePadding)(x)
|
68
|
+
} : {}),
|
69
|
+
...(y ? {
|
70
|
+
y: (0, _ioReactNativeJwt.removePadding)(y)
|
71
|
+
} : {}),
|
72
|
+
...(e ? {
|
73
|
+
e: (0, _ioReactNativeJwt.removePadding)(e)
|
74
|
+
} : {}),
|
75
|
+
...(n ? {
|
76
|
+
n: (0, _ioReactNativeJwt.removePadding)(n)
|
77
|
+
} : {})
|
78
|
+
};
|
79
|
+
}
|
45
80
|
//# sourceMappingURL=jwk.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["
|
1
|
+
{"version":3,"names":["_ioReactNativeJwt","require","_zod","JWK","z","object","alg","string","optional","crv","d","dp","dq","e","ext","boolean","k","key_ops","array","kid","kty","union","literal","n","p","q","qi","use","x","y","x5c","x5t","x5u","exports","fixBase64EncodingOnKey","key","pk","removePadding"],"sourceRoot":"../../../src","sources":["utils/jwk.ts"],"mappings":";;;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAA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AC,EAAE,IAAAwB,+BAAa,EAACxB,CAAC;IAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACrC,IAAIU,CAAC,GAAG;MAAEA,CAAC,EAAE,IAAAc,+BAAa,EAACd,CAAC;IAAE,CAAC,GAAG,CAAC,CAAC;EACtC,CAAC;AACH"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_ioReactNativeJwt","require","_jwk","_types","_reactNativeUuid","_interopRequireDefault","_errors","obj","__esModule","default","Issuing","constructor","walletProviderBaseUrl","appFetch","arguments","length","undefined","fetch","getAttestationRequestToSign","jwk","parsedJwk","JWK","parse","keyThumbprint","thumbprint","publicKey","kid","walletInstanceAttestationRequest","SignJWT","iss","sub","jti","uuid","v4","type","cnf","setProtectedHeader","alg","typ","setIssuedAt","setExpirationTime","toSign","getAttestation","attestationRequest","signature","signedAttestationRequest","appendSignature","decodedRequest","decodeJwt","parsedRequest","WalletInstanceAttestationRequestJwt","payload","header","protectedHeader","verifyJwt","tokenUrl","URL","href","requestBody","grant_type","assertion","response","method","headers","body","JSON","stringify","status","text","WalletInstanceAttestationIssuingError","exports"],"sourceRoot":"../../../src","sources":["wallet-instance-attestation/issuing.ts"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAGA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAAwE,SAAAI,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAEjE,MAAMG,OAAO,CAAC;EAGnBC,WAAWA,CACTC,qBAA6B,EAE7B;IAAA,IADAC,QAA8B,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGG,KAAK;IAEtC,IAAI,CAACL,qBAAqB,GAAGA,qBAAqB;IAClD,IAAI,CAACC,QAAQ,GAAGA,QAAQ;EAC1B;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,MAAMK,2BAA2BA,CAACC,GAAQ,EAAmB;IAC3D,MAAMC,SAAS,GAAGC,QAAG,CAACC,KAAK,CAACH,GAAG,CAAC;IAChC,MAAMI,aAAa,GAAG,MAAM,IAAAC,4BAAU,EAACJ,SAAS,CAAC;IACjD,MAAMK,SAAS,GAAG;MAAE,GAAGL,SAAS;MAAEM,GAAG,EAAEH;IAAc,CAAC;IAEtD,MAAMI,gCAAgC,GAAG,IAAIC,yBAAO,CAAC;MACnDC,GAAG,EAAEN,aAAa;MAClBO,GAAG,EAAE,IAAI,CAAClB,qBAAqB;MAC/BmB,GAAG,EAAG,GAAEC,wBAAI,CAACC,EAAE,CAAC,CAAE,EAAC;MACnBC,IAAI,EAAE,kCAAkC;MACxCC,GAAG,EAAE;QACHhB,GAAG,
|
1
|
+
{"version":3,"names":["_ioReactNativeJwt","require","_jwk","_types","_reactNativeUuid","_interopRequireDefault","_errors","obj","__esModule","default","Issuing","constructor","walletProviderBaseUrl","appFetch","arguments","length","undefined","fetch","getAttestationRequestToSign","jwk","parsedJwk","JWK","parse","keyThumbprint","thumbprint","publicKey","kid","walletInstanceAttestationRequest","SignJWT","iss","sub","jti","uuid","v4","type","cnf","fixBase64EncodingOnKey","setProtectedHeader","alg","typ","setIssuedAt","setExpirationTime","toSign","getAttestation","attestationRequest","signature","signedAttestationRequest","appendSignature","decodedRequest","decodeJwt","parsedRequest","WalletInstanceAttestationRequestJwt","payload","header","protectedHeader","verifyJwt","tokenUrl","URL","href","requestBody","grant_type","assertion","response","method","headers","body","JSON","stringify","status","text","WalletInstanceAttestationIssuingError","exports"],"sourceRoot":"../../../src","sources":["wallet-instance-attestation/issuing.ts"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAGA,IAAAC,IAAA,GAAAD,OAAA;AACA,I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ACG,OAAA,CAAA7D,OAAA,GAAAA,OAAA"}
|
@@ -23,7 +23,11 @@ const Jwt = z.object({
|
|
23
23
|
iat: UnixTime,
|
24
24
|
exp: UnixTime,
|
25
25
|
cnf: z.object({
|
26
|
-
jwk: _jwk.JWK
|
26
|
+
jwk: z.intersection(_jwk.JWK,
|
27
|
+
// this key requires a kis because it must be referenced for DPoP
|
28
|
+
z.object({
|
29
|
+
kid: z.string()
|
30
|
+
}))
|
27
31
|
})
|
28
32
|
})
|
29
33
|
});
|
@@ -47,7 +51,7 @@ const WalletInstanceAttestationJwt = z.object({
|
|
47
51
|
tos_uri: z.string().url(),
|
48
52
|
logo_uri: z.string().url(),
|
49
53
|
asc: z.string(),
|
50
|
-
authorization_endpoint: z.string()
|
54
|
+
authorization_endpoint: z.string(),
|
51
55
|
response_types_supported: z.array(z.string()),
|
52
56
|
vp_formats_supported: z.object({
|
53
57
|
jwt_vp_json: z.object({
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_jwk","require","z","_interopRequireWildcard","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","UnixTime","number","min","max","Jwt","object","header","alg","string","kid","typ","x5c","array","optional","trust_chain","payload","iss","sub","iat","exp","cnf","jwk","
|
1
|
+
{"version":3,"names":["_jwk","require","z","_interopRequireWildcard","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","UnixTime","number","min","max","Jwt","object","header","alg","string","kid","typ","x5c","array","optional","trust_chain","payload","iss","sub","iat","exp","cnf","jwk","intersection","JWK","WalletInstanceAttestationRequestJwt","shape","literal","jti","type","exports","WalletInstanceAttestationJwt","policy_uri","url","tos_uri","logo_uri","asc","authorization_endpoint","response_types_supported","vp_formats_supported","jwt_vp_json","alg_values_supported","jwt_vc_json","request_object_signing_alg_values_supported","presentation_definition_uri_supported","boolean"],"sourceRoot":"../../../src","sources":["wallet-instance-attestation/types.ts"],"mappings":";;;;;;AAAA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,CAAA,GAAAC,uBAAA,CAAAF,OAAA;AAAyB,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAF,wBAAAM,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAX,GAAA,QAAAW,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAd,GAAA,EAAAW,GAAA,SAAAI,IAAA,GAAAR,qBAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAV,GAAA,EAAAW,GAAA,cAAAI,IAAA,KAAAA,IAAA,CAAAV,GAAA,IAAAU,IAAA,CAAAC,GAAA,KAAAR,MAAA,CAAAC,cAAA,CAAAH,MAAA,EAAAK,GAAA,EAAAI,IAAA,YAAAT,MAAA,CAAAK,GAAA,IAAAX,GAAA,CAAAW,GAAA,SAAAL,MA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