@pagopa/io-react-native-wallet 0.15.3 → 0.16.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. package/lib/commonjs/credential/index.js +3 -1
  2. package/lib/commonjs/credential/index.js.map +1 -1
  3. package/lib/commonjs/credential/issuance/04-complete-user-authorization.js +19 -4
  4. package/lib/commonjs/credential/issuance/04-complete-user-authorization.js.map +1 -1
  5. package/lib/commonjs/credential/issuance/05-authorize-access.js +9 -12
  6. package/lib/commonjs/credential/issuance/05-authorize-access.js.map +1 -1
  7. package/lib/commonjs/credential/issuance/06-obtain-credential.js +13 -2
  8. package/lib/commonjs/credential/issuance/06-obtain-credential.js.map +1 -1
  9. package/lib/commonjs/credential/status/01-start-flow.js +2 -0
  10. package/lib/commonjs/credential/status/01-start-flow.js.map +1 -0
  11. package/lib/commonjs/credential/status/02-status-attestation.js +72 -0
  12. package/lib/commonjs/credential/status/02-status-attestation.js.map +1 -0
  13. package/lib/commonjs/credential/status/03-verify-and-parse-status-attestation.js +52 -0
  14. package/lib/commonjs/credential/status/03-verify-and-parse-status-attestation.js.map +1 -0
  15. package/lib/commonjs/credential/status/errors.js +38 -0
  16. package/lib/commonjs/credential/status/errors.js.map +1 -0
  17. package/lib/commonjs/credential/status/index.js +27 -0
  18. package/lib/commonjs/credential/status/index.js.map +1 -0
  19. package/lib/commonjs/credential/status/types.js +48 -0
  20. package/lib/commonjs/credential/status/types.js.map +1 -0
  21. package/lib/commonjs/utils/errors.js +44 -2
  22. package/lib/commonjs/utils/errors.js.map +1 -1
  23. package/lib/commonjs/utils/misc.js +41 -3
  24. package/lib/commonjs/utils/misc.js.map +1 -1
  25. package/lib/commonjs/utils/par.js +1 -1
  26. package/lib/commonjs/utils/par.js.map +1 -1
  27. package/lib/module/credential/index.js +2 -1
  28. package/lib/module/credential/index.js.map +1 -1
  29. package/lib/module/credential/issuance/04-complete-user-authorization.js +21 -6
  30. package/lib/module/credential/issuance/04-complete-user-authorization.js.map +1 -1
  31. package/lib/module/credential/issuance/05-authorize-access.js +9 -12
  32. package/lib/module/credential/issuance/05-authorize-access.js.map +1 -1
  33. package/lib/module/credential/issuance/06-obtain-credential.js +13 -3
  34. package/lib/module/credential/issuance/06-obtain-credential.js.map +1 -1
  35. package/lib/module/credential/status/01-start-flow.js +2 -0
  36. package/lib/module/credential/status/01-start-flow.js.map +1 -0
  37. package/lib/module/credential/status/02-status-attestation.js +64 -0
  38. package/lib/module/credential/status/02-status-attestation.js.map +1 -0
  39. package/lib/module/credential/status/03-verify-and-parse-status-attestation.js +46 -0
  40. package/lib/module/credential/status/03-verify-and-parse-status-attestation.js.map +1 -0
  41. package/lib/module/credential/status/errors.js +30 -0
  42. package/lib/module/credential/status/errors.js.map +1 -0
  43. package/lib/module/credential/status/index.js +5 -0
  44. package/lib/module/credential/status/index.js.map +1 -0
  45. package/lib/module/credential/status/types.js +40 -0
  46. package/lib/module/credential/status/types.js.map +1 -0
  47. package/lib/module/utils/errors.js +40 -1
  48. package/lib/module/utils/errors.js.map +1 -1
  49. package/lib/module/utils/misc.js +38 -3
  50. package/lib/module/utils/misc.js.map +1 -1
  51. package/lib/module/utils/par.js +1 -1
  52. package/lib/module/utils/par.js.map +1 -1
  53. package/lib/typescript/credential/index.d.ts +2 -1
  54. package/lib/typescript/credential/index.d.ts.map +1 -1
  55. package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts +3 -1
  56. package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts.map +1 -1
  57. package/lib/typescript/credential/issuance/05-authorize-access.d.ts +2 -1
  58. package/lib/typescript/credential/issuance/05-authorize-access.d.ts.map +1 -1
  59. package/lib/typescript/credential/issuance/06-obtain-credential.d.ts +3 -1
  60. package/lib/typescript/credential/issuance/06-obtain-credential.d.ts.map +1 -1
  61. package/lib/typescript/credential/status/01-start-flow.d.ts +10 -0
  62. package/lib/typescript/credential/status/01-start-flow.d.ts.map +1 -0
  63. package/lib/typescript/credential/status/02-status-attestation.d.ts +20 -0
  64. package/lib/typescript/credential/status/02-status-attestation.d.ts.map +1 -0
  65. package/lib/typescript/credential/status/03-verify-and-parse-status-attestation.d.ts +24 -0
  66. package/lib/typescript/credential/status/03-verify-and-parse-status-attestation.d.ts.map +1 -0
  67. package/lib/typescript/credential/status/errors.d.ts +14 -0
  68. package/lib/typescript/credential/status/errors.d.ts.map +1 -0
  69. package/lib/typescript/credential/status/index.d.ts +7 -0
  70. package/lib/typescript/credential/status/index.d.ts.map +1 -0
  71. package/lib/typescript/credential/status/types.d.ts +305 -0
  72. package/lib/typescript/credential/status/types.d.ts.map +1 -0
  73. package/lib/typescript/utils/errors.d.ts +31 -0
  74. package/lib/typescript/utils/errors.d.ts.map +1 -1
  75. package/lib/typescript/utils/misc.d.ts +18 -1
  76. package/lib/typescript/utils/misc.d.ts.map +1 -1
  77. package/lib/typescript/utils/par.d.ts +1 -4
  78. package/lib/typescript/utils/par.d.ts.map +1 -1
  79. package/package.json +3 -3
  80. package/src/credential/index.ts +2 -1
  81. package/src/credential/issuance/04-complete-user-authorization.ts +36 -6
  82. package/src/credential/issuance/05-authorize-access.ts +13 -15
  83. package/src/credential/issuance/06-obtain-credential.ts +24 -4
  84. package/src/credential/status/01-start-flow.ts +9 -0
  85. package/src/credential/status/02-status-attestation.ts +101 -0
  86. package/src/credential/status/03-verify-and-parse-status-attestation.ts +60 -0
  87. package/src/credential/status/errors.ts +31 -0
  88. package/src/credential/status/index.ts +22 -0
  89. package/src/credential/status/types.ts +43 -0
  90. package/src/utils/errors.ts +46 -1
  91. package/src/utils/misc.ts +45 -4
  92. package/src/utils/par.ts +2 -2
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
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;
6
+ exports.serializeAttrs = exports.WalletProviderResponseError = exports.WalletInstanceRevokedError = exports.WalletInstanceNotFoundError = exports.WalletInstanceAttestationIssuingError = exports.ValidationFailed = exports.UnexpectedStatusCodeError = exports.PidMetadataError = exports.PidIssuingError = exports.OperationAbortedError = 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
  *
