@pagopa/io-react-native-wallet 0.2.7 → 0.3.0
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/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/index.d.ts.map +1 -0
- package/lib/typescript/pid/index.d.ts.map +1 -0
- package/lib/typescript/pid/issuing.d.ts.map +1 -0
- package/lib/typescript/{src/pid → pid}/metadata.d.ts.map +1 -1
- package/lib/typescript/pid/sd-jwt/converters.d.ts.map +1 -0
- package/lib/typescript/pid/sd-jwt/index.d.ts.map +1 -0
- package/lib/typescript/pid/sd-jwt/types.d.ts.map +1 -0
- package/lib/typescript/rp/__test__/index.test.d.ts.map +1 -0
- package/lib/typescript/{src/rp → rp}/index.d.ts +8 -8
- package/lib/typescript/rp/index.d.ts.map +1 -0
- package/lib/typescript/rp/types.d.ts +735 -0
- package/lib/typescript/{src/rp → rp}/types.d.ts.map +1 -1
- package/lib/typescript/sd-jwt/__test__/converters.test.d.ts.map +1 -0
- package/lib/typescript/sd-jwt/__test__/index.test.d.ts.map +1 -0
- package/lib/typescript/sd-jwt/__test__/types.test.d.ts.map +1 -0
- package/lib/typescript/sd-jwt/converters.d.ts.map +1 -0
- package/lib/typescript/sd-jwt/index.d.ts.map +1 -0
- package/lib/typescript/sd-jwt/types.d.ts.map +1 -0
- package/lib/typescript/sd-jwt/verifier.d.ts.map +1 -0
- package/lib/typescript/utils/dpop.d.ts.map +1 -0
- package/lib/typescript/utils/errors.d.ts.map +1 -0
- package/lib/typescript/{src/utils → utils}/jwk.d.ts +9 -0
- package/lib/typescript/utils/jwk.d.ts.map +1 -0
- package/lib/typescript/wallet-instance-attestation/index.d.ts.map +1 -0
- package/lib/typescript/wallet-instance-attestation/issuing.d.ts.map +1 -0
- package/lib/typescript/{src/wallet-instance-attestation → wallet-instance-attestation}/types.d.ts +40 -4
- package/lib/typescript/{src/wallet-instance-attestation → 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
- package/lib/typescript/src/index.d.ts.map +0 -1
- package/lib/typescript/src/pid/index.d.ts.map +0 -1
- package/lib/typescript/src/pid/issuing.d.ts.map +0 -1
- package/lib/typescript/src/pid/sd-jwt/converters.d.ts.map +0 -1
- package/lib/typescript/src/pid/sd-jwt/index.d.ts.map +0 -1
- package/lib/typescript/src/pid/sd-jwt/types.d.ts.map +0 -1
- package/lib/typescript/src/rp/__test__/index.test.d.ts.map +0 -1
- package/lib/typescript/src/rp/index.d.ts.map +0 -1
- package/lib/typescript/src/rp/types.d.ts +0 -864
- package/lib/typescript/src/sd-jwt/__test__/converters.test.d.ts.map +0 -1
- package/lib/typescript/src/sd-jwt/__test__/index.test.d.ts.map +0 -1
- package/lib/typescript/src/sd-jwt/__test__/types.test.d.ts.map +0 -1
- package/lib/typescript/src/sd-jwt/converters.d.ts.map +0 -1
- package/lib/typescript/src/sd-jwt/index.d.ts.map +0 -1
- package/lib/typescript/src/sd-jwt/types.d.ts.map +0 -1
- package/lib/typescript/src/sd-jwt/verifier.d.ts.map +0 -1
- package/lib/typescript/src/utils/dpop.d.ts.map +0 -1
- package/lib/typescript/src/utils/errors.d.ts.map +0 -1
- package/lib/typescript/src/utils/jwk.d.ts.map +0 -1
- package/lib/typescript/src/wallet-instance-attestation/index.d.ts.map +0 -1
- package/lib/typescript/src/wallet-instance-attestation/issuing.d.ts.map +0 -1
- /package/lib/typescript/{src/index.d.ts → index.d.ts} +0 -0
- /package/lib/typescript/{src/pid → pid}/index.d.ts +0 -0
- /package/lib/typescript/{src/pid → pid}/issuing.d.ts +0 -0
- /package/lib/typescript/{src/pid → pid}/metadata.d.ts +0 -0
- /package/lib/typescript/{src/pid → pid}/sd-jwt/converters.d.ts +0 -0
- /package/lib/typescript/{src/pid → pid}/sd-jwt/index.d.ts +0 -0
- /package/lib/typescript/{src/pid → pid}/sd-jwt/types.d.ts +0 -0
- /package/lib/typescript/{src/rp → rp}/__test__/index.test.d.ts +0 -0
- /package/lib/typescript/{src/sd-jwt → sd-jwt}/__test__/converters.test.d.ts +0 -0
- /package/lib/typescript/{src/sd-jwt → sd-jwt}/__test__/index.test.d.ts +0 -0
- /package/lib/typescript/{src/sd-jwt → sd-jwt}/__test__/types.test.d.ts +0 -0
- /package/lib/typescript/{src/sd-jwt → sd-jwt}/converters.d.ts +0 -0
- /package/lib/typescript/{src/sd-jwt → sd-jwt}/index.d.ts +0 -0
- /package/lib/typescript/{src/sd-jwt → sd-jwt}/types.d.ts +0 -0
- /package/lib/typescript/{src/sd-jwt → sd-jwt}/verifier.d.ts +0 -0
- /package/lib/typescript/{src/utils → utils}/dpop.d.ts +0 -0
- /package/lib/typescript/{src/utils → utils}/errors.d.ts +0 -0
- /package/lib/typescript/{src/wallet-instance-attestation → wallet-instance-attestation}/index.d.ts +0 -0
- /package/lib/typescript/{src/wallet-instance-attestation → wallet-instance-attestation}/issuing.d.ts +0 -0
package/src/rp/index.ts
CHANGED
|
@@ -77,7 +77,7 @@ export class RelyingPartySolution {
|
|
|
77
77
|
*
|
|
78
78
|
*/
|
|
79
79
|
async getUnsignedWalletInstanceDPoP(
|
|
80
|
-
walletInstanceAttestationJwk:
|
|
80
|
+
walletInstanceAttestationJwk: any,
|
|
81
81
|
authRequestUrl: string
|
|
82
82
|
): Promise<string> {
|
|
83
83
|
return await new SignJWT({
|
|
@@ -109,10 +109,9 @@ export class RelyingPartySolution {
|
|
|
109
109
|
*/
|
|
110
110
|
async getRequestObject(
|
|
111
111
|
signedWalletInstanceDPoP: string,
|
|
112
|
+
requestUri: string,
|
|
112
113
|
entity: RpEntityConfiguration
|
|
113
114
|
): Promise<RequestObject> {
|
|
114
|
-
const decodedJwtDPop = await decodeJwt(signedWalletInstanceDPoP);
|
|
115
|
-
const requestUri = decodedJwtDPop.payload.htu as string;
|
|
116
115
|
const response = await this.appFetch(requestUri, {
|
|
117
116
|
method: "GET",
|
|
118
117
|
headers: {
|
|
@@ -122,13 +121,15 @@ export class RelyingPartySolution {
|
|
|
122
121
|
});
|
|
123
122
|
|
|
124
123
|
if (response.status === 200) {
|
|
125
|
-
const
|
|
126
|
-
const
|
|
124
|
+
const responseJson = await response.json();
|
|
125
|
+
const responseEncodedJwt = responseJson.response;
|
|
126
|
+
|
|
127
|
+
const responseJwt = decodeJwt(responseEncodedJwt);
|
|
127
128
|
|
|
128
129
|
// verify token signature according to RP's entity configuration
|
|
129
130
|
// to ensure the request object is authentic
|
|
130
131
|
{
|
|
131
|
-
const pubKey = entity.payload.jwks.
|
|
132
|
+
const pubKey = entity.payload.metadata.wallet_relying_party.jwks.find(
|
|
132
133
|
({ kid }) => kid === responseJwt.protectedHeader.kid
|
|
133
134
|
);
|
|
134
135
|
if (!pubKey) {
|
|
@@ -136,7 +137,7 @@ export class RelyingPartySolution {
|
|
|
136
137
|
"Request Object signature verification"
|
|
137
138
|
);
|
|
138
139
|
}
|
|
139
|
-
await verify(
|
|
140
|
+
await verify(responseEncodedJwt, pubKey);
|
|
140
141
|
}
|
|
141
142
|
|
|
142
143
|
// parse request object it has the expected shape by specification
|
|
@@ -163,14 +164,18 @@ export class RelyingPartySolution {
|
|
|
163
164
|
* @todo accept more than a Verified Credential
|
|
164
165
|
*
|
|
165
166
|
* @param requestObj The incoming request object, which the requirements for the requested authorization
|
|
167
|
+
* @param walletInstanceIdentifier The identifies of the wallt instance that is presenting
|
|
166
168
|
* @param presentation The Verified Credential containing user data along with the list of claims to be disclosed.
|
|
169
|
+
* @param signKeyId The kid of the key that will be used to sign
|
|
167
170
|
* @returns The unsigned Verified Presentation token
|
|
168
171
|
* @throws {ClaimsNotFoundBetweenDislosures} If the Verified Credential does not contain one or more requested claims.
|
|
169
172
|
*
|
|
170
173
|
*/
|
|
171
174
|
async prepareVpToken(
|
|
172
175
|
requestObj: RequestObject,
|
|
173
|
-
|
|
176
|
+
walletInstanceIdentifier: string,
|
|
177
|
+
[vc, claims]: Presentation, // TODO: [SIW-353] support multiple presentations,
|
|
178
|
+
signKeyId: string
|
|
174
179
|
): Promise<{
|
|
175
180
|
vp_token: string;
|
|
176
181
|
presentation_submission: Record<string, unknown>;
|
|
@@ -180,18 +185,25 @@ export class RelyingPartySolution {
|
|
|
180
185
|
|
|
181
186
|
// TODO: [SIW-359] check all requeste claims of the requestedObj are satisfied
|
|
182
187
|
|
|
183
|
-
const vp_token = new SignJWT({
|
|
188
|
+
const vp_token = new SignJWT({
|
|
189
|
+
vp: vp,
|
|
190
|
+
jti: `${uuid.v4()}`,
|
|
191
|
+
iss: walletInstanceIdentifier,
|
|
192
|
+
nonce: requestObj.payload.nonce,
|
|
193
|
+
})
|
|
184
194
|
.setAudience(requestObj.payload.response_uri)
|
|
195
|
+
.setIssuedAt()
|
|
185
196
|
.setExpirationTime("1h")
|
|
186
197
|
.setProtectedHeader({
|
|
187
198
|
typ: "JWT",
|
|
188
199
|
alg: "ES256",
|
|
200
|
+
kid: signKeyId,
|
|
189
201
|
})
|
|
190
202
|
.toSign();
|
|
191
203
|
|
|
192
|
-
const
|
|
204
|
+
const vc_scope = requestObj.payload.scope;
|
|
193
205
|
const presentation_submission = {
|
|
194
|
-
definition_id
|
|
206
|
+
definition_id: `${uuid.v4()}`,
|
|
195
207
|
id: `${uuid.v4()}`,
|
|
196
208
|
descriptor_map: paths.map((p) => ({
|
|
197
209
|
id: vc_scope,
|
|
@@ -225,94 +237,72 @@ export class RelyingPartySolution {
|
|
|
225
237
|
): Promise<string> {
|
|
226
238
|
// the request is an unsigned jws without iss, aud, exp
|
|
227
239
|
// https://openid.net/specs/openid-4-verifiable-presentations-1_0.html#name-signed-and-encrypted-respon
|
|
228
|
-
const jwk = this.
|
|
229
|
-
const enc = this.getEncryptionAlgByJwk(jwk);
|
|
240
|
+
const jwk = this.chooseRSAPublicKeyToEncrypt(entity);
|
|
230
241
|
|
|
231
242
|
const authzResponsePayload = JSON.stringify({
|
|
232
243
|
state: requestObj.payload.state,
|
|
233
244
|
presentation_submission,
|
|
245
|
+
nonce: requestObj.payload.nonce,
|
|
234
246
|
vp_token,
|
|
235
247
|
});
|
|
248
|
+
|
|
236
249
|
const encrypted = await new EncryptJwe(authzResponsePayload, {
|
|
237
|
-
alg:
|
|
238
|
-
enc,
|
|
250
|
+
alg: "RSA-OAEP-256",
|
|
251
|
+
enc: "A256CBC-HS512",
|
|
252
|
+
kid: jwk.kid,
|
|
239
253
|
}).encrypt(jwk);
|
|
240
254
|
|
|
241
255
|
const formBody = new URLSearchParams({ response: encrypted });
|
|
256
|
+
const body = formBody.toString();
|
|
257
|
+
|
|
242
258
|
const response = await this.appFetch(requestObj.payload.response_uri, {
|
|
243
259
|
method: "POST",
|
|
244
260
|
headers: {
|
|
245
261
|
"Content-Type": "application/x-www-form-urlencoded",
|
|
246
262
|
},
|
|
247
|
-
body
|
|
263
|
+
body,
|
|
248
264
|
});
|
|
249
265
|
|
|
250
266
|
if (response.status === 200) {
|
|
251
|
-
return response.text();
|
|
267
|
+
return await response.text();
|
|
252
268
|
}
|
|
253
269
|
|
|
254
270
|
throw new IoWalletError(
|
|
255
|
-
`Unable to send Authorization Response. Response
|
|
271
|
+
`Unable to send Authorization Response. Response: ${await response.text()} with code: ${
|
|
272
|
+
response.status
|
|
273
|
+
}`
|
|
256
274
|
);
|
|
257
275
|
}
|
|
258
276
|
|
|
259
277
|
/**
|
|
260
|
-
* Select a public key from those provided by the RP.
|
|
261
|
-
* Keys with algorithm "RSA-OAEP-256" or "RSA-OAEP" are expected, the firsts to be preferred.
|
|
278
|
+
* Select a RSA public key from those provided by the RP to encrypt.
|
|
262
279
|
*
|
|
263
280
|
* @param entity The RP entity configuration
|
|
264
281
|
* @returns A suitable public key with its compatible encryption algorithm
|
|
265
282
|
* @throws {NoSuitableKeysFoundInEntityConfiguration} If entity do not contain any public key suitable for encrypting
|
|
266
283
|
*/
|
|
267
|
-
private
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
<T>(k: T & { alg?: string }): k is T & { alg: "RSA-OAEP-256" } =>
|
|
273
|
-
typeof k.alg === "string" && k.alg === "RSA-OAEP-256"
|
|
274
|
-
);
|
|
284
|
+
private chooseRSAPublicKeyToEncrypt(entity: RpEntityConfiguration): JWK {
|
|
285
|
+
const [usingRsa256] =
|
|
286
|
+
entity.payload.metadata.wallet_relying_party.jwks.filter(
|
|
287
|
+
(jwk) => jwk.use === "enc" && jwk.kty === "RSA"
|
|
288
|
+
);
|
|
275
289
|
|
|
276
290
|
if (usingRsa256) {
|
|
277
291
|
return usingRsa256;
|
|
278
292
|
}
|
|
279
293
|
|
|
280
|
-
// Look for keys using "RSA-OAEP", and pick a random one
|
|
281
|
-
const [usingRsa] = entity.payload.jwks.keys.filter(
|
|
282
|
-
<T>(k: T & { alg?: string }): k is T & { alg: "RSA-OAEP" } =>
|
|
283
|
-
typeof k.alg === "string" && k.alg === "RSA-OAEP"
|
|
284
|
-
);
|
|
285
|
-
|
|
286
|
-
if (usingRsa) {
|
|
287
|
-
return usingRsa;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
294
|
// No suitable key has been found
|
|
291
295
|
throw new NoSuitableKeysFoundInEntityConfiguration(
|
|
292
296
|
"Encrypt with RP public key"
|
|
293
297
|
);
|
|
294
298
|
}
|
|
295
299
|
|
|
296
|
-
private getEncryptionAlgByJwk({
|
|
297
|
-
alg,
|
|
298
|
-
}: (JWK & { alg: "RSA-OAEP-256" }) | (JWK & { alg: "RSA-OAEP" })):
|
|
299
|
-
| "A128CBC-HS256"
|
|
300
|
-
| "A256CBC-HS512" {
|
|
301
|
-
if (alg === "RSA-OAEP-256") return "A256CBC-HS512";
|
|
302
|
-
if (alg === "RSA-OAEP") return "A128CBC-HS256";
|
|
303
|
-
|
|
304
|
-
const _: never = alg;
|
|
305
|
-
throw new Error(`Invalid jwk algorithm: ${_}`);
|
|
306
|
-
}
|
|
307
|
-
|
|
308
300
|
/**
|
|
309
301
|
* Obtain the relying party entity configuration.
|
|
310
302
|
*/
|
|
311
303
|
async getEntityConfiguration(): Promise<RpEntityConfiguration> {
|
|
312
|
-
const wellKnownUrl =
|
|
313
|
-
"/.well-known/openid-federation"
|
|
314
|
-
this.relyingPartyBaseUrl
|
|
315
|
-
).href;
|
|
304
|
+
const wellKnownUrl =
|
|
305
|
+
this.relyingPartyBaseUrl + "/.well-known/openid-federation";
|
|
316
306
|
|
|
317
307
|
const response = await this.appFetch(wellKnownUrl, {
|
|
318
308
|
method: "GET",
|
package/src/rp/types.ts
CHANGED
|
@@ -5,7 +5,8 @@ import * as z from "zod";
|
|
|
5
5
|
export type RequestObject = z.infer<typeof RequestObject>;
|
|
6
6
|
export const RequestObject = z.object({
|
|
7
7
|
header: z.object({
|
|
8
|
-
|
|
8
|
+
// FIXME: SIW-421 type field must be either required or omitted, optional isn't useful
|
|
9
|
+
typ: z.literal("JWT").optional(),
|
|
9
10
|
alg: z.string(),
|
|
10
11
|
kid: z.string(),
|
|
11
12
|
trust_chain: z.array(z.string()),
|
|
@@ -46,18 +47,18 @@ export const RpEntityConfiguration = z.object({
|
|
|
46
47
|
application_type: z.string(),
|
|
47
48
|
client_id: z.string(),
|
|
48
49
|
client_name: z.string(),
|
|
49
|
-
jwks: z.
|
|
50
|
-
keys: z.array(JWK),
|
|
51
|
-
}),
|
|
50
|
+
jwks: z.array(JWK),
|
|
52
51
|
contacts: z.array(z.string()),
|
|
53
52
|
}),
|
|
54
|
-
|
|
53
|
+
// FIXME: SIW-422 require federation_metadata field
|
|
54
|
+
// Actual RP implementation does not comply with the spec
|
|
55
|
+
/* federation_entity: z.object({
|
|
55
56
|
organization_name: z.string(),
|
|
56
57
|
homepage_uri: z.string(),
|
|
57
58
|
policy_uri: z.string(),
|
|
58
59
|
logo_uri: z.string(),
|
|
59
60
|
contacts: z.array(z.string()),
|
|
60
|
-
}),
|
|
61
|
+
}), */
|
|
61
62
|
}),
|
|
62
63
|
authority_hints: z.array(z.string()),
|
|
63
64
|
}),
|
|
@@ -65,7 +66,7 @@ export const RpEntityConfiguration = z.object({
|
|
|
65
66
|
|
|
66
67
|
export type QRCodePayload = z.infer<typeof QRCodePayload>;
|
|
67
68
|
export const QRCodePayload = z.object({
|
|
68
|
-
protocol: z.
|
|
69
|
+
protocol: z.string(),
|
|
69
70
|
resource: z.string(), // TODO: refine to known paths using literals
|
|
70
71
|
clientId: z.string(),
|
|
71
72
|
requestURI: z.string(),
|
package/src/utils/jwk.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { removePadding } from "@pagopa/io-react-native-jwt";
|
|
1
2
|
import { z } from "zod";
|
|
2
3
|
|
|
3
4
|
export type JWK = z.infer<typeof JWK>;
|
|
@@ -37,3 +38,23 @@ export const JWK = z.object({
|
|
|
37
38
|
/** JWK "x5u" (X.509 URL) Parameter. */
|
|
38
39
|
x5u: z.string().optional(),
|
|
39
40
|
});
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Ensure key values are encoded using base64url and not just base64, as defined in https://datatracker.ietf.org/doc/html/rfc7517
|
|
44
|
+
*
|
|
45
|
+
* @see https://datatracker.ietf.org/doc/html/rfc7517
|
|
46
|
+
*
|
|
47
|
+
* @param key The key to fix
|
|
48
|
+
* @returns THe same input key with fixed values
|
|
49
|
+
*/
|
|
50
|
+
export function fixBase64EncodingOnKey(key: JWK): JWK {
|
|
51
|
+
const { x, y, e, n, ...pk } = key;
|
|
52
|
+
|
|
53
|
+
return {
|
|
54
|
+
...pk,
|
|
55
|
+
...(x ? { x: removePadding(x) } : {}),
|
|
56
|
+
...(y ? { y: removePadding(y) } : {}),
|
|
57
|
+
...(e ? { e: removePadding(e) } : {}),
|
|
58
|
+
...(n ? { n: removePadding(n) } : {}),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { decode as decodeJwt } from "@pagopa/io-react-native-jwt";
|
|
2
2
|
import { verify as verifyJwt } from "@pagopa/io-react-native-jwt";
|
|
3
3
|
import { SignJWT, thumbprint } from "@pagopa/io-react-native-jwt";
|
|
4
|
-
import { JWK } from "../utils/jwk";
|
|
4
|
+
import { JWK, fixBase64EncodingOnKey } from "../utils/jwk";
|
|
5
5
|
import { WalletInstanceAttestationRequestJwt } from "./types";
|
|
6
6
|
import uuid from "react-native-uuid";
|
|
7
7
|
import { WalletInstanceAttestationIssuingError } from "../utils/errors";
|
|
@@ -38,7 +38,7 @@ export class Issuing {
|
|
|
38
38
|
jti: `${uuid.v4()}`,
|
|
39
39
|
type: "WalletInstanceAttestationRequest",
|
|
40
40
|
cnf: {
|
|
41
|
-
jwk: publicKey,
|
|
41
|
+
jwk: fixBase64EncodingOnKey(publicKey),
|
|
42
42
|
},
|
|
43
43
|
})
|
|
44
44
|
.setProtectedHeader({
|
|
@@ -74,6 +74,7 @@ export class Issuing {
|
|
|
74
74
|
attestationRequest,
|
|
75
75
|
signature
|
|
76
76
|
);
|
|
77
|
+
|
|
77
78
|
const decodedRequest = decodeJwt(signedAttestationRequest);
|
|
78
79
|
const parsedRequest = WalletInstanceAttestationRequestJwt.parse({
|
|
79
80
|
payload: decodedRequest.payload,
|
|
@@ -18,7 +18,11 @@ const Jwt = z.object({
|
|
|
18
18
|
iat: UnixTime,
|
|
19
19
|
exp: UnixTime,
|
|
20
20
|
cnf: z.object({
|
|
21
|
-
jwk:
|
|
21
|
+
jwk: z.intersection(
|
|
22
|
+
JWK,
|
|
23
|
+
// this key requires a kis because it must be referenced for DPoP
|
|
24
|
+
z.object({ kid: z.string() })
|
|
25
|
+
),
|
|
22
26
|
}),
|
|
23
27
|
}),
|
|
24
28
|
});
|
|
@@ -60,7 +64,7 @@ export const WalletInstanceAttestationJwt = z.object({
|
|
|
60
64
|
tos_uri: z.string().url(),
|
|
61
65
|
logo_uri: z.string().url(),
|
|
62
66
|
asc: z.string(),
|
|
63
|
-
authorization_endpoint: z.string()
|
|
67
|
+
authorization_endpoint: z.string(),
|
|
64
68
|
response_types_supported: z.array(z.string()),
|
|
65
69
|
vp_formats_supported: z.object({
|
|
66
70
|
jwt_vp_json: z.object({
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,gCAAgC,CAAC;AAExC,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,MAAM,CAAC;AAC3B,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAC;AACzC,OAAO,KAAK,yBAAyB,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,MAAM,CAAC;AAE5C,OAAO,EACL,GAAG,EACH,EAAE,EACF,yBAAyB,EACzB,MAAM,EACN,eAAe,EACf,oBAAoB,GACrB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/pid/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"issuing.d.ts","sourceRoot":"","sources":["../../../../src/pid/issuing.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAKnC,OAAO,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAC;AAG1D,MAAM,MAAM,OAAO,GAAG;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AACtE,MAAM,MAAM,WAAW,GAAG;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,qBAAa,OAAO;IAClB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,yBAAyB,EAAE,MAAM,CAAC;IAClC,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;gBAG7B,kBAAkB,EAAE,MAAM,EAC1B,qBAAqB,EAAE,MAAM,EAC7B,yBAAyB,EAAE,MAAM,EACjC,QAAQ,EAAE,MAAM,EAChB,QAAQ,GAAE,WAAW,CAAC,OAAO,CAAS;IAYxC;;;;;;;;OAQG;IACG,oBAAoB,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC;IAoCrD;;;;;;;;;OASG;IACG,MAAM,CAAC,iBAAiB,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAwC3E;;;;;;;;OAQG;IACG,eAAe,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC;IAUhD;;;;;;OAMG;IACG,YAAY,IAAI,OAAO,CAAC,aAAa,CAAC;IA4C5C;;;;;;;;OAQG;IACG,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAgB3D;;;;;;;;;;;;;OAaG;IACG,aAAa,CACjB,kBAAkB,EAAE,MAAM,EAC1B,gBAAgB,EAAE,MAAM,EACxB,kBAAkB,EAAE,MAAM,EAC1B,mBAAmB,EAAE,MAAM,EAC3B,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,WAAW,CAAC;IAuCvB;;;;;;OAMG;IACG,sBAAsB,IAAI,OAAO,CAAC,4BAA4B,CAAC;CA2BtE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"converters.d.ts","sourceRoot":"","sources":["../../../../../src/pid/sd-jwt/converters.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,GAAG,EAAE,MAAM,SAAS,CAAC;AAE9B,wBAAgB,YAAY,CAAC,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,GAAG,CAqB5E"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/pid/sd-jwt/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE1D;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,CASlD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAMjE;AAED,MAAM,MAAM,YAAY,GAAG;IAEzB,GAAG,EAAE,GAAG,CAAC;IAET,KAAK,EAAE,QAAQ,CAAC;IAEhB,WAAW,EAAE,UAAU,EAAE,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,YAAY,CAAC;AAExC,OAAO,EAAE,GAAG,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/pid/sd-jwt/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAoBxB;;;;;GAKG;AACH,MAAM,MAAM,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,GAAG,CAAC,CAAC;AACtC,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBd,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../../../src/rp/__test__/index.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/rp/index.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,aAAa,EACb,aAAa,EACb,qBAAqB,EACrB,KAAK,YAAY,EAClB,MAAM,SAAS,CAAC;AAGjB,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kDAAkD,CAAC;AAG5E,qBAAa,oBAAoB;IAC/B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,yBAAyB,EAAE,MAAM,CAAC;IAClC,QAAQ,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;gBAG7B,mBAAmB,EAAE,MAAM,EAC3B,yBAAyB,EAAE,MAAM,EACjC,QAAQ,GAAE,WAAW,CAAC,OAAO,CAAS;IAOxC;;;;;;;OAOG;IACH,MAAM,CAAC,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa;IAqBzD;;;;;;;;;OASG;IACG,6BAA6B,CACjC,4BAA4B,EAAE,GAAG,EACjC,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,MAAM,CAAC;IAiBlB;;;;;;;;;;OAUG;IACG,gBAAgB,CACpB,wBAAwB,EAAE,MAAM,EAChC,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,aAAa,CAAC;IA2CzB;;;;;;;;;;;;;;OAcG;IACG,cAAc,CAClB,UAAU,EAAE,aAAa,EACzB,CAAC,EAAE,EAAE,MAAM,CAAC,EAAE,YAAY,GACzB,OAAO,CAAC;QACT,QAAQ,EAAE,MAAM,CAAC;QACjB,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAClD,CAAC;IA6BF;;;;;;;;;;;;;OAaG;IACG,yBAAyB,CAC7B,UAAU,EAAE,aAAa,EACzB,QAAQ,EAAE,MAAM,EAChB,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChD,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,MAAM,CAAC;IAkClB;;;;;;;OAOG;IACH,OAAO,CAAC,wBAAwB;IA6BhC,OAAO,CAAC,qBAAqB;IAY7B;;OAEG;IACG,sBAAsB,IAAI,OAAO,CAAC,qBAAqB,CAAC;CAuB/D"}
|