@pagopa/io-react-native-wallet 0.12.0 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/commonjs/client/generated/wallet-provider.js +22 -22
- package/lib/commonjs/client/generated/wallet-provider.js.map +1 -1
- package/lib/commonjs/client/index.js +1 -2
- package/lib/commonjs/client/index.js.map +1 -1
- package/lib/commonjs/credential/issuance/02-evaluate-issuer-trust.js +2 -1
- package/lib/commonjs/credential/issuance/02-evaluate-issuer-trust.js.map +1 -1
- package/lib/commonjs/credential/issuance/03-start-credential-issuance.js +287 -0
- package/lib/commonjs/credential/issuance/03-start-credential-issuance.js.map +1 -0
- package/lib/commonjs/credential/issuance/03-start-user-authorization.js +56 -83
- package/lib/commonjs/credential/issuance/03-start-user-authorization.js.map +1 -1
- package/lib/commonjs/credential/issuance/04-complete-user-authorization.js +88 -0
- package/lib/commonjs/credential/issuance/04-complete-user-authorization.js.map +1 -1
- package/lib/commonjs/credential/issuance/05-authorize-access.js +56 -33
- package/lib/commonjs/credential/issuance/05-authorize-access.js.map +1 -1
- package/lib/commonjs/credential/issuance/06-obtain-credential.js +51 -78
- package/lib/commonjs/credential/issuance/06-obtain-credential.js.map +1 -1
- package/lib/commonjs/credential/issuance/07-verify-and-parse-credential.js +21 -44
- package/lib/commonjs/credential/issuance/07-verify-and-parse-credential.js.map +1 -1
- package/lib/commonjs/credential/issuance/index.js +7 -0
- package/lib/commonjs/credential/issuance/index.js.map +1 -1
- package/lib/commonjs/credential/issuance/types.js +28 -0
- package/lib/commonjs/credential/issuance/types.js.map +1 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/pid/sd-jwt/converters.js +5 -9
- package/lib/commonjs/pid/sd-jwt/converters.js.map +1 -1
- package/lib/commonjs/pid/sd-jwt/types.js +3 -3
- package/lib/commonjs/pid/sd-jwt/types.js.map +1 -1
- package/lib/commonjs/sd-jwt/__test__/converters.test.js +1 -1
- package/lib/commonjs/sd-jwt/__test__/converters.test.js.map +1 -1
- package/lib/commonjs/sd-jwt/__test__/index.test.js +30 -43
- package/lib/commonjs/sd-jwt/__test__/index.test.js.map +1 -1
- package/lib/commonjs/sd-jwt/__test__/types.test.js +16 -24
- package/lib/commonjs/sd-jwt/__test__/types.test.js.map +1 -1
- package/lib/commonjs/sd-jwt/index.js +3 -9
- package/lib/commonjs/sd-jwt/index.js.map +1 -1
- package/lib/commonjs/sd-jwt/types.js +11 -16
- package/lib/commonjs/sd-jwt/types.js.map +1 -1
- package/lib/commonjs/trust/types.js +70 -29
- package/lib/commonjs/trust/types.js.map +1 -1
- package/lib/commonjs/utils/auth.js +44 -0
- package/lib/commonjs/utils/auth.js.map +1 -0
- package/lib/commonjs/utils/errors.js +77 -2
- package/lib/commonjs/utils/errors.js.map +1 -1
- package/lib/commonjs/utils/misc.js +34 -1
- package/lib/commonjs/utils/misc.js.map +1 -1
- package/lib/commonjs/utils/par.js +23 -15
- package/lib/commonjs/utils/par.js.map +1 -1
- package/lib/commonjs/utils/pop.js +33 -0
- package/lib/commonjs/utils/pop.js.map +1 -0
- package/lib/commonjs/wallet-instance-attestation/issuing.js +17 -2
- package/lib/commonjs/wallet-instance-attestation/issuing.js.map +1 -1
- package/lib/commonjs/wallet-instance-attestation/types.js +7 -7
- package/lib/commonjs/wallet-instance-attestation/types.js.map +1 -1
- package/lib/module/client/generated/wallet-provider.js +16 -19
- package/lib/module/client/generated/wallet-provider.js.map +1 -1
- package/lib/module/client/index.js +1 -2
- package/lib/module/client/index.js.map +1 -1
- package/lib/module/credential/issuance/02-evaluate-issuer-trust.js +2 -1
- package/lib/module/credential/issuance/02-evaluate-issuer-trust.js.map +1 -1
- package/lib/module/credential/issuance/03-start-credential-issuance.js +276 -0
- package/lib/module/credential/issuance/03-start-credential-issuance.js.map +1 -0
- package/lib/module/credential/issuance/03-start-user-authorization.js +56 -80
- package/lib/module/credential/issuance/03-start-user-authorization.js.map +1 -1
- package/lib/module/credential/issuance/04-complete-user-authorization.js +85 -1
- package/lib/module/credential/issuance/04-complete-user-authorization.js.map +1 -1
- package/lib/module/credential/issuance/05-authorize-access.js +54 -33
- package/lib/module/credential/issuance/05-authorize-access.js.map +1 -1
- package/lib/module/credential/issuance/06-obtain-credential.js +50 -75
- package/lib/module/credential/issuance/06-obtain-credential.js.map +1 -1
- package/lib/module/credential/issuance/07-verify-and-parse-credential.js +21 -44
- package/lib/module/credential/issuance/07-verify-and-parse-credential.js.map +1 -1
- package/lib/module/credential/issuance/index.js +2 -1
- package/lib/module/credential/issuance/index.js.map +1 -1
- package/lib/module/credential/issuance/types.js +18 -0
- package/lib/module/credential/issuance/types.js.map +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/pid/sd-jwt/converters.js +5 -9
- package/lib/module/pid/sd-jwt/converters.js.map +1 -1
- package/lib/module/pid/sd-jwt/types.js +3 -3
- package/lib/module/pid/sd-jwt/types.js.map +1 -1
- package/lib/module/sd-jwt/__test__/converters.test.js +1 -1
- package/lib/module/sd-jwt/__test__/converters.test.js.map +1 -1
- package/lib/module/sd-jwt/__test__/index.test.js +30 -43
- package/lib/module/sd-jwt/__test__/index.test.js.map +1 -1
- package/lib/module/sd-jwt/__test__/types.test.js +16 -24
- package/lib/module/sd-jwt/__test__/types.test.js.map +1 -1
- package/lib/module/sd-jwt/index.js +3 -9
- package/lib/module/sd-jwt/index.js.map +1 -1
- package/lib/module/sd-jwt/types.js +11 -16
- package/lib/module/sd-jwt/types.js.map +1 -1
- package/lib/module/sd-jwt/verifier.js.map +1 -1
- package/lib/module/trust/types.js +70 -29
- package/lib/module/trust/types.js.map +1 -1
- package/lib/module/utils/auth.js +35 -0
- package/lib/module/utils/auth.js.map +1 -0
- package/lib/module/utils/errors.js +71 -0
- package/lib/module/utils/errors.js.map +1 -1
- package/lib/module/utils/misc.js +31 -0
- package/lib/module/utils/misc.js.map +1 -1
- package/lib/module/utils/par.js +24 -16
- package/lib/module/utils/par.js.map +1 -1
- package/lib/module/utils/pop.js +24 -0
- package/lib/module/utils/pop.js.map +1 -0
- package/lib/module/wallet-instance-attestation/issuing.js +17 -2
- package/lib/module/wallet-instance-attestation/issuing.js.map +1 -1
- package/lib/module/wallet-instance-attestation/types.js +7 -7
- package/lib/module/wallet-instance-attestation/types.js.map +1 -1
- package/lib/typescript/client/generated/wallet-provider.d.ts +35 -13
- package/lib/typescript/client/generated/wallet-provider.d.ts.map +1 -1
- package/lib/typescript/client/index.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/01-start-flow.d.ts +1 -0
- package/lib/typescript/credential/issuance/01-start-flow.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/02-evaluate-issuer-trust.d.ts +2 -1
- package/lib/typescript/credential/issuance/02-evaluate-issuer-trust.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/03-start-credential-issuance.d.ts +41 -0
- package/lib/typescript/credential/issuance/03-start-credential-issuance.d.ts.map +1 -0
- package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts +23 -18
- package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts +24 -12
- package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/05-authorize-access.d.ts +22 -16
- package/lib/typescript/credential/issuance/05-authorize-access.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/06-obtain-credential.d.ts +19 -26
- package/lib/typescript/credential/issuance/06-obtain-credential.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/07-verify-and-parse-credential.d.ts +10 -15
- package/lib/typescript/credential/issuance/07-verify-and-parse-credential.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/index.d.ts +3 -4
- package/lib/typescript/credential/issuance/index.d.ts.map +1 -1
- package/lib/typescript/credential/issuance/types.d.ts +63 -0
- package/lib/typescript/credential/issuance/types.d.ts.map +1 -0
- package/lib/typescript/credential/presentation/types.d.ts +6 -6
- package/lib/typescript/index.d.ts +2 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/pid/sd-jwt/converters.d.ts.map +1 -1
- package/lib/typescript/pid/sd-jwt/types.d.ts +36 -36
- package/lib/typescript/pid/sd-jwt/types.d.ts.map +1 -1
- package/lib/typescript/sd-jwt/index.d.ts +40 -68
- package/lib/typescript/sd-jwt/index.d.ts.map +1 -1
- package/lib/typescript/sd-jwt/types.d.ts +64 -121
- package/lib/typescript/sd-jwt/types.d.ts.map +1 -1
- package/lib/typescript/trust/index.d.ts +150 -48
- package/lib/typescript/trust/index.d.ts.map +1 -1
- package/lib/typescript/trust/types.d.ts +2838 -1740
- package/lib/typescript/trust/types.d.ts.map +1 -1
- package/lib/typescript/utils/auth.d.ts +52 -0
- package/lib/typescript/utils/auth.d.ts.map +1 -0
- package/lib/typescript/utils/errors.d.ts +36 -1
- package/lib/typescript/utils/errors.d.ts.map +1 -1
- package/lib/typescript/utils/integrity.d.ts +1 -1
- package/lib/typescript/utils/misc.d.ts +18 -0
- package/lib/typescript/utils/misc.d.ts.map +1 -1
- package/lib/typescript/utils/par.d.ts +8 -31
- package/lib/typescript/utils/par.d.ts.map +1 -1
- package/lib/typescript/utils/pop.d.ts +26 -0
- package/lib/typescript/utils/pop.d.ts.map +1 -0
- package/lib/typescript/wallet-instance-attestation/issuing.d.ts +2 -1
- package/lib/typescript/wallet-instance-attestation/issuing.d.ts.map +1 -1
- package/lib/typescript/wallet-instance-attestation/types.d.ts +59 -59
- package/lib/typescript/wallet-instance-attestation/types.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/client/generated/wallet-provider.ts +24 -21
- package/src/client/index.ts +3 -8
- package/src/credential/issuance/01-start-flow.ts +1 -0
- package/src/credential/issuance/02-evaluate-issuer-trust.ts +2 -1
- package/src/credential/issuance/03-start-credential-issuance.ts +407 -0
- package/src/credential/issuance/03-start-user-authorization.ts +91 -92
- package/src/credential/issuance/04-complete-user-authorization.ts +114 -13
- package/src/credential/issuance/05-authorize-access.ts +74 -49
- package/src/credential/issuance/06-obtain-credential.ts +77 -111
- package/src/credential/issuance/07-verify-and-parse-credential.ts +30 -67
- package/src/credential/issuance/index.ts +6 -4
- package/src/credential/issuance/types.ts +25 -0
- package/src/index.ts +2 -1
- package/src/pid/sd-jwt/converters.ts +5 -11
- package/src/pid/sd-jwt/types.ts +8 -6
- package/src/sd-jwt/__test__/converters.test.ts +1 -1
- package/src/sd-jwt/__test__/index.test.ts +45 -74
- package/src/sd-jwt/__test__/types.test.ts +21 -33
- package/src/sd-jwt/index.ts +3 -12
- package/src/sd-jwt/types.ts +17 -22
- package/src/trust/types.ts +64 -32
- package/src/utils/auth.ts +37 -0
- package/src/utils/errors.ts +85 -1
- package/src/utils/integrity.ts +1 -1
- package/src/utils/misc.ts +43 -0
- package/src/utils/par.ts +29 -17
- package/src/utils/pop.ts +34 -0
- package/src/wallet-instance-attestation/issuing.ts +39 -2
- package/src/wallet-instance-attestation/types.ts +11 -7
- package/lib/commonjs/credential/issuance/07-confirm-credential.js +0 -6
- package/lib/commonjs/credential/issuance/07-confirm-credential.js.map +0 -1
- package/lib/commonjs/credential/issuance/08-confirm-credential.js +0 -6
- package/lib/commonjs/credential/issuance/08-confirm-credential.js.map +0 -1
- package/lib/module/credential/issuance/07-confirm-credential.js +0 -2
- package/lib/module/credential/issuance/07-confirm-credential.js.map +0 -1
- package/lib/module/credential/issuance/08-confirm-credential.js +0 -2
- package/lib/module/credential/issuance/08-confirm-credential.js.map +0 -1
- package/lib/typescript/credential/issuance/07-confirm-credential.d.ts +0 -11
- package/lib/typescript/credential/issuance/07-confirm-credential.d.ts.map +0 -1
- package/lib/typescript/credential/issuance/08-confirm-credential.d.ts +0 -11
- package/lib/typescript/credential/issuance/08-confirm-credential.d.ts.map +0 -1
- package/src/credential/issuance/07-confirm-credential.ts +0 -14
- package/src/credential/issuance/08-confirm-credential.ts +0 -14
- package/src/sd-jwt/__test__/converters.test.js +0 -24
- package/src/sd-jwt/verifier.js +0 -12
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.WalletProviderResponseError = exports.WalletInstanceAttestationIssuingError = exports.ValidationFailed = exports.PidMetadataError = exports.PidIssuingError = exports.NoSuitableKeysFoundInEntityConfiguration = exports.IoWalletError = exports.ClaimsNotFoundInToken = exports.ClaimsNotFoundBetweenDislosures = exports.AuthRequestDecodeError = void 0;
|
6
|
+
exports.WalletProviderResponseError = exports.WalletInstanceRevokedError = exports.WalletInstanceNotFoundError = exports.WalletInstanceAttestationIssuingError = exports.ValidationFailed = exports.PidMetadataError = exports.PidIssuingError = exports.NoSuitableKeysFoundInEntityConfiguration = exports.IoWalletError = exports.ClaimsNotFoundInToken = exports.ClaimsNotFoundBetweenDislosures = exports.AuthorizationIdpError = exports.AuthorizationError = exports.AuthRequestDecodeError = void 0;
|
7
7
|
/**
|
8
8
|
* utility to format a set of attributes into an error message string
|
9
9
|
*
|
@@ -248,17 +248,92 @@ class WalletProviderResponseError extends IoWalletError {
|
|
248
248
|
|
249
249
|
/** Reason code for the validation failure. */
|
250
250
|
|
251
|
+
/** HTTP status code */
|
252
|
+
|
251
253
|
constructor(message) {
|
252
254
|
let claim = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "unspecified";
|
253
255
|
let reason = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "unspecified";
|
256
|
+
let statusCode = arguments.length > 3 ? arguments[3] : undefined;
|
254
257
|
super(serializeAttrs({
|
255
258
|
message,
|
256
259
|
claim,
|
257
|
-
reason
|
260
|
+
reason,
|
261
|
+
statusCode: statusCode.toString()
|
258
262
|
}));
|
259
263
|
this.claim = claim;
|
260
264
|
this.reason = reason;
|
265
|
+
this.statusCode = statusCode;
|
261
266
|
}
|
262
267
|
}
|
263
268
|
exports.WalletProviderResponseError = WalletProviderResponseError;
|
269
|
+
class WalletInstanceRevokedError extends IoWalletError {
|
270
|
+
static get code() {
|
271
|
+
return "ERR_IO_WALLET_INSTANCE_REVOKED";
|
272
|
+
}
|
273
|
+
code = "ERR_IO_WALLET_INSTANCE_REVOKED";
|
274
|
+
constructor(message, claim) {
|
275
|
+
let reason = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "unspecified";
|
276
|
+
super(serializeAttrs({
|
277
|
+
message,
|
278
|
+
claim,
|
279
|
+
reason
|
280
|
+
}));
|
281
|
+
this.reason = reason;
|
282
|
+
this.claim = claim;
|
283
|
+
}
|
284
|
+
}
|
285
|
+
exports.WalletInstanceRevokedError = WalletInstanceRevokedError;
|
286
|
+
class WalletInstanceNotFoundError extends IoWalletError {
|
287
|
+
static get code() {
|
288
|
+
return "ERR_IO_WALLET_INSTANCE_NOT_FOUND";
|
289
|
+
}
|
290
|
+
code = "ERR_IO_WALLET_INSTANCE_NOT_FOUND";
|
291
|
+
constructor(message, claim) {
|
292
|
+
let reason = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "unspecified";
|
293
|
+
super(serializeAttrs({
|
294
|
+
message,
|
295
|
+
claim,
|
296
|
+
reason
|
297
|
+
}));
|
298
|
+
this.reason = reason;
|
299
|
+
this.claim = claim;
|
300
|
+
}
|
301
|
+
}
|
302
|
+
|
303
|
+
/**
|
304
|
+
* An error subclass thrown when an error occurs during the authorization process.
|
305
|
+
*/
|
306
|
+
exports.WalletInstanceNotFoundError = WalletInstanceNotFoundError;
|
307
|
+
class AuthorizationError extends IoWalletError {
|
308
|
+
static get code() {
|
309
|
+
return "ERR_IO_WALLET_AUTHORIZATION_ERROR";
|
310
|
+
}
|
311
|
+
code = "ERR_IO_WALLET_AUTHORIZATION_ERROR";
|
312
|
+
constructor(message) {
|
313
|
+
super(message);
|
314
|
+
}
|
315
|
+
}
|
316
|
+
|
317
|
+
/**
|
318
|
+
* An error subclass thrown when an error occurs during the authorization process with the IDP.
|
319
|
+
* It contains the error and error description returned by the IDP.
|
320
|
+
*/
|
321
|
+
exports.AuthorizationError = AuthorizationError;
|
322
|
+
class AuthorizationIdpError extends IoWalletError {
|
323
|
+
static get code() {
|
324
|
+
return "ERR_IO_WALLET_IDENTIFICATION_RESPONSE_ERROR";
|
325
|
+
}
|
326
|
+
code = "ERR_IO_WALLET_IDENTIFICATION_RESPONSE_PARSING_FAILED";
|
327
|
+
constructor(error, errorDescription) {
|
328
|
+
super(serializeAttrs(errorDescription ? {
|
329
|
+
error,
|
330
|
+
errorDescription
|
331
|
+
} : {
|
332
|
+
error
|
333
|
+
}));
|
334
|
+
this.error = error;
|
335
|
+
this.errorDescription = errorDescription;
|
336
|
+
}
|
337
|
+
}
|
338
|
+
exports.AuthorizationIdpError = AuthorizationIdpError;
|
264
339
|
//# sourceMappingURL=errors.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["serializeAttrs","attrs","Object","entries","map","_ref","k","v","Array","isArray","join","_","IoWalletError","Error","code","constructor","message","_Error$captureStackTr","name","captureStackTrace","call","exports","ValidationFailed","claim","arguments","length","undefined","reason","WalletInstanceAttestationIssuingError","AuthRequestDecodeError","PidIssuingError","ClaimsNotFoundBetweenDislosures","claims","c","ClaimsNotFoundInToken","NoSuitableKeysFoundInEntityConfiguration","scenario","PidMetadataError","WalletProviderResponseError"],"sourceRoot":"../../../src","sources":["utils/errors.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,cAAc,GAAIC,KAAsC,IAC5DC,MAAM,CAACC,OAAO,CAACF,KAAK,CAAC,CAClBG,GAAG,CAACC,IAAA;EAAA,IAAC,CAACC,CAAC,EAAEC,CAAC,CAAC,GAAAF,IAAA;EAAA,OAAK,CAACC,CAAC,EAAEE,KAAK,CAACC,OAAO,CAACF,CAAC,CAAC,GAAI,IAAGA,CAAC,CAACG,IAAI,CAAC,IAAI,CAAE,GAAE,GAAGH,CAAC,CAAC;AAAA,EAAC,CAChEH,GAAG,CAAEO,CAAC,IAAKA,CAAC,CAACD,IAAI,CAAC,GAAG,CAAC,CAAC,CACvBA,IAAI,CAAC,GAAG,CAAC;;AAEd;AACA;AACA;A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B,KAAK,CAACC,OAAO,CAACuB,MAAM,CAAC,GAAGA,MAAM,GAAG,CAACA,MAAM,CAAC;IACnD,MAAMhB,OAAO,GAAI,yDAAwDiB,CAAC,CAACvB,IAAI,CAC7E,IACF,CAAE,EAAC;IACH,KAAK,CAACM,OAAO,CAAC;IACd,IAAI,CAACgB,MAAM,GAAGC,CAAC;EACjB;AACF;;AAEA;AACA;AACA;AACA;AAHAZ,OAAA,CAAAa,qBAAA,GAAAA,qBAAA;AAIO,MAAMC,wCAAwC,SAAStB,KAAK,CAAC;EAClE,WAAWC,IAAIA,CAAA,EAAqC;IAClD,OAAO,gCAAgC;EACzC;EAEAA,IAAI,GAAG,gCAAgC;;EAEvC;AACF;AACA;EACEC,WAAWA,CAACqB,QAAgB,EAAE;IAC5B,MAAMpB,OAAO,GAAI,0DAAyDoB,QAAS,IAAG;IACtF,KAAK,CAACpB,OAAO,CAAC;EAChB;AACF;;AAEA;AACA;AACA;AACA;AAHAK,OAAA,CAAAc,wCAAA,GAAAA,wCAAA;AAIO,MAAME,gBAAgB,SAASxB,KAAK,CAAC;EAC1C,WAAWC,IAAIA,CAAA,EAAyB;IACtC,OAAO,oBAAoB;EAC7B;EAEAC,WAAWA,CAACC,OAAe,EAAE;IAC3B,KAAK,CAACA,OAAO,CAAC;EAChB;AACF;;AAEA;AACA;AACA;AACA;AAHAK,OAAA,CAAAgB,gBAAA,GAAAA,gBAAA;AAIO,MAAMC,2BAA2B,SAAS1B,aAAa,CAAC;EAC7D,WAAWE,IAAIA,CAAA,EAA6C;IAC1D,OAAO,wCAAwC;EACjD;EAEAA,IAAI,GAAG,wCAAwC;;EAE/C;;EAGA;;EAGAC,WAAWA,CACTC,OAAe,
|
1
|
+
{"version":3,"names":["serializeAttrs","attrs","Object","entries","map","_ref","k","v","Array","isArray","join","_","IoWalletError","Error","code","constructor","message","_Error$captureStackTr","name","captureStackTrace","call","exports","ValidationFailed","claim","arguments","length","undefined","reason","WalletInstanceAttestationIssuingError","AuthRequestDecodeError","PidIssuingError","ClaimsNotFoundBetweenDislosures","claims","c","ClaimsNotFoundInToken","NoSuitableKeysFoundInEntityConfiguration","scenario","PidMetadataError","WalletProviderResponseError","statusCode","toString","WalletInstanceRevokedError","WalletInstanceNotFoundError","AuthorizationError","AuthorizationIdpError","error","errorDescription"],"sourceRoot":"../../../src","sources":["utils/errors.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,cAAc,GAAIC,KAAsC,IAC5DC,MAAM,CAACC,OAAO,CAACF,KAAK,CAAC,CAClBG,GAAG,CAACC,IAAA;EAAA,IAAC,CAACC,CAAC,EAAEC,CAAC,CAAC,GAAAF,IAAA;EAAA,OAAK,CAACC,CAAC,EAAEE,KAAK,CAACC,OAAO,CAACF,CAAC,CAAC,GAAI,IAAGA,CAAC,CAACG,IAAI,CAAC,IAAI,CAAE,GAAE,GAAGH,CAAC,CAAC;AAAA,EAAC,CAChEH,GAAG,CAAEO,CAAC,IAAKA,CAAC,CAACD,IAAI,CAAC,GAAG,CAAC,CAAC,CACvBA,IAAI,CAAC,GAAG,CAAC;;AAEd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAME,aAAa,SAASC,KAAK,CAAC;EACvC;EACA,WAAWC,IAAIA,CAAA,EAAW;IACxB,OAAO,uBAAuB;EAChC;;EAEA;EACAA,IAAI,GAAW,uBAAuB;EAEtCC,WAAWA,CAACC,OAAgB,EAAE;IAAA,IAAAC,qBAAA;IAC5B,KAAK,CAACD,OAAO,CAAC;IACd,IAAI,CAACE,IAAI,GAAG,IAAI,CAACH,WAAW,CAACG,IAAI;IACjC;IACA,CAAAD,qBAAA,GAAAJ,KAAK,CAACM,iBAAiB,cAAAF,qBAAA,uBAAvBA,qBAAA,CAAAG,IAAA,CAAAP,KAAK,EAAqB,IAAI,EAAE,IAAI,CAACE,WAAW,CAAC;EACnD;AACF;AACA;AACA;AACA;AACA;AAH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EACvD,WAAWE,IAAIA,CAAA,EAAkD;IAC/D,OAAO,6CAA6C;EACtD;EAEAA,IAAI,GAAG,sDAAsD;EAK7DC,WAAWA,CAAC8B,KAAa,EAAEC,gBAAyB,EAAE;IACpD,KAAK,CACH9C,cAAc,CAAC8C,gBAAgB,GAAG;MAAED,KAAK;MAAEC;IAAiB,CAAC,GAAG;MAAED;IAAM,CAAC,CAC3E,CAAC;IACD,IAAI,CAACA,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACC,gBAAgB,GAAGA,gBAAgB;EAC1C;AACF;AAACzB,OAAA,CAAAuB,qBAAA,GAAAA,qBAAA"}
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.hasStatus = void 0;
|
6
|
+
exports.until = exports.hasStatus = exports.generateRandomAlphaNumericString = void 0;
|
7
7
|
var _errors = require("./errors");
|
8
8
|
/**
|
9
9
|
* Check if a response is in the expected status, other
|
@@ -20,4 +20,37 @@ const hasStatus = status => async res => {
|
|
20
20
|
// extract a type from an async function output
|
21
21
|
// helpful to bind the input of a function to the output of another
|
22
22
|
exports.hasStatus = hasStatus;
|
23
|
+
/**
|
24
|
+
* TODO [SIW-1310]: replace this function with a cryptographically secure one.
|
25
|
+
* @param size - The size of the string to generate
|
26
|
+
* @returns A random alphanumeric string of the given size
|
27
|
+
*/
|
28
|
+
const generateRandomAlphaNumericString = size => Array.from(Array(size), () => Math.floor(Math.random() * 36).toString(36)).join("");
|
29
|
+
|
30
|
+
/**
|
31
|
+
* Repeatedly checks a condition function until it returns true,
|
32
|
+
* then resolves the returned promise. If the condition function does not return true
|
33
|
+
* within the specified timeout, the promise is rejected.
|
34
|
+
*
|
35
|
+
* @param conditionFunction - A function that returns a boolean value.
|
36
|
+
* The promise resolves when this function returns true.
|
37
|
+
* @param timeout - An optional timeout in seconds. The promise is rejected if the
|
38
|
+
* condition function does not return true within this time.
|
39
|
+
* @returns A promise that resolves once the conditionFunction returns true or rejects if timed out.
|
40
|
+
*/
|
41
|
+
exports.generateRandomAlphaNumericString = generateRandomAlphaNumericString;
|
42
|
+
const until = (conditionFunction, timeoutSeconds) => new Promise((resolve, reject) => {
|
43
|
+
const start = Date.now();
|
44
|
+
const poll = () => {
|
45
|
+
if (conditionFunction()) {
|
46
|
+
resolve();
|
47
|
+
} else if (timeoutSeconds !== undefined && Date.now() - start >= timeoutSeconds * 1000) {
|
48
|
+
reject(new Error("Timeout exceeded"));
|
49
|
+
} else {
|
50
|
+
setTimeout(poll, 400);
|
51
|
+
}
|
52
|
+
};
|
53
|
+
poll();
|
54
|
+
});
|
55
|
+
exports.until = until;
|
23
56
|
//# sourceMappingURL=misc.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_errors","require","hasStatus","status","res","IoWalletError","url","text","exports"],"sourceRoot":"../../../src","sources":["utils/misc.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA;AACO,MAAMC,SAAS,GACnBC,MAAc,IACf,MAAOC,GAAa,IAAwB;EAC1C,IAAIA,GAAG,CAACD,MAAM,KAAKA,MAAM,EAAE;IACzB,MAAM,IAAIE,qBAAa,CACpB,iCAAgCF,MAAO,SAAQC,GAAG,CAACD,MAAO,UACzDC,GAAG,CAACE,GACL,mBAAkB,MAAMF,GAAG,CAACG,IAAI,CAAC,CAAE,EACtC,CAAC;EACH;EACA,OAAOH,GAAG;AACZ,CAAC;;AAEH;AACA;AAAAI,OAAA,CAAAN,SAAA,GAAAA,SAAA"}
|
1
|
+
{"version":3,"names":["_errors","require","hasStatus","status","res","IoWalletError","url","text","exports","generateRandomAlphaNumericString","size","Array","from","Math","floor","random","toString","join","until","conditionFunction","timeoutSeconds","Promise","resolve","reject","start","Date","now","poll","undefined","Error","setTimeout"],"sourceRoot":"../../../src","sources":["utils/misc.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,O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,UAAU,CAACH,IAAI,EAAE,GAAG,CAAC;IACvB;EACF,CAAC;EAEDA,IAAI,CAAC,CAAC;AACR,CAAC,CAAC;AAACnB,OAAA,CAAAU,KAAA,GAAAA,KAAA"}
|
@@ -9,13 +9,12 @@ var _reactNativeUuid = _interopRequireDefault(require("react-native-uuid"));
|
|
9
9
|
var z = _interopRequireWildcard(require("zod"));
|
10
10
|
var WalletInstanceAttestation = _interopRequireWildcard(require("../wallet-instance-attestation"));
|
11
11
|
var _misc = require("./misc");
|
12
|
+
var _pop = require("./pop");
|
12
13
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
13
14
|
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; }
|
14
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15
16
|
const AuthorizationDetail = z.object({
|
16
|
-
|
17
|
-
type: z.string()
|
18
|
-
}),
|
17
|
+
credential_configuration_id: z.string(),
|
19
18
|
format: z.union([z.literal("vc+sd-jwt"), z.literal("vc+mdoc-cbor")]),
|
20
19
|
type: z.literal("openid_credential")
|
21
20
|
});
|
@@ -31,16 +30,21 @@ const makeParRequest = _ref => {
|
|
31
30
|
wiaCryptoContext,
|
32
31
|
appFetch = fetch
|
33
32
|
} = _ref;
|
34
|
-
return async (clientId, codeVerifier,
|
33
|
+
return async (clientId, codeVerifier, redirectUri, responseMode, parEndpoint, walletInstanceAttestation, authorizationDetails, assertionType) => {
|
35
34
|
const wiaPublicKey = await wiaCryptoContext.getPublicKey();
|
36
35
|
const parUrl = new URL(parEndpoint);
|
37
36
|
const aud = `${parUrl.protocol}//${parUrl.hostname}`;
|
38
37
|
const iss = WalletInstanceAttestation.decode(walletInstanceAttestation).payload.cnf.jwk.kid;
|
38
|
+
const signedWiaPoP = await (0, _pop.createPopToken)({
|
39
|
+
jti: `${_reactNativeUuid.default.v4()}`,
|
40
|
+
aud,
|
41
|
+
iss
|
42
|
+
}, wiaCryptoContext);
|
39
43
|
|
40
44
|
/** A code challenge is provided so that the PAR is bound
|
41
45
|
to the subsequent authorization code request
|
42
46
|
@see https://datatracker.ietf.org/doc/html/rfc9126#name-request */
|
43
|
-
const codeChallengeMethod = "
|
47
|
+
const codeChallengeMethod = "S256";
|
44
48
|
const codeChallenge = await (0, _ioReactNativeJwt.sha256ToBase64)(codeVerifier);
|
45
49
|
|
46
50
|
/** The PAR request token is signed used the Wallet Instance Attestation key.
|
@@ -48,20 +52,24 @@ const makeParRequest = _ref => {
|
|
48
52
|
with the it will ship the Wallet Instance Attestation.
|
49
53
|
The key is matched by its kid */
|
50
54
|
const signedJwtForPar = await new _ioReactNativeJwt.SignJWT(wiaCryptoContext).setProtectedHeader({
|
55
|
+
typ: "jwk",
|
51
56
|
kid: wiaPublicKey.kid
|
52
57
|
}).setPayload({
|
53
|
-
iss,
|
54
|
-
aud,
|
55
58
|
jti: `${_reactNativeUuid.default.v4()}`,
|
56
|
-
|
57
|
-
authorization_details: authorizationDetails,
|
59
|
+
aud,
|
58
60
|
response_type: "code",
|
59
|
-
|
60
|
-
state: `${_reactNativeUuid.default.v4()}`,
|
61
|
+
response_mode: responseMode,
|
61
62
|
client_id: clientId,
|
63
|
+
iss,
|
64
|
+
state: (0, _misc.generateRandomAlphaNumericString)(32),
|
65
|
+
code_challenge: codeChallenge,
|
62
66
|
code_challenge_method: codeChallengeMethod,
|
63
|
-
|
64
|
-
|
67
|
+
authorization_details: authorizationDetails,
|
68
|
+
redirect_uri: redirectUri,
|
69
|
+
client_assertion_type: assertionType,
|
70
|
+
client_assertion: walletInstanceAttestation + "~" + signedWiaPoP
|
71
|
+
}).setIssuedAt() //iat is set to now
|
72
|
+
.setExpirationTime("5min").sign();
|
65
73
|
|
66
74
|
/** The request body for the Pushed Authorization Request */
|
67
75
|
var formBody = new URLSearchParams({
|
@@ -69,9 +77,9 @@ const makeParRequest = _ref => {
|
|
69
77
|
client_id: clientId,
|
70
78
|
code_challenge: codeChallenge,
|
71
79
|
code_challenge_method: "S256",
|
80
|
+
request: signedJwtForPar,
|
72
81
|
client_assertion_type: assertionType,
|
73
|
-
client_assertion: walletInstanceAttestation
|
74
|
-
request: signedJwtForPar
|
82
|
+
client_assertion: walletInstanceAttestation + "~" + signedWiaPoP
|
75
83
|
});
|
76
84
|
return await appFetch(parEndpoint, {
|
77
85
|
method: "POST",
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_ioReactNativeJwt","require","_reactNativeUuid","_interopRequireDefault","z","_interopRequireWildcard","WalletInstanceAttestation","_misc","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","AuthorizationDetail","object","
|
1
|
+
{"version":3,"names":["_ioReactNativeJwt","require","_reactNativeUuid","_interopRequireDefault","z","_interopRequireWildcard","WalletInstanceAttestation","_misc","_pop","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","AuthorizationDetail","object","credential_configuration_id","string","format","union","literal","type","exports","AuthorizationDetails","array","makeParRequest","_ref","wiaCryptoContext","appFetch","fetch","clientId","codeVerifier","redirectUri","responseMode","parEndpoint","walletInstanceAttestation","authorizationDetails","assertionType","wiaPublicKey","getPublicKey","parUrl","URL","aud","protocol","hostname","iss","decode","payload","cnf","jwk","kid","signedWiaPoP","createPopToken","jti","uuid","v4","codeChallengeMethod","codeChallenge","sha256ToBase64","signedJwtForPar","SignJWT","setProtectedHeader","typ","setPayload","response_type","response_mode","client_id","state","generateRandomAlphaNumericString","code_challenge","code_challenge_method","authorization_details","redirect_uri","client_assertion_type","client_assertion","setIssuedAt","setExpirationTime","sign","formBody","URLSearchParams","request","method","headers","body","toString","then","hasStatus","res","json","result","request_uri"],"sourceRoot":"../../../src","sources":["utils/par.ts"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAKA,IAAAC,gBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,CAAA,GAAAC,uBAAA,CAAAJ,OAAA;AACA,IAAAK,yBAAA,GAAAD,uBAAA,CAAAJ,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,IAAA,GAAAP,OAAA;AAAuC,SAAAQ,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,SAAAL,wBAAAS,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,K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
+
value: true
|
5
|
+
});
|
6
|
+
exports.createPopToken = exports.PoPPayload = void 0;
|
7
|
+
var z = _interopRequireWildcard(require("zod"));
|
8
|
+
var _ioReactNativeJwt = require("@pagopa/io-react-native-jwt");
|
9
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
10
|
+
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; }
|
11
|
+
/**
|
12
|
+
* Create a signed PoP token
|
13
|
+
*
|
14
|
+
* @param payload The payload to be included in the token.
|
15
|
+
* @param crypto The crypto context that handles the key bound to the DPoP.
|
16
|
+
*
|
17
|
+
* @returns The signed crypto token.
|
18
|
+
*/
|
19
|
+
const createPopToken = async (payload, crypto) => {
|
20
|
+
const kid = await crypto.getPublicKey().then(_ => _.kid);
|
21
|
+
return new _ioReactNativeJwt.SignJWT(crypto).setPayload(payload).setProtectedHeader({
|
22
|
+
typ: "jwt-client-attestation-pop",
|
23
|
+
kid
|
24
|
+
}).setIssuedAt().setExpirationTime("5min").sign();
|
25
|
+
};
|
26
|
+
exports.createPopToken = createPopToken;
|
27
|
+
const PoPPayload = z.object({
|
28
|
+
jti: z.string(),
|
29
|
+
aud: z.string(),
|
30
|
+
iss: z.string()
|
31
|
+
});
|
32
|
+
exports.PoPPayload = PoPPayload;
|
33
|
+
//# sourceMappingURL=pop.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["z","_interopRequireWildcard","require","_ioReactNativeJwt","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","createPopToken","payload","crypto","kid","getPublicKey","then","_","SignJWT","setPayload","setProtectedHeader","typ","setIssuedAt","setExpirationTime","sign","exports","PoPPayload","object","jti","string","aud","iss"],"sourceRoot":"../../../src","sources":["utils/pop.ts"],"mappings":";;;;;;AAAA,IAAAA,CAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,iBAAA,GAAAD,OAAA;AAA0E,SAAAE,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,SAAAJ,wBAAAQ,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,SAA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 +6,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
exports.getAttestation = void 0;
|
7
7
|
exports.getAttestationRequest = getAttestationRequest;
|
8
8
|
var _ioReactNativeJwt = require("@pagopa/io-react-native-jwt");
|
9
|
+
var _zod = require("zod");
|
9
10
|
var _jwk = require("../utils/jwk");
|
10
11
|
var _client = require("../client");
|
11
|
-
var
|
12
|
+
var _errors = require("../utils/errors");
|
12
13
|
/**
|
13
14
|
* Getter for an attestation request. The attestation request is a JWT that will be sent to the Wallet Provider to request a Wallet Instance Attestation.
|
14
15
|
*
|
@@ -58,6 +59,8 @@ async function getAttestationRequest(challenge, wiaCryptoContext, integrityConte
|
|
58
59
|
* @param params.appFetch (optional) Http client
|
59
60
|
* @param walletProviderBaseUrl Base url for the Wallet Provider
|
60
61
|
* @returns The retrieved Wallet Instance Attestation token
|
62
|
+
* @throws {WalletInstanceRevokedError} The Wallet Instance was revoked
|
63
|
+
* @throws {WalletInstanceNotFoundError} The Wallet Instance does not exist
|
61
64
|
*/
|
62
65
|
const getAttestation = async _ref => {
|
63
66
|
let {
|
@@ -83,8 +86,20 @@ const getAttestation = async _ref => {
|
|
83
86
|
grant_type: "urn:ietf:params:oauth:grant-type:jwt-bearer",
|
84
87
|
assertion: signedAttestationRequest
|
85
88
|
}
|
86
|
-
}).then(result => _zod.z.string().parse(result));
|
89
|
+
}).then(result => _zod.z.string().parse(result)).catch(handleAttestationCreationError);
|
87
90
|
return wia;
|
88
91
|
};
|
89
92
|
exports.getAttestation = getAttestation;
|
93
|
+
const handleAttestationCreationError = e => {
|
94
|
+
if (!(e instanceof _errors.WalletProviderResponseError)) {
|
95
|
+
throw e;
|
96
|
+
}
|
97
|
+
if (e.statusCode === 403) {
|
98
|
+
throw new _errors.WalletInstanceRevokedError("Unable to get an attestation for a revoked Wallet Instance", e.claim, e.reason);
|
99
|
+
}
|
100
|
+
if (e.statusCode === 404) {
|
101
|
+
throw new _errors.WalletInstanceNotFoundError("Unable to get an attestation for a Wallet Instance that does not exist", e.claim, e.reason);
|
102
|
+
}
|
103
|
+
throw new _errors.WalletInstanceAttestationIssuingError(`Unable to obtain wallet instance attestation [response status code: ${e.statusCode}]`, e.claim, e.reason);
|
104
|
+
};
|
90
105
|
//# sourceMappingURL=issuing.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_ioReactNativeJwt","require","_jwk","_client","
|
1
|
+
{"version":3,"names":["_ioReactNativeJwt","require","_zod","_jwk","_client","_errors","getAttestationRequest","challenge","wiaCryptoContext","integrityContext","walletProviderBaseUrl","jwk","getPublicKey","parsedJwk","JWK","parse","keyThumbprint","thumbprint","publicKey","kid","clientData","jwk_thumbprint","hardwareKeyTag","getHardwareKeyTag","signature","authenticatorData","getHardwareSignatureWithAuthData","JSON","stringify","SignJWT","setPayload","iss","sub","hardware_signature","integrity_assertion","hardware_key_tag","cnf","fixBase64EncodingOnKey","setProtectedHeader","typ","setIssuedAt","setExpirationTime","sign","getAttestation","_ref","appFetch","fetch","api","getWalletProviderClient","get","then","response","nonce","signedAttestationRequest","wia","post","body","grant_type","assertion","result","z","string","catch","handleAttestationCreationError","exports","e","WalletProviderResponseError","statusCode","WalletInstanceRevokedError","claim","reason","WalletInstanceNotFoundError","WalletInstanceAttestationIssuingError"],"sourceRoot":"../../../src","sources":["wallet-instance-attestation/issuing.ts"],"mappings":";;;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAEA,IAAAI,OAAA,GAAAJ,OAAA;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeK,qBAAqBA,CACzCC,SAAiB,EACjBC,gBAA+B,EAC/BC,gBAAkC,EAClCC,qBAA6B,EACZ;EACjB,MAAMC,GAAG,GAAG,MAAMH,gBAAgB,CAACI,YAAY,CAAC,CAAC;EACjD,MAAMC,SAAS,GA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AttestationJwt = z.object({
|
|
47
47
|
})),
|
48
48
|
payload: z.intersection(Jwt.shape.payload, z.object({
|
49
49
|
sub: z.string(),
|
50
|
-
|
50
|
+
aal: z.string(),
|
51
51
|
authorization_endpoint: z.string(),
|
52
52
|
response_types_supported: z.array(z.string()),
|
53
53
|
vp_formats_supported: z.object({
|
54
|
-
|
55
|
-
|
56
|
-
}),
|
57
|
-
|
58
|
-
|
59
|
-
})
|
54
|
+
"vc+sd-jwt": z.object({
|
55
|
+
"sd-jwt_alg_values": z.array(z.string())
|
56
|
+
}).optional(),
|
57
|
+
"vp+sd-jwt": z.object({
|
58
|
+
"sd-jwt_alg_values": z.array(z.string())
|
59
|
+
}).optional()
|
60
60
|
}),
|
61
61
|
request_object_signing_alg_values_supported: z.array(z.string()),
|
62
62
|
presentation_definition_uri_supported: z.boolean()
|
@@ -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","iat","exp","cnf","jwk","intersection","JWK","WalletInstanceAttestationRequestJwt","shape","literal","aud","jti","nonce","exports","WalletInstanceAttestationJwt","sub","
|
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","iat","exp","cnf","jwk","intersection","JWK","WalletInstanceAttestationRequestJwt","shape","literal","aud","jti","nonce","exports","WalletInstanceAttestationJwt","sub","aal","authorization_endpoint","response_types_supported","vp_formats_supported","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,MAAA,CAAAJ,OAAA,GAAAF,GAAA,MAA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CAAC,CAAC;MACzC,CAAC,CAAC,CACDK,QAAQ,CAAC,CAAC;MACb,WAAW,EAAErC,CAAC,CACX6B,MAAM,CAAC;QACN,mBAAmB,EAAE7B,CAAC,CAACoC,KAAK,CAACpC,CAAC,CAACgC,MAAM,CAAC,CAAC;MACzC,CAAC,CAAC,CACDK,QAAQ,CAAC;IACd,CAAC,CAAC;IACFuB,2CAA2C,EAAE5D,CAAC,CAACoC,KAAK,CAACpC,CAAC,CAACgC,MAAM,CAAC,CAAC,CAAC;IAChE6B,qCAAqC,EAAE7D,CAAC,CAAC8D,OAAO,CAAC;EACnD,CAAC,CACH;AACF,CAAC,CAAC;AAACT,OAAA,CAAAC,4BAAA,GAAAA,4BAAA"}
|
@@ -1,4 +1,17 @@
|
|
1
1
|
import z from "zod";
|
2
|
+
export const NonceDetailView = z.object({
|
3
|
+
nonce: z.string()
|
4
|
+
});
|
5
|
+
export const WalletAttestationView = z.string();
|
6
|
+
export const CreateWalletInstanceBody = z.object({
|
7
|
+
challenge: z.string(),
|
8
|
+
key_attestation: z.string(),
|
9
|
+
hardware_key_tag: z.string()
|
10
|
+
});
|
11
|
+
export const CreateWalletAttestationBody = z.object({
|
12
|
+
grant_type: z.literal("urn:ietf:params:oauth:grant-type:jwt-bearer"),
|
13
|
+
assertion: z.string()
|
14
|
+
});
|
2
15
|
export const ProblemDetail = z.object({
|
3
16
|
type: z.string().optional(),
|
4
17
|
title: z.string().optional(),
|
@@ -8,29 +21,17 @@ export const ProblemDetail = z.object({
|
|
8
21
|
});
|
9
22
|
export const FiscalCode = z.string();
|
10
23
|
export const Id = z.string();
|
11
|
-
export const get_GetEntityConfiguration = {
|
12
|
-
method: z.literal("GET"),
|
13
|
-
path: z.literal("/.well-known/openid-federation"),
|
14
|
-
parameters: z.never(),
|
15
|
-
response: z.unknown()
|
16
|
-
};
|
17
24
|
export const get_GetNonce = {
|
18
25
|
method: z.literal("GET"),
|
19
26
|
path: z.literal("/nonce"),
|
20
27
|
parameters: z.never(),
|
21
|
-
response:
|
22
|
-
nonce: z.string()
|
23
|
-
})
|
28
|
+
response: NonceDetailView
|
24
29
|
};
|
25
30
|
export const post_CreateWalletInstance = {
|
26
31
|
method: z.literal("POST"),
|
27
32
|
path: z.literal("/wallet-instances"),
|
28
33
|
parameters: z.object({
|
29
|
-
body:
|
30
|
-
challenge: z.string(),
|
31
|
-
key_attestation: z.string(),
|
32
|
-
hardware_key_tag: z.string()
|
33
|
-
})
|
34
|
+
body: CreateWalletInstanceBody
|
34
35
|
}),
|
35
36
|
response: z.unknown()
|
36
37
|
};
|
@@ -38,10 +39,7 @@ export const post_CreateWalletAttestation = {
|
|
38
39
|
method: z.literal("POST"),
|
39
40
|
path: z.literal("/token"),
|
40
41
|
parameters: z.object({
|
41
|
-
body:
|
42
|
-
grant_type: z.literal("urn:ietf:params:oauth:grant-type:jwt-bearer"),
|
43
|
-
assertion: z.string()
|
44
|
-
})
|
42
|
+
body: CreateWalletAttestationBody
|
45
43
|
}),
|
46
44
|
response: z.unknown()
|
47
45
|
};
|
@@ -49,7 +47,6 @@ export const post_CreateWalletAttestation = {
|
|
49
47
|
// <EndpointByMethod>
|
50
48
|
export const EndpointByMethod = {
|
51
49
|
get: {
|
52
|
-
"/.well-known/openid-federation": get_GetEntityConfiguration,
|
53
50
|
"/nonce": get_GetNonce
|
54
51
|
},
|
55
52
|
post: {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["z","
|
1
|
+
{"version":3,"names":["z","NonceDetailView","object","nonce","string","WalletAttestationView","CreateWalletInstanceBody","challenge","key_attestation","hardware_key_tag","CreateWalletAttestationBody","grant_type","literal","assertion","ProblemDetail","type","optional","title","status","number","detail","instance","FiscalCode","Id","get_GetNonce","method","path","parameters","never","response","post_CreateWalletInstance","body","unknown","post_CreateWalletAttestation","EndpointByMethod","get","post","ApiClient","baseUrl","constructor","fetcher","setBaseUrl","arguments","length","undefined","createApiClient"],"sourceRoot":"../../../../src","sources":["client/generated/wallet-provider.ts"],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A,OAAO;IACtB,OAAO,IAAI;EACb;;EAEA;EACAH,GAAGA,CACDT,IAAU,EAE+B;IACzC,OAAO,IAAI,CAACc,OAAO,CAAC,KAAK,EAAE,IAAI,CAACF,OAAO,GAAGZ,IAAI,EAAAgB,SAAA,CAAAC,MAAA,QAAAC,SAAA,GAAAF,SAAA,GAAW,CAAC;EAC5D;EACA;;EAEA;EACAN,IAAIA,CACFV,IAAU,EAE+B;IACzC,OAAO,IAAI,CAACc,OAAO,CAAC,MAAM,EAAE,IAAI,CAACF,OAAO,GAAGZ,IAAI,EAAAgB,SAAA,CAAAC,MAAA,QAAAC,SAAA,GAAAF,SAAA,GAAW,CAAC;EAC7D;EACA;AACF;;AAEA,OAAO,SAASG,eAAeA,CAACL,OAAgB,EAAEF,OAAgB,EAAE;EAClE,OAAO,IAAID,SAAS,CAACG,OAAO,CAAC,CAACC,UAAU,CAACH,OAAO,IAAI,EAAE,CAAC;AACzD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA"}
|
@@ -10,8 +10,7 @@ const validateResponse = async response => {
|
|
10
10
|
title: "Invalid response from Wallet Provider"
|
11
11
|
};
|
12
12
|
}
|
13
|
-
|
14
|
-
throw new WalletProviderResponseError(problemDetail.title ? problemDetail.title : "Invalid response from Wallet Provider", problemDetail.type, problemDetail.detail ? statusResponse : `${statusResponse} with detail: ${problemDetail.detail}`);
|
13
|
+
throw new WalletProviderResponseError(problemDetail.title ?? "Invalid response from Wallet Provider", problemDetail.type, problemDetail.detail, response.status);
|
15
14
|
}
|
16
15
|
return response;
|
17
16
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["WalletProviderResponseError","ProblemDetail","createApiClient","createWalletProviderApiClient","validateResponse","response","ok","problemDetail","parse","json","title","
|
1
|
+
{"version":3,"names":["WalletProviderResponseError","ProblemDetail","createApiClient","createWalletProviderApiClient","validateResponse","response","ok","problemDetail","parse","json","title","type","detail","status","getWalletProviderClient","context","walletProviderBaseUrl","appFetch","fetch","method","url","params","body","JSON","stringify","undefined","then","res","contentType","headers","get","text"],"sourceRoot":"../../../src","sources":["client/index.ts"],"mappings":"AAAA,SAASA,2BAA2B,QAAQ,iBAAiB;AAC7D,SACEC,aAAa,EACbC,eAAe,IAAIC,6BAA6B,QAC3C,6BAA6B;AAKpC,MAAMC,gBAAgB,GAAG,MAAOC,QAAkB,IAAK;EACrD,IAAI,CAACA,QAAQ,CAACC,EAAE,EAAE;IAChB,IAAIC,aAA4B,GAAG,CAAC,CAAC;IACrC,IAAI;MACFA,aAAa,GAAGN,aAAa,CAACO,KAAK,CAAC,MAAMH,QAAQ,CAACI,IAAI,CAAC,CAAC,CAAC;IAC5D,CAAC,CAAC,MAAM;MACNF,aAAa,GAAG;QACdG,KAAK,EAAE;MACT,CAAC;IACH;IAEA,MAAM,IAAIV,2BAA2B,CACnCO,aAAa,CAACG,KAAK,IAAI,uCAAuC,EAC9DH,aAAa,CAACI,IAAI,EAClBJ,aAAa,CAACK,MAAM,EACpBP,QAAQ,CAACQ,MACX,CAAC;EACH;EACA,OAAOR,QAAQ;AACjB,CAAC;AAED,OAAO,MAAMS,uBAAuB,GAAIC,OAGvC,IAAK;EACJ,MAAM;IAAEC,qBAAqB;IAAEC,QAAQ,GAAGC;EAAM,CAAC,GAAGH,OAAO;EAE3D,OAAOZ,6BAA6B,CAClC,CAACgB,MAAM,EAAEC,GAAG,EAAEC,MAAM,KAClBJ,QAAQ,CAACG,GAAG,EAAE;IACZD,MAAM;IACNG,IAAI,EAAED,MAAM,GAAGE,IAAI,CAACC,SAAS,CAACH,MAAM,CAACC,IAAI,CAAC,GAAGG;EAC/C,CAAC,CAAC,CACCC,IAAI,CAACtB,gBAAgB,CAAC,CACtBsB,IAAI,CAAEC,GAAG,IAAK;IACb,MAAMC,WAAW,GAAGD,GAAG,CAACE,OAAO,CAACC,GAAG,CAAC,cAAc,CAAC;IACnD,IAAIF,WAAW,KAAK,kBAAkB,EAAE;MACtC,OAAOD,GAAG,CAAClB,IAAI,CAAC,CAAC;IACnB;IACA,OAAOkB,GAAG,CAACI,IAAI,CAAC,CAAC;EACnB,CAAC,CAAC,EACNf,qBACF,CAAC;AACH,CAAC"}
|
@@ -1,9 +1,10 @@
|
|
1
1
|
import { getCredentialIssuerEntityConfiguration } from "../../trust";
|
2
2
|
/**
|
3
|
+
* WARNING: This function must be called after {@link startFlow}. The next function to be called is {@link startUserAuthorization}.
|
3
4
|
* The Issuer trust evaluation phase.
|
4
5
|
* Fetch the Issuer's configuration and verify trust.
|
5
6
|
*
|
6
|
-
* @param issuerUrl The base url of the Issuer
|
7
|
+
* @param issuerUrl The base url of the Issuer returned by {@link startFlow}
|
7
8
|
* @param context.appFetch (optional) fetch api implementation. Default: built-in fetch
|
8
9
|
* @returns The Issuer's configuration
|
9
10
|
*/
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["getCredentialIssuerEntityConfiguration","evaluateIssuerTrust","issuerUrl","context","arguments","length","undefined","issuerConf","appFetch","then","_","payload","metadata"],"sourceRoot":"../../../../src","sources":["credential/issuance/02-evaluate-issuer-trust.ts"],"mappings":"AAAA,SAASA,sCAAsC,QAAQ,aAAa;AAcpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,mBAAwC,GAAG,eAAAA,CACtDC,SAAS,EAEN;EAAA,IADHC,OAAO,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAEZ,MAAMG,UAAU,GAAG,MAAMP,sCAAsC,CAACE,SAAS,EAAE;IACzEM,QAAQ,EAAEL,OAAO,CAACK;EACpB,CAAC,CAAC,CAACC,IAAI,CAAEC,CAAC,IAAKA,CAAC,CAACC,OAAO,CAACC,QAAQ,CAAC;EAClC,OAAO;IAAEL;EAAW,CAAC;AACvB,CAAC"}
|
1
|
+
{"version":3,"names":["getCredentialIssuerEntityConfiguration","evaluateIssuerTrust","issuerUrl","context","arguments","length","undefined","issuerConf","appFetch","then","_","payload","metadata"],"sourceRoot":"../../../../src","sources":["credential/issuance/02-evaluate-issuer-trust.ts"],"mappings":"AAAA,SAASA,sCAAsC,QAAQ,aAAa;AAcpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,mBAAwC,GAAG,eAAAA,CACtDC,SAAS,EAEN;EAAA,IADHC,OAAO,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAEZ,MAAMG,UAAU,GAAG,MAAMP,sCAAsC,CAACE,SAAS,EAAE;IACzEM,QAAQ,EAAEL,OAAO,CAACK;EACpB,CAAC,CAAC,CAACC,IAAI,CAAEC,CAAC,IAAKA,CAAC,CAACC,OAAO,CAACC,QAAQ,CAAC;EAClC,OAAO;IAAEL;EAAW,CAAC;AACvB,CAAC"}
|