@@ -30,6 +30,7 @@ const serializeAttrs = attrs => Object.entries(attrs).map(_ref => {
30
30
  * }
31
31
  * ```
32
32
  */
33
+ exports.serializeAttrs = serializeAttrs;
33
34
  class IoWalletError extends Error {
34
35
  /** A unique error code for the particular error subclass. */
35
36
  static get code() {
@@ -46,11 +47,32 @@ class IoWalletError extends Error {
46
47
  (_Error$captureStackTr = Error.captureStackTrace) === null || _Error$captureStackTr === void 0 ? void 0 : _Error$captureStackTr.call(Error, this, this.constructor);
47
48
  }
48
49
  }
50
+
51
+ /**
52
+ * An error subclass thrown when a Wallet Provider http request has a status code different from the one expected.
53
+ */
54
+ exports.IoWalletError = IoWalletError;
55
+ class UnexpectedStatusCodeError extends IoWalletError {
56
+ static get code() {
57
+ return "ERR_UNEXPECTED_STATUS_CODE";
58
+ }
59
+ code = "ERR_UNEXPECTED_STATUS_CODE";
60
+
61
+ /** HTTP status code */
62
+
63
+ constructor(message, statusCode) {
64
+ super(serializeAttrs({
65
+ message,
66
+ statusCode: statusCode.toString()
67
+ }));
68
+ this.statusCode = statusCode;
69
+ }
70
+ }
49
71
  /**
50
72
  * An error subclass thrown when validation fail
51
73
  *
52
74
  */
53
- exports.IoWalletError = IoWalletError;
75
+ exports.UnexpectedStatusCodeError = UnexpectedStatusCodeError;
54
76
  class ValidationFailed extends IoWalletError {
55
77
  static get code() {
56
78
  return "ERR_IO_WALLET_VALIDATION_FAILED";
@@ -335,5 +357,25 @@ class AuthorizationIdpError extends IoWalletError {
335
357
  this.errorDescription = errorDescription;
336
358
  }
337
359
  }
360
+
361
+ /**
362
+ * Error subclass thrown when an operation has been aborted.
363
+ */
338
364
  exports.AuthorizationIdpError = AuthorizationIdpError;
365
+ class OperationAbortedError extends IoWalletError {
366
+ static get code() {
367
+ return "ERR_IO_WALLET_OPERATION_ABORTED";
368
+ }
369
+ code = "ERR_IO_WALLET_OPERATION_ABORTED";
370
+
371
+ /** The aborted operation */
372
+
373
+ constructor(operation) {
374
+ super(serializeAttrs({
375
+ operation
376
+ }));
377
+ this.operation = operation;
378
+ }
379
+ }
380
+ exports.OperationAbortedError = OperationAbortedError;
339
381
  //# 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","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,C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;EAEAA,IAAI,GAAG,kCAAkC;EAKzCC,WAAWA,CAACC,OAAe,EAAEO,KAAa,EAAkC;IAAA,IAAhCI,MAAc,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,aAAa;IACxE,KAAK,CAACxB,cAAc,CAAC;MAAEgB,OAAO;MAAEO,KAAK;MAAEI;IAAO,CAAC,CAAC,CAAC;IACjD,IAAI,CAACA,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACJ,KAAK,GAAGA,KAAK;EACpB;AACF;;AAEA;AACA;AACA;AAFAF,OAAA,CAAAqB,2BAAA,GAAAA,2BAAA;AAGO,MAAMC,kBAAkB,SAAS/B,aAAa,CAAC;EACpD,WAAWE,IAAIA,CAAA,EAAwC;IACrD,OAAO,mCAAmC;EAC5C;EAEAA,IAAI,GAAG,mCAAmC;EAE1CC,WAAWA,CAACC,OAAgB,EAAE;IAC5B,KAAK,CAACA,OAAO,CAAC;EAChB;AACF;;AAEA;AACA;AACA;AACA;AAHAK,OAAA,CAAAsB,kBAAA,GAAAA,kBAAA;AAIO,MAAMC,qBAAqB,SAAShC,aAAa,CAAC;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"}
1
+ {"version":3,"names":["serializeAttrs","attrs","Object","entries","map","_ref","k","v","Array","isArray","join","_","exports","IoWalletError","Error","code","constructor","message","_Error$captureStackTr","name","captureStackTrace","call","UnexpectedStatusCodeError","statusCode","toString","ValidationFailed","claim","arguments","length","undefined","reason","WalletInstanceAttestationIssuingError","AuthRequestDecodeError","PidIssuingError","ClaimsNotFoundBetweenDislosures","claims","c","ClaimsNotFoundInToken","NoSuitableKeysFoundInEntityConfiguration","scenario","PidMetadataError","WalletProviderResponseError","WalletInstanceRevokedError","WalletInstanceNotFoundError","AuthorizationError","AuthorizationIdpError","error","errorDescription","OperationAbortedError","operation"],"sourceRoot":"../../../src","sources":["utils/errors.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,cAAc,GACzBC,KAAsC,IAEtCC,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;AAVAE,OAAA,CAAAZ,cAAA,GAAAA,cAAA;AAWO,MAAMa,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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AAGA,SAAS;EAC5B;AACF;AAACrC,OAAA,CAAAoC,qBAAA,GAAAA,qBAAA"}
@@ -3,16 +3,18 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.until = exports.hasStatus = exports.generateRandomAlphaNumericString = void 0;
6
+ exports.until = exports.isDefined = exports.hasStatus = exports.getCredentialHashWithouDiscloures = exports.generateRandomAlphaNumericString = exports.createAbortPromiseFromSignal = void 0;
7
7
  var _errors = require("./errors");
8
+ var _jsSha = require("js-sha256");
8
9
  /**
9
10
  * Check if a response is in the expected status, other
10
- * @param status The expected status
11
+ * @param status - The expected status
12
+ * @throws {@link UnexpectedStatusCodeError} if the status is different from the one expected
11
13
  * @returns The given response object
12
14
  */
13
15
  const hasStatus = status => async res => {
14
16
  if (res.status !== status) {
15
- throw new _errors.IoWalletError(`Http request failed. Expected ${status}, got ${res.status}, url: ${res.url} with response: ${await res.text()}`);
17
+ throw new _errors.UnexpectedStatusCodeError(`Http request failed. Expected ${status}, got ${res.status}, url: ${res.url} with response: ${await res.text()}`, res.status);
16
18
  }
17
19
  return res;
18
20
  };
@@ -52,5 +54,41 @@ const until = (conditionFunction, timeoutSeconds) => new Promise((resolve, rejec
52
54
  };
53
55
  poll();
54
56
  });
57
+
58
+ /**
59
+ * Get the hash of a credential without discloures.
60
+ * A credential is a string like `header.body.sign~sd1~sd2....` where `~` is the separator between the credential and the discloures.
61
+ * @param credential - The credential to hash
62
+ * @returns The hash of the credential without discloures
63
+ */
55
64
  exports.until = until;
65
+ const getCredentialHashWithouDiscloures = async credential => {
66
+ const tildeIndex = credential.indexOf("~");
67
+ if (tildeIndex === -1) {
68
+ throw new _errors.IoWalletError("Invalid credential format");
69
+ }
70
+ return (0, _jsSha.sha256)(credential.slice(0, tildeIndex));
71
+ };
72
+
73
+ /**
74
+ * Creates a promise that waits until the provided signal is aborted.
75
+ * @returns {Object} An object with `listen` and `remove` methods to handle subscribing and unsubscribing.
76
+ */
77
+ exports.getCredentialHashWithouDiscloures = getCredentialHashWithouDiscloures;
78
+ const createAbortPromiseFromSignal = signal => {
79
+ let listener;
80
+ return {
81
+ listen: () => new Promise(resolve => {
82
+ if (signal.aborted) {
83
+ return resolve("OPERATION_ABORTED");
84
+ }
85
+ listener = () => resolve("OPERATION_ABORTED");
86
+ signal.addEventListener("abort", listener);
87
+ }),
88
+ remove: () => signal.removeEventListener("abort", listener)
89
+ };
90
+ };
91
+ exports.createAbortPromiseFromSignal = createAbortPromiseFromSignal;
92
+ const isDefined = x => Boolean(x);
93
+ exports.isDefined = isDefined;
56
94
  //# sourceMappingURL=misc.js.map
@@ -1 +1 @@
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,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;AAOA;AACA;AACA;AACA;AACA;AACO,MAAMO,gCAAgC,GAAIC,IAAY,IAC3DC,KAAK,CAACC,IAAI,CAACD,KAAK,CAACD,IAAI,CAAC,EAAE,MACtBG,IAAI,CAACC,KAAK,CAACD,IAAI,CAACE,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,CAACC,QAAQ,CAAC,EAAE,CAC5C,CAAC,CAACC,IAAI,CAAC,EAAE,CAAC;;AAEZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAVAT,OAAA,CAAAC,gCAAA,GAAAA,gCAAA;AAWO,MAAMS,KAAK,GAAGA,CACnBC,iBAAgC,EAChCC,cAAuB,KAEvB,IAAIC,OAAO,CAAO,CAACC,OAAO,EAAEC,MAAM,KAAK;EACrC,MAAMC,KAAK,GAAGC,IAAI,CAACC,GAAG,CAAC,CAAC;EACxB,MAAMC,IAAI,GAAGA,CAAA,KAAM;IACjB,IAAIR,iBAAiB,CAAC,CAAC,EAAE;MACvBG,OAAO,CAAC,CAAC;IACX,CAAC,MAAM,IACLF,cAAc,KAAKQ,SAAS,IAC5BH,IAAI,CAACC,GAAG,CAAC,CAAC,GAAGF,KAAK,IAAIJ,cAAc,GAAG,IAAI,EAC3C;MACAG,MAAM,CAAC,IAAIM,KAAK,CAAC,kBAAkB,CAAC,CAAC;IACvC,CAAC,MAAM;MACLC,UAAU,CAACH,IAAI,EAAE,GAAG,CAAC;IACvB;EACF,CAAC;EAEDA,IAAI,CAAC,CAAC;AACR,CAAC,CAAC;AAACnB,OAAA,CAAAU,KAAA,GAAAA,KAAA"}
1
+ {"version":3,"names":["_errors","require","_jsSha","hasStatus","status","res","UnexpectedStatusCodeError","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","getCredentialHashWithouDiscloures","credential","tildeIndex","indexOf","IoWalletError","sha256","slice","createAbortPromiseFromSignal","signal","listener","listen","aborted","addEventListener","remove","removeEventListener","isDefined","x","Boolean"],"sourceRoot":"../../../src","sources":["utils/misc.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,MAAME,SAAS,GACnBC,MA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
31
- appFetch = fetch
31
+ appFetch
32
32
  } = _ref;
33
33
  return async (clientId, codeVerifier, redirectUri, responseMode, parEndpoint, walletInstanceAttestation, authorizationDetails, assertionType) => {
34
34
  const wiaPublicKey = await wiaCryptoContext.getPublicKey();
@@ -1 +1 @@
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,kCA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AEL,QAAQ,CAACM,QAAQ,CAAC;IAC1B,CAAC,CAAC,CACCC,IAAI,CAAC,IAAAC,eAAS,EAAC,GAAG,CAAC,CAAC,CACpBD,IAAI,CAAEE,GAAG,IAAKA,GAAG,CAACC,IAAI,CAAC,CAAC,CAAC,CACzBH,IAAI,CAAEI,MAAM,IAAKA,MAAM,CAACC,WAAW,CAAC;EACzC,CAAC;AAAA;AAACpE,OAAA,CAAAG,cAAA,GAAAA,cAAA"}
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","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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K,WAAW,EAAE;MACjC+C,MAAM,EAAE,MAAM;MACdC,OAAO,EAAE;QACP,cAAc,EAAE;MAClB,CAAC;MACDC,IAAI,EAAEL,QAAQ,CAACM,QAAQ,CAAC;IAC1B,CAAC,CAAC,CACCC,IAAI,CAAC,IAAAC,eAAS,EAAC,GAAG,CAAC,CAAC,CACpBD,IAAI,CAAEE,GAAG,IAAKA,GAAG,CAACC,IAAI,CAAC,CAAC,CAAC,CACzBH,IAAI,CAAEI,MAAM,IAAKA,MAAM,CAACC,WAAW,CAAC;EACzC,CAAC;AAAA;AAACnE,OAAA,CAAAG,cAAA,GAAAA,cAAA"}
@@ -1,4 +1,5 @@
1
1
  import * as Issuance from "./issuance";
2
2
  import * as Presentation from "./presentation";
3
- export { Issuance, Presentation };
3
+ import * as Status from "./status";
4
+ export { Issuance, Presentation, Status };
4
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Issuance","Presentation"],"sourceRoot":"../../../src","sources":["credential/index.ts"],"mappings":"AAAA,OAAO,KAAKA,QAAQ,MAAM,YAAY;AACtC,OAAO,KAAKC,YAAY,MAAM,gBAAgB;AAE9C,SAASD,QAAQ,EAAEC,YAAY"}
1
+ {"version":3,"names":["Issuance","Presentation","Status"],"sourceRoot":"../../../src","sources":["credential/index.ts"],"mappings":"AAAA,OAAO,KAAKA,QAAQ,MAAM,YAAY;AACtC,OAAO,KAAKC,YAAY,MAAM,gBAAgB;AAC9C,OAAO,KAAKC,MAAM,MAAM,UAAU;AAElC,SAASF,QAAQ,EAAEC,YAAY,EAAEC,MAAM"}
@@ -1,7 +1,7 @@
1
1
  import { AuthorizationErrorShape, AuthorizationResultShape } from "../../utils/auth";
2
- import { hasStatus, until } from "../../utils/misc";
2
+ import { createAbortPromiseFromSignal, hasStatus, isDefined, until } from "../../utils/misc";
3
3
  import parseUrl from "parse-url";
4
- import { AuthorizationError, AuthorizationIdpError, ValidationFailed } from "../../utils/errors";
4
+ import { AuthorizationError, AuthorizationIdpError, OperationAbortedError, ValidationFailed } from "../../utils/errors";
5
5
  import { Linking } from "react-native";
6
6
  import { decode, encodeBase64, SignJWT } from "@pagopa/io-react-native-jwt";
7
7
  import { RequestObject } from "../presentation/types";
@@ -26,11 +26,13 @@ import { getJwtFromFormPost } from "../../utils/decoder";
26
26
  * If not specified, the default browser is used
27
27
  * @param idphint Unique identifier of the SPID IDP selected by the user
28
28
  * @param redirectUri The url to reach to complete the user authorization which is the custom URL scheme that the Wallet Instance is registered to handle, usually a custom URL or deeplink
29
+ * @param signal An optional {@link AbortSignal} to abort the operation when using the default browser
29
30
  * @throws {AuthorizationError} if an error occurs during the authorization process
30
31
  * @throws {AuthorizationIdpError} if an error occurs during the authorization process and the error is related to the IDP
32
+ * @throws {OperationAbortedError} if the caller aborts the operation via the provided signal
31
33
  * @returns the authorization response which contains code, state and iss
32
34
  */
33
- export const completeUserAuthorizationWithQueryMode = async (issuerRequestUri, clientId, issuerConf, idpHint, redirectUri, authorizationContext) => {
35
+ export const completeUserAuthorizationWithQueryMode = async (issuerRequestUri, clientId, issuerConf, idpHint, redirectUri, authorizationContext, signal) => {
34
36
  const authzRequestEndpoint = issuerConf.oauth_authorization_server.authorization_endpoint;
35
37
  const params = new URLSearchParams({
36
38
  client_id: clientId,
@@ -46,7 +48,7 @@ export const completeUserAuthorizationWithQueryMode = async (issuerRequestUri, c
46
48
  });
47
49
  } else {
48
50
  // handler for redirectUri
49
- Linking.addEventListener("url", _ref => {
51
+ const urlEventListener = Linking.addEventListener("url", _ref => {
50
52
  let {
51
53
  url
52
54
  } = _ref;
@@ -54,14 +56,27 @@ export const completeUserAuthorizationWithQueryMode = async (issuerRequestUri, c
54
56
  authRedirectUrl = url;
55
57
  }
56
58
  });
57
- const openAuthUrlInBrowser = Linking.openURL(authUrl);
59
+ const operationIsAborted = signal ? createAbortPromiseFromSignal(signal) : undefined;
60
+ await Linking.openURL(authUrl);
58
61
 
59
62
  /*
60
63
  * Waits for 120 seconds for the identificationRedirectUrl variable to be set
61
64
  * by the custom url handler. If the timeout is exceeded, throw an exception
62
65
  */
63
66
  const unitAuthRedirectIsNotUndefined = until(() => authRedirectUrl !== undefined, 120);
64
- await Promise.all([openAuthUrlInBrowser, unitAuthRedirectIsNotUndefined]);
67
+
68
+ /**
69
+ * Simultaneously listen for the abort signal (when provided) and the redirect url.
70
+ * The first event that occurs will resolve the promise.
71
+ * This is useful to properly cleanup when the caller aborts this operation.
72
+ */
73
+ const winner = await Promise.race([operationIsAborted === null || operationIsAborted === void 0 ? void 0 : operationIsAborted.listen(), unitAuthRedirectIsNotUndefined].filter(isDefined)).finally(() => {
74
+ urlEventListener.remove();
75
+ operationIsAborted === null || operationIsAborted === void 0 ? void 0 : operationIsAborted.remove();
76
+ });
77
+ if (winner === "OPERATION_ABORTED") {
78
+ throw new OperationAbortedError("DefaultQueryModeAuthorization");
79
+ }
65
80
  if (authRedirectUrl === undefined) {
66
81
  throw new AuthorizationError("Invalid authentication redirect url");
67
82
  }
@@ -1 +1 @@
1
- {"version":3,"names":["AuthorizationErrorShape","AuthorizationResultShape","hasStatus","until","parseUrl","AuthorizationError","AuthorizationIdpError","ValidationFailed","Linking","decode","encodeBase64","SignJWT","RequestObject","uuid","ResponseUriResultShape","getJwtFromFormPost","completeUserAuthorizationWithQueryMode","issuerRequestUri","clientId","issuerConf","idpHint","redirectUri","authorizationContext","authzRequestEndpoint","oauth_authorization_server","authorization_endpoint","params","URLSearchParams","client_id","request_uri","idphint","authUrl","authRedirectUrl","redirectSchema","URL","protocol","replace","authorize","catch","e","message","addEventListener","_ref","url","includes","openAuthUrlInBrowser","openURL","unitAuthRedirectIsNotUndefined","undefined","Promise","all","query","parseAuthroizationResponse","getRequestedCredentialToBePresented","appFetch","arguments","length","fetch","requestObject","toString","method","then","res","text","jws","reqObj","safeParse","payload","success","error","data","completeUserAuthorizationWithFormPostJwtMode","ctx","wiaCryptoContext","pidCryptoContext","pid","walletInstanceAttestation","wiaWpToken","setProtectedHeader","alg","typ","setPayload","vp","jti","v4","nonce","setIssuedAt","setExpirationTime","setAudience","response_uri","sign","pidWpToken","presentationSubmission","definition_id","id","descriptor_map","path","format","authzResponsePayload","JSON","stringify","state","presentation_submission","vp_token","body","response","resUriRes","headers","reqUri","json","responseUri","redirect_uri","cbRes","decodedJwt","authRes","authResParsed","authErr","error_description"],"sourceRoot":"../../../../src","sources":["credential/issuance/04-complete-user-authorization.ts"],"mappings":"AAAA,SACEA,uBAAuB,EACvBC,wBAAwB,QAGnB,kBAAkB;AACzB,SAASC,SAAS,EAAEC,KAAK,QAAkB,kBAAkB;AAE7D,OAAOC,QAAQ,MAAM,WAAW;AAChC,SACEC,kBAAkB,EAClBC,qBAAqB,EACrBC,gBAAgB,QACX,oBAAoB;AAE3B,SAASC,OAAO,QAAQ,cAAc;AACtC,SACEC,MAAM,EACNC,YAAY,EACZC,OAAO,QAEF,6BAA6B;AACpC,SAASC,aAAa,QAAQ,uBAAuB;AACrD,OAAOC,IAAI,MAAM,mBAAmB;AACpC,SAASC,sBAAsB,QAAQ,SAAS;AAChD,SAASC,kBAAkB,QAAQ,qBAAqB;;AAExD;AACA;AACA;;AA4BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,sCAA8E,GACzF,MAAAA,CACEC,gBAAgB,EAChBC,QAAQ,EACRC,UAAU,EACVC,OAAO,EACPC,WAAW,EACXC,oBAAoB,KACjB;EACH,MAAMC,oBAAoB,GACxBJ,UAAU,CAACK,0BAA0B,CAACC,sBAAsB;EAC9D,MAAMC,MAAM,GAAG,IAAIC,eAAe,CAAC;IACjCC,SAAS,EAAEV,QAAQ;IACnBW,WAAW,EAAEZ,gBAAgB;IAC7Ba,OAAO,EAAEV;EACX,CAAC,CAAC;EACF,MAAMW,OAAO,GAAI,GAAER,oBAAqB,IAAGG,MAAO,EAAC;EACnD,IAAIM,eAAmC;EAEvC,IAAIV,oBAAoB,EAA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C8D,OAAgB,IACQ;EACxB,MAAMC,aAAa,GAAGlH,wBAAwB,CAACiE,SAAS,CAACgD,OAAO,CAAC;EACjE,IAAI,CAACC,aAAa,CAAC/C,OAAO,EAAE;IAC1B,MAAMgD,OAAO,GAAGpH,uBAAuB,CAACkE,SAAS,CAACgD,OAAO,CAAC;IAC1D,IAAI,CAACE,OAAO,CAAChD,OAAO,EAAE;MACpB,MAAM,IAAI/D,kBAAkB,CAAC8G,aAAa,CAAC9C,KAAK,CAAC7B,OAAO,CAAC,CAAC,CAAC;IAC7D;;IACA,MAAM,IAAIlC,qBAAqB,CAC7B8G,OAAO,CAAC9C,IAAI,CAACD,KAAK,EAClB+C,OAAO,CAAC9C,IAAI,CAAC+C,iBACf,CAAC;EACH;EACA,OAAOF,aAAa,CAAC7C,IAAI;AAC3B,CAAC"}
1
+ {"version":3,"names":["AuthorizationErrorShape","AuthorizationResultShape","createAbortPromiseFromSignal","hasStatus","isDefined","until","parseUrl","AuthorizationError","AuthorizationIdpError","OperationAbortedError","ValidationFailed","Linking","decode","encodeBase64","SignJWT","RequestObject","uuid","ResponseUriResultShape","getJwtFromFormPost","completeUserAuthorizationWithQueryMode","issuerRequestUri","clientId","issuerConf","idpHint","redirectUri","authorizationContext","signal","authzRequestEndpoint","oauth_authorization_server","authorization_endpoint","params","URLSearchParams","client_id","request_uri","idphint","authUrl","authRedirectUrl","redirectSchema","URL","protocol","replace","authorize","catch","e","message","urlEventListener","addEventListener","_ref","url","includes","operationIsAborted","undefined","openURL","unitAuthRedirectIsNotUndefined","winner","Promise","race","listen","filter","finally","remove","query","parseAuthroizationResponse","getRequestedCredentialToBePresented","appFetch","arguments","length","fetch","requestObject","toString","method","then","res","text","jws","reqObj","safeParse","payload","success","error","data","completeUserAuthorizationWithFormPostJwtMode","ctx","wiaCryptoContext","pidCryptoContext","pid","walletInstanceAttestation","wiaWpToken","setProtectedHeader","alg","typ","setPayload","vp","jti","v4","nonce","setIssuedAt","setExpirationTime","setAudience","response_uri","sign","pidWpToken","presentationSubmission","definition_id","id","descriptor_map","path","format","authzResponsePayload","JSON","stringify","state","presentation_submission","vp_token","body","response","resUriRes","headers","reqUri","json","responseUri","redirect_uri","cbRes","decodedJwt","authRes","authResParsed","authErr","error_description"],"sourceRoot":"../../../../src","sources":["credential/issuance/04-complete-user-authorization.ts"],"mappings":"AAAA,SACEA,uBAAuB,EACvBC,wBAAwB,QAGnB,kBAAkB;AACzB,SACEC,4BAA4B,EAC5BC,SAAS,EACTC,SAAS,EACTC,KAAK,QAEA,kBAAkB;AAEzB,OAAOC,QAAQ,MAAM,WAAW;AAChC,SACEC,kBAAkB,EAClBC,qBAAqB,EACrBC,qBAAqB,EACrBC,gBAAgB,QACX,oBAAoB;AAE3B,SAASC,OAAO,QAAQ,cAAc;AACtC,SACEC,MAAM,EACNC,YAAY,EACZC,OAAO,QAEF,6BAA6B;AACpC,SAASC,aAAa,QAAQ,uBAAuB;AACrD,OAAOC,IAAI,MAAM,mBAAmB;AACpC,SAASC,sBAAsB,QAAQ,SAAS;AAChD,SAASC,kBAAkB,QAAQ,qBAAqB;;AAExD;AACA;AACA;;AA6BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,sCAA8E,GACzF,MAAAA,CACEC,gBAAgB,EAChBC,QAAQ,EACRC,UAAU,EACVC,OAAO,EACPC,WAAW,EACXC,oBAAoB,EACpBC,MAAM,KACH;EACH,MAAMC,oBAAoB,GACxBL,UAAU,CAACM,0BAA0B,CAACC,sBAAsB;EAC9D,MAAMC,MAAM,GAAG,IAAIC,eAAe,CAAC;IACjCC,SAAS,EAAEX,QAAQ;IACnBY,WAAW,EAAEb,gBAAgB;IAC7Bc,OAAO,EAAEX;EACX,CAAC,CAAC;EACF,MAAMY,OAAO,GAAI,GAAER,oBAAqB,IAAGG,MAAO,EAAC;EACnD,IAAIM,eAAmC;EAEvC,IAAIX,oBAA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pE,gBAAgB,CACxB,gCAAgC,EAChC8G,WAAW,CAACzC,KAAK,CAACnC,OACpB,CAAC;EACH;EAEA,OAAO,MAAMoB,QAAQ,CAACwD,WAAW,CAACxC,IAAI,CAACyC,YAAY,CAAC,CACjDlD,IAAI,CAACpE,SAAS,CAAC,GAAG,CAAC,CAAC,CACpBoE,IAAI,CAAEC,GAAG,IAAKA,GAAG,CAACC,IAAI,CAAC,CAAC,CAAC,CACzBF,IAAI,CAACrD,kBAAkB,CAAC,CACxBqD,IAAI,CAAEmD,KAAK,IAAK5D,0BAA0B,CAAC4D,KAAK,CAACC,UAAU,CAAC9C,OAAO,CAAC,CAAC;AAC1E,CAAC;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMf,0BAA0B,GACrC8D,OAAgB,IACQ;EACxB,MAAMC,aAAa,GAAG5H,wBAAwB,CAAC2E,SAAS,CAACgD,OAAO,CAAC;EACjE,IAAI,CAACC,aAAa,CAAC/C,OAAO,EAAE;IAC1B,MAAMgD,OAAO,GAAG9H,uBAAuB,CAAC4E,SAAS,CAACgD,OAAO,CAAC;IAC1D,IAAI,CAACE,OAAO,CAAChD,OAAO,EAAE;MACpB,MAAM,IAAIvE,kBAAkB,CAACsH,aAAa,CAAC9C,KAAK,CAACnC,OAAO,CAAC,CAAC,CAAC;IAC7D;;IACA,MAAM,IAAIpC,qBAAqB,CAC7BsH,OAAO,CAAC9C,IAAI,CAACD,KAAK,EAClB+C,OAAO,CAAC9C,IAAI,CAAC+C,iBACf,CAAC;EACH;EACA,OAAOF,aAAa,CAAC7C,IAAI;AAC3B,CAAC"}
@@ -1,5 +1,4 @@
1
1
  import { hasStatus } from "../../utils/misc";
2
- import { withEphemeralKey } from "../../utils/crypto";
3
2
  import { createDPopToken } from "../../utils/dpop";
4
3
  import uuid from "react-native-uuid";
5
4
  import { createPopToken } from "../../utils/pop";
@@ -19,6 +18,7 @@ import { ValidationFailed } from "../../utils/errors";
19
18
  * @param codeVerifier The code verifier returned by {@link startUserAuthorization}
20
19
  * @param context.walletInstanceAttestation The Wallet Instance's attestation
21
20
  * @param context.wiaCryptoContext The Wallet Instance's crypto context
21
+ * @param context.dPopCryptoContext The DPoP crypto context
22
22
  * @param context.appFetch (optional) fetch api implementation. Default: built-in fetch
23
23
  * @throws {ValidationFailed} if an error occurs while parsing the token response
24
24
  * @return The token response containing the access token along with the token request signed with DPoP which has to be used in the {@link obtainCredential} step.
@@ -27,21 +27,19 @@ export const authorizeAccess = async (issuerConf, code, clientId, redirectUri, c
27
27
  const {
28
28
  appFetch = fetch,
29
29
  walletInstanceAttestation,
30
- wiaCryptoContext
30
+ wiaCryptoContext,
31
+ dPopCryptoContext
31
32
  } = context;
32
33
  const parEndpoint = issuerConf.oauth_authorization_server.pushed_authorization_request_endpoint;
33
34
  const parUrl = new URL(parEndpoint);
34
35
  const aud = `${parUrl.protocol}//${parUrl.hostname}`;
35
36
  const iss = WalletInstanceAttestation.decode(walletInstanceAttestation).payload.cnf.jwk.kid;
36
37
  const tokenUrl = issuerConf.oauth_authorization_server.token_endpoint;
37
- // Use an ephemeral key to be destroyed after use
38
- const tokenRequestSignedDPop = await withEphemeralKey(async ephimeralContext => {
39
- return await createDPopToken({
40
- htm: "POST",
41
- htu: tokenUrl,
42
- jti: `${uuid.v4()}`
43
- }, ephimeralContext);
44
- });
38
+ const tokenRequestSignedDPop = await createDPopToken({
39
+ htm: "POST",
40
+ htu: tokenUrl,
41
+ jti: `${uuid.v4()}`
42
+ }, dPopCryptoContext);
45
43
  const signedWiaPoP = await createPopToken({
46
44
  jti: `${uuid.v4()}`,
47
45
  aud,
@@ -69,8 +67,7 @@ export const authorizeAccess = async (issuerConf, code, clientId, redirectUri, c
69
67
  throw new ValidationFailed(tokenRes.error.message);
70
68
  }
71
69
  return {
72
- accessToken: tokenRes.data,
73
- tokenRequestSignedDPop
70
+ accessToken: tokenRes.data
74
71
  };
75
72
  };
76
73
  //# sourceMappingURL=05-authorize-access.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["hasStatus","withEphemeralKey","createDPopToken","uuid","createPopToken","WalletInstanceAttestation","ASSERTION_TYPE","TokenResponse","ValidationFailed","authorizeAccess","issuerConf","code","clientId","redirectUri","codeVerifier","context","appFetch","fetch","walletInstanceAttestation","wiaCryptoContext","parEndpoint","oauth_authorization_server","pushed_authorization_request_endpoint","parUrl","URL","aud","protocol","hostname","iss","decode","payload","cnf","jwk","kid","tokenUrl","token_endpoint","tokenRequestSignedDPop","ephimeralContext","htm","htu","jti","v4","signedWiaPoP","requestBody","grant_type","client_id","redirect_uri","code_verifier","client_assertion_type","client_assertion","authorizationRequestFormBody","URLSearchParams","tokenRes","method","headers","DPoP","body","toString","then","res","json","safeParse","success","error","message","accessToken","data"],"sourceRoot":"../../../../src","sources":["credential/issuance/05-authorize-access.ts"],"mappings":"AAAA,SAASA,SAAS,QAAkB,kBAAkB;AAGtD,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,eAAe,QAAQ,kBAAkB;AAClD,OAAOC,IAAI,MAAM,mBAAmB;AACpC,SAASC,cAAc,QAAQ,iBAAiB;AAChD,OAAO,KAAKC,yBAAyB,MAAM,mCAAmC;AAE9E,SAASC,cAAc,QAAQ,SAAS;AACxC,SAASC,aAAa,QAAQ,SAAS;AACvC,SAASC,gBAAgB,QAAQ,oBAAoB;AAgBrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,eAAgC,GAAG,MAAAA,CAC9CC,UAAU,EACVC,IAAI,EACJC,QAAQ,EACRC,WAAW,EACXC,YAAY,EACZC,OAAO,KACJ;EACH,MAAM;IACJC,QAAQ,GAAGC,KAAK;IAChBC,yBAAyB;IACzBC;EACF,CAAC,GAAGJ,OAAO;EAEX,MAAMK,WAAW,GACfV,UAAU,CAACW,0BAA0B,CAACC,qCAAqC;EAC7E,MAAMC,MAAM,GAAG,IAAIC,GAAG,CAACJ,WAA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,CAAC,CACCC,IAAI,CAAC1D,SAAS,CAAC,GAAG,CAAC,CAAC,CACpB0D,IAAI,CAAEC,GAAG,IAAKA,GAAG,CAACC,IAAI,CAAC,CAAC,CAAC,CACzBF,IAAI,CAAEF,IAAI,IAAKjD,aAAa,CAACsD,SAAS,CAACL,IAAI,CAAC,CAAC;EAEhD,IAAI,CAACJ,QAAQ,CAACU,OAAO,EAAE;IACrB,MAAM,IAAItD,gBAAgB,CAAC4C,QAAQ,CAACW,KAAK,CAACC,OAAO,CAAC;EACpD;EAEA,OAAO;IAAEC,WAAW,EAAEb,QAAQ,CAACc,IAAI;IAAE9B;EAAuB,CAAC;AAC/D,CAAC"}
1
+ {"version":3,"names":["hasStatus","createDPopToken","uuid","createPopToken","WalletInstanceAttestation","ASSERTION_TYPE","TokenResponse","ValidationFailed","authorizeAccess","issuerConf","code","clientId","redirectUri","codeVerifier","context","appFetch","fetch","walletInstanceAttestation","wiaCryptoContext","dPopCryptoContext","parEndpoint","oauth_authorization_server","pushed_authorization_request_endpoint","parUrl","URL","aud","protocol","hostname","iss","decode","payload","cnf","jwk","kid","tokenUrl","token_endpoint","tokenRequestSignedDPop","htm","htu","jti","v4","signedWiaPoP","requestBody","grant_type","client_id","redirect_uri","code_verifier","client_assertion_type","client_assertion","authorizationRequestFormBody","URLSearchParams","tokenRes","method","headers","DPoP","body","toString","then","res","json","safeParse","success","error","message","accessToken","data"],"sourceRoot":"../../../../src","sources":["credential/issuance/05-authorize-access.ts"],"mappings":"AAAA,SAASA,SAAS,QAAkB,kBAAkB;AAGtD,SAASC,eAAe,QAAQ,kBAAkB;AAClD,OAAOC,IAAI,MAAM,mBAAmB;AACpC,SAASC,cAAc,QAAQ,iBAAiB;AAChD,OAAO,KAAKC,yBAAyB,MAAM,mCAAmC;AAE9E,SAASC,cAAc,QAAQ,SAAS;AACxC,SAASC,aAAa,QAAQ,SAAS;AACvC,SAASC,gBAAgB,QAAQ,oBAAoB;AAiBrD;AACA;AACA;AACA;AACA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,GAAG,GAAGwB;EACtD,CAAC;EAED,MAAMQ,4BAA4B,GAAG,IAAIC,eAAe,CAACR,WAAW,CAAC;EACrE,MAAMS,QAAQ,GAAG,MAAMpC,QAAQ,CAACmB,QAAQ,EAAE;IACxCkB,MAAM,EAAE,MAAM;IACdC,OAAO,EAAE;MACP,cAAc,EAAE,mCAAmC;MACnDC,IAAI,EAAElB;IACR,CAAC;IACDmB,IAAI,EAAEN,4BAA4B,CAACO,QAAQ,CAAC;EAC9C,CAAC,CAAC,CACCC,IAAI,CAACzD,SAAS,CAAC,GAAG,CAAC,CAAC,CACpByD,IAAI,CAAEC,GAAG,IAAKA,GAAG,CAACC,IAAI,CAAC,CAAC,CAAC,CACzBF,IAAI,CAAEF,IAAI,IAAKjD,aAAa,CAACsD,SAAS,CAACL,IAAI,CAAC,CAAC;EAEhD,IAAI,CAACJ,QAAQ,CAACU,OAAO,EAAE;IACrB,MAAM,IAAItD,gBAAgB,CAAC4C,QAAQ,CAACW,KAAK,CAACC,OAAO,CAAC;EACpD;EAEA,OAAO;IAAEC,WAAW,EAAEb,QAAQ,CAACc;EAAK,CAAC;AACvC,CAAC"}
@@ -1,7 +1,9 @@
1
- import { SignJWT } from "@pagopa/io-react-native-jwt";
1
+ import { sha256ToBase64, SignJWT } from "@pagopa/io-react-native-jwt";
2
2
  import { hasStatus } from "../../utils/misc";
3
3
  import { ValidationFailed } from "../../utils/errors";
4
4
  import { CredentialResponse } from "./types";
5
+ import { createDPopToken } from "../../utils/dpop";
6
+ import uuid from "react-native-uuid";
5
7
  export const createNonceProof = async (nonce, issuer, audience, ctx) => {
6
8
  const jwk = await ctx.getPublicKey();
7
9
  return new SignJWT(ctx).setPayload({
@@ -24,13 +26,15 @@ export const createNonceProof = async (nonce, issuer, audience, ctx) => {
24
26
  * @param credentialDefinition The credential definition of the credential to be obtained returned by {@link startUserAuthorization}
25
27
  * @param tokenRequestSignedDPop The DPoP signed token request returned by {@link authorizeAccess}
26
28
  * @param context.credentialCryptoContext The crypto context used to obtain the credential
29
+ * @param context.dPopCryptoContext The DPoP crypto context
27
30
  * @param context.appFetch (optional) fetch api implementation. Default: built-in fetch
28
31
  * @returns The credential response containing the credential
29
32
  */
30
- export const obtainCredential = async (issuerConf, accessToken, clientId, credentialDefinition, tokenRequestSignedDPop, context) => {
33
+ export const obtainCredential = async (issuerConf, accessToken, clientId, credentialDefinition, context) => {
31
34
  const {
32
35
  credentialCryptoContext,
33
- appFetch = fetch
36
+ appFetch = fetch,
37
+ dPopCryptoContext
34
38
  } = context;
35
39
  const credentialUrl = issuerConf.openid_credential_issuer.credential_endpoint;
36
40
 
@@ -58,6 +62,12 @@ export const obtainCredential = async (issuerConf, accessToken, clientId, creden
58
62
  proof_type: "jwt"
59
63
  }
60
64
  };
65
+ const tokenRequestSignedDPop = await await createDPopToken({
66
+ htm: "POST",
67
+ htu: credentialUrl,
68
+ jti: `${uuid.v4()}`,
69
+ ath: await sha256ToBase64(accessToken.access_token)
70
+ }, dPopCryptoContext);
61
71
  const credentialRes = await appFetch(credentialUrl, {
62
72
  method: "POST",
63
73
  headers: {
@@ -1 +1 @@
1
- {"version":3,"names":["SignJWT","hasStatus","ValidationFailed","CredentialResponse","createNonceProof","nonce","issuer","audience","ctx","jwk","getPublicKey","setPayload","setProtectedHeader","typ","setAudience","setIssuer","setIssuedAt","setExpirationTime","sign","obtainCredential","issuerConf","accessToken","clientId","credentialDefinition","tokenRequestSignedDPop","context","credentialCryptoContext","appFetch","fetch","credentialUrl","openid_credential_issuer","credential_endpoint","signedNonceProof","c_nonce","constainsCredentialDefinition","authorization_details","some","c","credential_configuration_id","format","type","credentialRequestFormBody","credential_definition","proof","jwt","proof_type","credentialRes","method","headers","DPoP","Authorization","token_type","access_token","body","JSON","stringify","then","res","json","safeParse","success","error","message","data"],"sourceRoot":"../../../../src","sources":["credential/issuance/06-obtain-credential.ts"],"mappings":"AAAA,SAASA,OAAO,QAA4B,6BAA6B;AAGzE,SAASC,SAAS,QAAkB,kBAAk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ACxCF,CAAC,CAACG,IAAI,KAAKjB,oBAAoB,CAACiB,IACpC,CAAC;EAED,IAAI,CAACN,6BAA6B,EAAE;IAClC,MAAM,IAAIhC,gBAAgB,CACxB,qEACF,CAAC;EACH;;EAEA;EACA,MAAMuC,yBAAyB,GAAG;IAChCC,qBAAqB,EAAE;MACrBF,IAAI,EAAE,CAACjB,oBAAoB,CAACe,2BAA2B;IACzD,CAAC;IACDC,MAAM,EAAEhB,oBAAoB,CAACgB,MAAM;IACnCI,KAAK,EAAE;MACLC,GAAG,EAAEZ,gBAAgB;MACrBa,UAAU,EAAE;IACd;EACF,CAAC;EAED,MAAMC,aAAa,GAAG,MAAMnB,QAAQ,CAACE,aAAa,EAAE;IAClDkB,MAAM,EAAE,MAAM;IACdC,OAAO,EAAE;MACP,cAAc,EAAE,kBAAkB;MAClCC,IAAI,EAAEzB,sBAAsB;MAC5B0B,aAAa,EAAG,GAAE7B,WAAW,CAAC8B,UAAW,IAAG9B,WAAW,CAAC+B,YAAa;IACvE,CAAC;IACDC,IAAI,EAAEC,IAAI,CAACC,SAAS,CAACd,yBAAyB;EAChD,CAAC,CAAC,CACCe,IAAI,CAACvD,SAAS,CAAC,GAAG,CAAC,CAAC,CACpBuD,IAAI,CAAEC,GAAG,IAAKA,GAAG,CAACC,IAAI,CAAC,CAAC,CAAC,CACzBF,IAAI,CAAEH,IAAI,IAAKlD,kBAAkB,CAACwD,SAAS,CAACN,IAAI,CAAC,CAAC;EAErD,IAAI,CAACP,aAAa,CAACc,OAAO,EAAE;IAC1B,MAAM,IAAI1D,gBAAgB,CAAC4C,aAAa,CAACe,KAAK,CAACC,OAAO,CAAC;EACzD;EAEA,OAAOhB,aAAa,CAACiB,IAAI;AAC3B,CAAC"}
1
+ {"version":3,"names":["sha256ToBase64","SignJWT","hasStatus","ValidationFailed","CredentialResponse","createDPopToken","uuid","createNonceProof","nonce","issuer","audience","ctx","jwk","getPublicKey","setPayload","setProtectedHeader","typ","setAudience","setIssuer","setIssuedAt","setExpirationTime","sign","obtainCredential","issuerConf","accessToken","clientId","credentialDefinition","context","credentialCryptoContext","appFetch","fetch","dPopCryptoContext","credentialUrl","openid_credential_issuer","credential_endpoint","signedNonceProof","c_nonce","constainsCredentialDefinition","authorization_details","some","c","credential_configuration_id","format","type","credentialRequestFormBody","credential_definition","proof","jwt","proof_type","tokenRequestSignedDPop","htm","htu","jti","v4","ath","access_token","credentialRes","method","headers","DPoP","Authorization","token_type","body","JSON","stringify","then","res","json","safeParse","success","error","message","data"],"sourceRoot":"../../../../src","sources":["credential/issuance/06-obtain-credential.ts"],"mappings":"AAAA,SACEA,cAAc,EACdC,OAAO,QAEF,6BAA6B;AAGpC,SAASC,SAAS,QAAkB,kBAAkB;AAEtD,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,kBAAkB,QAAQ,SAAS;AAE5C,SAASC,eAAe,QAAQ,kBAAkB;AAClD,OAAOC,IAAI,MAAM,mBAAmB;AAcpC,OAAO,MAAMC,gBAAgB,GAAG,MAAAA,CAC9BC,KAAa,EACbC,MAAc,EACdC,QAAgB,EAChBC,GAAkB,KACE;EACpB,MAAMC,GAAG,GAAG,MAAMD,GAAG,CAACE,YAAY,CAAC,CAAC;EACpC,OAAO,IAAIZ,OAAO,CAACU,GAAG,CAAC,CACpBG,UAAU,CAAC;IACVN;EACF,CAAC,CAAC,CACDO,kBAAkB,CAAC;IAClBC,GAAG,EAAE,sBAAsB;IAC3BJ;EACF,CAAC,CAAC,CACDK,WAAW,CAACP,QAAQ,CAAC,CACrBQ,SAAS,CAACT,MAAM,CAAC,CACjBU,WAAW,CAAC,CAAC,CACbC,iBAAiB,CAAC,MAAM,CAAC,CACzBC,IAAI,CAAC,CAAC;AACX,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,gBAAkC,GAAG,MAAAA,CAChDC,UAAU,EACVC,WAAW,EACXC,QAAQ,E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DyB,MAAM,EAAE,MAAM;IACdC,OAAO,EAAE;MACP,cAAc,EAAE,kBAAkB;MAClCC,IAAI,EAAEV,sBAAsB;MAC5BW,aAAa,EAAG,GAAEpC,WAAW,CAACqC,UAAW,IAAGrC,WAAW,CAAC+B,YAAa;IACvE,CAAC;IACDO,IAAI,EAAEC,IAAI,CAACC,SAAS,CAACpB,yBAAyB;EAChD,CAAC,CAAC,CACCqB,IAAI,CAAC/D,SAAS,CAAC,GAAG,CAAC,CAAC,CACpB+D,IAAI,CAAEC,GAAG,IAAKA,GAAG,CAACC,IAAI,CAAC,CAAC,CAAC,CACzBF,IAAI,CAAEH,IAAI,IAAK1D,kBAAkB,CAACgE,SAAS,CAACN,IAAI,CAAC,CAAC;EAErD,IAAI,CAACN,aAAa,CAACa,OAAO,EAAE;IAC1B,MAAM,IAAIlE,gBAAgB,CAACqD,aAAa,CAACc,KAAK,CAACC,OAAO,CAAC;EACzD;EAEA,OAAOf,aAAa,CAACgB,IAAI;AAC3B,CAAC"}
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=01-start-flow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../../src","sources":["credential/status/01-start-flow.ts"],"mappings":""}
@@ -0,0 +1,64 @@
1
+ import { getCredentialHashWithouDiscloures, hasStatus } from "../../utils/misc";
2
+ import { SignJWT } from "@pagopa/io-react-native-jwt";
3
+ import uuid from "react-native-uuid";
4
+ import { StatusAttestationResponse } from "./types";
5
+ import { UnexpectedStatusCodeError } from "../../utils/errors";
6
+ import { StatusAttestationError, StatusAttestationInvalid } from "./errors";
7
+ /**
8
+ * WARNING: This function must be called after {@link startFlow}.
9
+ * Verify the status of the credential attestation.
10
+ * @param issuerConf - The issuer's configuration
11
+ * @param credential - The credential to be verified
12
+ * @param credentialCryptoContext - The credential's crypto context
13
+ * @param context.appFetch (optional) fetch api implementation. Default: built-in fetch
14
+ * @throws {@link StatusAttestationInvalid} if the status attestation is invalid and thus the credential is not valid
15
+ * @throws {@link StatusAttestationError} if an error occurs during the status attestation
16
+ * @returns The credential status attestation
17
+ */
18
+ export const statusAttestation = async function (issuerConf, credential, credentialCryptoContext) {
19
+ let appFetch = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : fetch;
20
+ const jwk = await credentialCryptoContext.getPublicKey();
21
+ const credentialHash = await getCredentialHashWithouDiscloures(credential);
22
+ const statusAttUrl = issuerConf.openid_credential_issuer.status_attestation_endpoint;
23
+ const credentialPop = await new SignJWT(credentialCryptoContext).setPayload({
24
+ aud: statusAttUrl,
25
+ jti: uuid.v4().toString(),
26
+ credential_hash: credentialHash,
27
+ credential_hash_alg: "S256"
28
+ }).setProtectedHeader({
29
+ alg: "ES256",
30
+ typ: "status-attestation-request+jwt",
31
+ kid: jwk.kid
32
+ }).setIssuedAt().setExpirationTime("5m").sign();
33
+ const body = {
34
+ credential_pop: credentialPop
35
+ };
36
+ const result = await appFetch(statusAttUrl, {
37
+ method: "POST",
38
+ headers: {
39
+ "Content-Type": "application/json"
40
+ },
41
+ body: JSON.stringify(body)
42
+ }).then(hasStatus(201)).then(raw => raw.json()).then(json => StatusAttestationResponse.parse(json)).catch(handleStatusAttestationError);
43
+ return {
44
+ statusAttestation: result.status_attestation
45
+ };
46
+ };
47
+
48
+ /**
49
+ * Handle the status attestation error by mapping it to a custom exception.
50
+ * If the error is not an instance of {@link UnexpectedStatusCodeError}, it is thrown as is.
51
+ * @param e - The error to be handled
52
+ * @throws {@link StatusAttestationError} if the status code is different from 404
53
+ * @throws {@link StatusAttestationInvalid} if the status code is 404 (meaning the credential is invalid)
54
+ */
55
+ const handleStatusAttestationError = e => {
56
+ if (!(e instanceof UnexpectedStatusCodeError)) {
57
+ throw e;
58
+ }
59
+ if (e.statusCode === 404) {
60
+ throw new StatusAttestationInvalid("Invalid status found for the given credential", e.message);
61
+ }
62
+ throw new StatusAttestationError(`Unable to obtain the status attestation for the given credential [response status code: ${e.statusCode}]`, e.message);
63
+ };
64
+ //# sourceMappingURL=02-status-attestation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["getCredentialHashWithouDiscloures","hasStatus","SignJWT","uuid","StatusAttestationResponse","UnexpectedStatusCodeError","StatusAttestationError","StatusAttestationInvalid","statusAttestation","issuerConf","credential","credentialCryptoContext","appFetch","arguments","length","undefined","fetch","jwk","getPublicKey","credentialHash","statusAttUrl","openid_credential_issuer","status_attestation_endpoint","credentialPop","setPayload","aud","jti","v4","toString","credential_hash","credential_hash_alg","setProtectedHeader","alg","typ","kid","setIssuedAt","setExpirationTime","sign","body","credential_pop","result","method","headers","JSON","stringify","then","raw","json","parse","catch","handleStatusAttestationError","status_attestation","e","statusCode","message"],"sourceRoot":"../../../../src","sources":["credential/status/02-status-attestation.ts"],"mappings":"AAAA,SACEA,iCAAiC,EACjCC,SAAS,QAEJ,kBAAkB;AAEzB,SAASC,OAAO,QAA4B,6BAA6B;AACzE,OAAOC,IAAI,MAAM,mBAAmB;AACpC,SAASC,yBAAyB,QAAQ,SAAS;AACnD,SAASC,yBAAyB,QAAQ,oBAAoB;AAC9D,SAASC,sBAAsB,EAAEC,wBAAwB,QAAQ,UAAU;AAW3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,iBAAoC,GAAG,eAAAA,CAClDC,UAAU,EACVC,UAAU,EACVC,uBAAuB,EAEpB;EAAA,IADHC,QAA8B,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGG,KAAK;EAEtC,MAAMC,GAAG,GAAG,MAAMN,uBAAuB,CAACO,YAAY,CAAC,CAAC;EACxD,MAAMC,cAAc,GAAG,MAAMnB,iCAAiC,CAACU,UAAU,CAAC;EAC1E,MAAMU,YAAY,GAChBX,UAAU,CAACY,wBAAwB,CAACC,2BAA2B;EACjE,MAAMC,aAAa,GAAG,MAAM,IAAIrB,OAAO,CAACS,uBAAuB,CAAC,CAC7Da,UAAU,CA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