@pagopa/io-react-native-wallet 0.25.0 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/README.md +1 -35
  2. package/lib/commonjs/credential/issuance/03-start-user-authorization.js +1 -1
  3. package/lib/commonjs/credential/issuance/04-complete-user-authorization.js +19 -57
  4. package/lib/commonjs/credential/issuance/04-complete-user-authorization.js.map +1 -1
  5. package/lib/commonjs/credential/issuance/05-authorize-access.js +1 -0
  6. package/lib/commonjs/credential/issuance/05-authorize-access.js.map +1 -1
  7. package/lib/commonjs/credential/issuance/06-obtain-credential.js +1 -2
  8. package/lib/commonjs/credential/issuance/06-obtain-credential.js.map +1 -1
  9. package/lib/commonjs/credential/issuance/errors.js +1 -18
  10. package/lib/commonjs/credential/issuance/errors.js.map +1 -1
  11. package/lib/commonjs/credential/issuance/index.js +6 -0
  12. package/lib/commonjs/credential/issuance/index.js.map +1 -1
  13. package/lib/commonjs/credential/status/02-status-attestation.js +2 -4
  14. package/lib/commonjs/credential/status/02-status-attestation.js.map +1 -1
  15. package/lib/commonjs/index.js +1 -3
  16. package/lib/commonjs/index.js.map +1 -1
  17. package/lib/commonjs/utils/misc.js +19 -58
  18. package/lib/commonjs/utils/misc.js.map +1 -1
  19. package/lib/commonjs/wallet-instance-attestation/issuing.js +1 -2
  20. package/lib/commonjs/wallet-instance-attestation/issuing.js.map +1 -1
  21. package/lib/module/credential/issuance/03-start-user-authorization.js +1 -1
  22. package/lib/module/credential/issuance/04-complete-user-authorization.js +19 -58
  23. package/lib/module/credential/issuance/04-complete-user-authorization.js.map +1 -1
  24. package/lib/module/credential/issuance/05-authorize-access.js +1 -0
  25. package/lib/module/credential/issuance/05-authorize-access.js.map +1 -1
  26. package/lib/module/credential/issuance/06-obtain-credential.js +1 -2
  27. package/lib/module/credential/issuance/06-obtain-credential.js.map +1 -1
  28. package/lib/module/credential/issuance/errors.js +0 -16
  29. package/lib/module/credential/issuance/errors.js.map +1 -1
  30. package/lib/module/credential/issuance/index.js +2 -2
  31. package/lib/module/credential/issuance/index.js.map +1 -1
  32. package/lib/module/credential/status/02-status-attestation.js +2 -4
  33. package/lib/module/credential/status/02-status-attestation.js.map +1 -1
  34. package/lib/module/index.js +1 -2
  35. package/lib/module/index.js.map +1 -1
  36. package/lib/module/utils/misc.js +14 -51
  37. package/lib/module/utils/misc.js.map +1 -1
  38. package/lib/module/wallet-instance-attestation/issuing.js +1 -2
  39. package/lib/module/wallet-instance-attestation/issuing.js.map +1 -1
  40. package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts +1 -1
  41. package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts +16 -15
  42. package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts.map +1 -1
  43. package/lib/typescript/credential/issuance/05-authorize-access.d.ts +1 -0
  44. package/lib/typescript/credential/issuance/05-authorize-access.d.ts.map +1 -1
  45. package/lib/typescript/credential/issuance/errors.d.ts +0 -9
  46. package/lib/typescript/credential/issuance/errors.d.ts.map +1 -1
  47. package/lib/typescript/credential/issuance/index.d.ts +3 -3
  48. package/lib/typescript/credential/issuance/index.d.ts.map +1 -1
  49. package/lib/typescript/credential/status/02-status-attestation.d.ts +1 -2
  50. package/lib/typescript/credential/status/02-status-attestation.d.ts.map +1 -1
  51. package/lib/typescript/index.d.ts +1 -2
  52. package/lib/typescript/index.d.ts.map +1 -1
  53. package/lib/typescript/utils/misc.d.ts +5 -25
  54. package/lib/typescript/utils/misc.d.ts.map +1 -1
  55. package/lib/typescript/wallet-instance-attestation/issuing.d.ts +2 -2
  56. package/lib/typescript/wallet-instance-attestation/issuing.d.ts.map +1 -1
  57. package/package.json +2 -6
  58. package/src/credential/issuance/03-start-user-authorization.ts +1 -1
  59. package/src/credential/issuance/04-complete-user-authorization.ts +42 -103
  60. package/src/credential/issuance/05-authorize-access.ts +1 -0
  61. package/src/credential/issuance/06-obtain-credential.ts +1 -2
  62. package/src/credential/issuance/errors.ts +0 -15
  63. package/src/credential/issuance/index.ts +4 -0
  64. package/src/credential/status/02-status-attestation.ts +2 -4
  65. package/src/index.ts +0 -2
  66. package/src/utils/misc.ts +16 -63
  67. package/src/wallet-instance-attestation/issuing.ts +1 -2
  68. package/lib/commonjs/cie/README.md +0 -6
  69. package/lib/commonjs/cie/component.js +0 -182
  70. package/lib/commonjs/cie/component.js.map +0 -1
  71. package/lib/commonjs/cie/error.js +0 -44
  72. package/lib/commonjs/cie/error.js.map +0 -1
  73. package/lib/commonjs/cie/index.js +0 -32
  74. package/lib/commonjs/cie/index.js.map +0 -1
  75. package/lib/commonjs/cie/manager.js +0 -142
  76. package/lib/commonjs/cie/manager.js.map +0 -1
  77. package/lib/module/cie/README.md +0 -6
  78. package/lib/module/cie/component.js +0 -172
  79. package/lib/module/cie/component.js.map +0 -1
  80. package/lib/module/cie/error.js +0 -36
  81. package/lib/module/cie/error.js.map +0 -1
  82. package/lib/module/cie/index.js +0 -4
  83. package/lib/module/cie/index.js.map +0 -1
  84. package/lib/module/cie/manager.js +0 -133
  85. package/lib/module/cie/manager.js.map +0 -1
  86. package/lib/typescript/cie/component.d.ts +0 -46
  87. package/lib/typescript/cie/component.d.ts.map +0 -1
  88. package/lib/typescript/cie/error.d.ts +0 -31
  89. package/lib/typescript/cie/error.d.ts.map +0 -1
  90. package/lib/typescript/cie/index.d.ts +0 -4
  91. package/lib/typescript/cie/index.d.ts.map +0 -1
  92. package/lib/typescript/cie/manager.d.ts +0 -5
  93. package/lib/typescript/cie/manager.d.ts.map +0 -1
  94. package/src/cie/README.md +0 -6
  95. package/src/cie/component.tsx +0 -218
  96. package/src/cie/error.ts +0 -58
  97. package/src/cie/index.ts +0 -4
  98. package/src/cie/manager.ts +0 -183
@@ -1 +1 @@
1
- {"version":3,"file":"04-complete-user-authorization.d.ts","sourceRoot":"","sources":["../../../../src/credential/issuance/04-complete-user-authorization.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACzB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAKL,KAAK,GAAG,EACT,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAG5E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,OAAO,EAIL,KAAK,aAAa,EACnB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAUtD;;GAEG;AACH,MAAM,MAAM,sCAAsC,GAAG,CACnD,gBAAgB,EAAE,GAAG,CAAC,sBAAsB,CAAC,CAAC,kBAAkB,CAAC,EACjE,QAAQ,EAAE,GAAG,CAAC,sBAAsB,CAAC,CAAC,UAAU,CAAC,EACjD,UAAU,EAAE,GAAG,CAAC,mBAAmB,CAAC,CAAC,YAAY,CAAC,EAClD,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,EACnB,oBAAoB,CAAC,EAAE,oBAAoB,EAC3C,MAAM,CAAC,EAAE,WAAW,KACjB,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAElC,MAAM,MAAM,4CAA4C,GAAG,CACzD,aAAa,EAAE,GAAG,CAAC,mCAAmC,CAAC,EACvD,OAAO,EAAE;IACP,gBAAgB,EAAE,aAAa,CAAC;IAChC,gBAAgB,EAAE,aAAa,CAAC;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,yBAAyB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CACjC,KACE,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAElC,MAAM,MAAM,mCAAmC,GAAG,CAChD,gBAAgB,EAAE,GAAG,CAAC,sBAAsB,CAAC,CAAC,kBAAkB,CAAC,EACjE,QAAQ,EAAE,GAAG,CAAC,sBAAsB,CAAC,CAAC,UAAU,CAAC,EACjD,UAAU,EAAE,GAAG,CAAC,mBAAmB,CAAC,CAAC,YAAY,CAAC,EAClD,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,KAC5B,OAAO,CAAC,aAAa,CAAC,CAAC;AAE5B;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,sCAAsC,EAAE,sCA0ElD,CAAC;AAEJ;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,mCAAmC,EAAE,mCAyB/C,CAAC;AAEJ;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,4CAA4C,EAAE,4CAuGxD,CAAC;AAEJ;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,YAC5B,OAAO,KACf,mBAaF,CAAC"}
1
+ {"version":3,"file":"04-complete-user-authorization.d.ts","sourceRoot":"","sources":["../../../../src/credential/issuance/04-complete-user-authorization.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAoB,KAAK,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAG5E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAIL,KAAK,aAAa,EACnB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAMtD;;GAEG;AACH,MAAM,MAAM,sCAAsC,GAAG,CACnD,eAAe,EAAE,MAAM,KACpB,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAElC,MAAM,MAAM,4CAA4C,GAAG,CACzD,aAAa,EAAE,GAAG,CAAC,mCAAmC,CAAC,EACvD,OAAO,EAAE;IACP,gBAAgB,EAAE,aAAa,CAAC;IAChC,gBAAgB,EAAE,aAAa,CAAC;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,yBAAyB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CACjC,KACE,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAElC,MAAM,MAAM,mCAAmC,GAAG,CAChD,gBAAgB,EAAE,GAAG,CAAC,sBAAsB,CAAC,CAAC,kBAAkB,CAAC,EACjE,QAAQ,EAAE,GAAG,CAAC,sBAAsB,CAAC,CAAC,UAAU,CAAC,EACjD,UAAU,EAAE,GAAG,CAAC,mBAAmB,CAAC,CAAC,YAAY,CAAC,EAClD,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,KAC5B,OAAO,CAAC,aAAa,CAAC,CAAC;AAE5B,MAAM,MAAM,qBAAqB,GAAG,CAClC,gBAAgB,EAAE,GAAG,CAAC,sBAAsB,CAAC,CAAC,kBAAkB,CAAC,EACjE,QAAQ,EAAE,GAAG,CAAC,sBAAsB,CAAC,CAAC,UAAU,CAAC,EACjD,UAAU,EAAE,GAAG,CAAC,mBAAmB,CAAC,CAAC,YAAY,CAAC,EAClD,OAAO,EAAE,MAAM,KACZ,OAAO,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC,CAAC;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,EAAE,qBAkBnC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,sCAAsC,EAAE,sCAKlD,CAAC;AAEJ;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,mCAAmC,EAAE,mCAyB/C,CAAC;AAEJ;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,4CAA4C,EAAE,4CAuGxD,CAAC;AAEJ;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,YAC5B,OAAO,KACf,mBAaF,CAAC"}
@@ -27,6 +27,7 @@ export type AuthorizeAccess = (issuerConf: Out<EvaluateIssuerTrust>["issuerConf"
27
27
  * @param context.dPopCryptoContext The DPoP crypto context
28
28
  * @param context.appFetch (optional) fetch api implementation. Default: built-in fetch
29
29
  * @throws {ValidationFailed} if an error occurs while parsing the token response
30
+ * @throws {IssuerResponseError} with a specific code for more context
30
31
  * @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.
31
32
  */
32
33
  export declare const authorizeAccess: AuthorizeAccess;
@@ -1 +1 @@
1
- {"version":3,"file":"05-authorize-access.d.ts","sourceRoot":"","sources":["../../../../src/credential/issuance/05-authorize-access.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAK5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAEjE,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,OAAO,KAAK,EAAE,sCAAsC,EAAE,MAAM,kCAAkC,CAAC;AAE/F,MAAM,MAAM,eAAe,GAAG,CAC5B,UAAU,EAAE,GAAG,CAAC,mBAAmB,CAAC,CAAC,YAAY,CAAC,EAClD,IAAI,EAAE,GAAG,CAAC,sCAAsC,CAAC,CAAC,MAAM,CAAC,EACzD,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,GAAG,CAAC,sBAAsB,CAAC,CAAC,UAAU,CAAC,EACjD,YAAY,EAAE,GAAG,CAAC,sBAAsB,CAAC,CAAC,cAAc,CAAC,EACzD,OAAO,EAAE;IACP,yBAAyB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAChC,gBAAgB,EAAE,aAAa,CAAC;IAChC,iBAAiB,EAAE,aAAa,CAAC;CAClC,KACE,OAAO,CAAC;IAAE,WAAW,EAAE,aAAa,CAAA;CAAE,CAAC,CAAC;AAE7C;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,eAAe,EAAE,eAyE7B,CAAC"}
1
+ {"version":3,"file":"05-authorize-access.d.ts","sourceRoot":"","sources":["../../../../src/credential/issuance/05-authorize-access.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAK5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAEjE,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,OAAO,KAAK,EAAE,sCAAsC,EAAE,MAAM,kCAAkC,CAAC;AAE/F,MAAM,MAAM,eAAe,GAAG,CAC5B,UAAU,EAAE,GAAG,CAAC,mBAAmB,CAAC,CAAC,YAAY,CAAC,EAClD,IAAI,EAAE,GAAG,CAAC,sCAAsC,CAAC,CAAC,MAAM,CAAC,EACzD,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,GAAG,CAAC,sBAAsB,CAAC,CAAC,UAAU,CAAC,EACjD,YAAY,EAAE,GAAG,CAAC,sBAAsB,CAAC,CAAC,cAAc,CAAC,EACzD,OAAO,EAAE;IACP,yBAAyB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAChC,gBAAgB,EAAE,aAAa,CAAC;IAChC,iBAAiB,EAAE,aAAa,CAAC;CAClC,KACE,OAAO,CAAC;IAAE,WAAW,EAAE,aAAa,CAAA;CAAE,CAAC,CAAC;AAE7C;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,eAAe,EAAE,eAyE7B,CAAC"}
@@ -16,13 +16,4 @@ export declare class AuthorizationIdpError extends IoWalletError {
16
16
  errorDescription?: string;
17
17
  constructor(error: string, errorDescription?: string);
18
18
  }
19
- /**
20
- * Error subclass thrown when an operation has been aborted.
21
- */
22
- export declare class OperationAbortedError extends IoWalletError {
23
- code: string;
24
- /** The aborted operation */
25
- operation: string;
26
- constructor(operation: string);
27
- }
28
19
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../src/credential/issuance/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAkB,MAAM,oBAAoB,CAAC;AAEnE;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,aAAa;IACnD,IAAI,SAAuC;gBAE/B,OAAO,CAAC,EAAE,MAAM;CAG7B;AAED;;;GAGG;AACH,qBAAa,qBAAsB,SAAQ,aAAa;IACtD,IAAI,SAA0D;IAE9D,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,CAAC,EAAE,MAAM,CAAC;gBAEd,KAAK,EAAE,MAAM,EAAE,gBAAgB,CAAC,EAAE,MAAM;CAKrD;AAED;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,aAAa;IACtD,IAAI,SAAqC;IAEzC,4BAA4B;IAC5B,SAAS,EAAE,MAAM,CAAC;gBAEN,SAAS,EAAE,MAAM;CAI9B"}
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../src/credential/issuance/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAkB,MAAM,oBAAoB,CAAC;AAEnE;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,aAAa;IACnD,IAAI,SAAuC;gBAE/B,OAAO,CAAC,EAAE,MAAM;CAG7B;AAED;;;GAGG;AACH,qBAAa,qBAAsB,SAAQ,aAAa;IACtD,IAAI,SAA0D;IAE9D,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,CAAC,EAAE,MAAM,CAAC;gBAEd,KAAK,EAAE,MAAM,EAAE,gBAAgB,CAAC,EAAE,MAAM;CAKrD"}
@@ -1,11 +1,11 @@
1
1
  import { type StartFlow } from "./01-start-flow";
2
2
  import { evaluateIssuerTrust, type EvaluateIssuerTrust } from "./02-evaluate-issuer-trust";
3
3
  import { startUserAuthorization, type StartUserAuthorization } from "./03-start-user-authorization";
4
- import { completeUserAuthorizationWithQueryMode, completeUserAuthorizationWithFormPostJwtMode, parseAuthorizationResponse, type CompleteUserAuthorizationWithQueryMode, type CompleteUserAuthorizationWithFormPostJwtMode, type GetRequestedCredentialToBePresented, getRequestedCredentialToBePresented } from "./04-complete-user-authorization";
4
+ import { completeUserAuthorizationWithQueryMode, completeUserAuthorizationWithFormPostJwtMode, parseAuthorizationResponse, buildAuthorizationUrl, type CompleteUserAuthorizationWithQueryMode, type CompleteUserAuthorizationWithFormPostJwtMode, type GetRequestedCredentialToBePresented, type BuildAuthorizationUrl, getRequestedCredentialToBePresented } from "./04-complete-user-authorization";
5
5
  import { authorizeAccess, type AuthorizeAccess } from "./05-authorize-access";
6
6
  import { obtainCredential, type ObtainCredential } from "./06-obtain-credential";
7
7
  import { verifyAndParseCredential, type VerifyAndParseCredential } from "./07-verify-and-parse-credential";
8
8
  import * as Errors from "./errors";
9
- export { evaluateIssuerTrust, startUserAuthorization, completeUserAuthorizationWithQueryMode, getRequestedCredentialToBePresented, completeUserAuthorizationWithFormPostJwtMode, authorizeAccess, obtainCredential, verifyAndParseCredential, parseAuthorizationResponse, Errors, };
10
- export type { StartFlow, EvaluateIssuerTrust, StartUserAuthorization, CompleteUserAuthorizationWithQueryMode, GetRequestedCredentialToBePresented, CompleteUserAuthorizationWithFormPostJwtMode, AuthorizeAccess, ObtainCredential, VerifyAndParseCredential, };
9
+ export { evaluateIssuerTrust, startUserAuthorization, buildAuthorizationUrl, completeUserAuthorizationWithQueryMode, getRequestedCredentialToBePresented, completeUserAuthorizationWithFormPostJwtMode, authorizeAccess, obtainCredential, verifyAndParseCredential, parseAuthorizationResponse, Errors, };
10
+ export type { StartFlow, EvaluateIssuerTrust, StartUserAuthorization, BuildAuthorizationUrl, CompleteUserAuthorizationWithQueryMode, GetRequestedCredentialToBePresented, CompleteUserAuthorizationWithFormPostJwtMode, AuthorizeAccess, ObtainCredential, VerifyAndParseCredential, };
11
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/credential/issuance/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EACL,mBAAmB,EACnB,KAAK,mBAAmB,EACzB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,sBAAsB,EACtB,KAAK,sBAAsB,EAC5B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,sCAAsC,EACtC,4CAA4C,EAC5C,0BAA0B,EAC1B,KAAK,sCAAsC,EAC3C,KAAK,4CAA4C,EACjD,KAAK,mCAAmC,EACxC,mCAAmC,EACpC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EACL,gBAAgB,EAChB,KAAK,gBAAgB,EACtB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,wBAAwB,EACxB,KAAK,wBAAwB,EAC9B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,sCAAsC,EACtC,mCAAmC,EACnC,4CAA4C,EAC5C,eAAe,EACf,gBAAgB,EAChB,wBAAwB,EACxB,0BAA0B,EAC1B,MAAM,GACP,CAAC;AACF,YAAY,EACV,SAAS,EACT,mBAAmB,EACnB,sBAAsB,EACtB,sCAAsC,EACtC,mCAAmC,EACnC,4CAA4C,EAC5C,eAAe,EACf,gBAAgB,EAChB,wBAAwB,GACzB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/credential/issuance/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EACL,mBAAmB,EACnB,KAAK,mBAAmB,EACzB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,sBAAsB,EACtB,KAAK,sBAAsB,EAC5B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,sCAAsC,EACtC,4CAA4C,EAC5C,0BAA0B,EAC1B,qBAAqB,EACrB,KAAK,sCAAsC,EAC3C,KAAK,4CAA4C,EACjD,KAAK,mCAAmC,EACxC,KAAK,qBAAqB,EAC1B,mCAAmC,EACpC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EACL,gBAAgB,EAChB,KAAK,gBAAgB,EACtB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,wBAAwB,EACxB,KAAK,wBAAwB,EAC9B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,qBAAqB,EACrB,sCAAsC,EACtC,mCAAmC,EACnC,4CAA4C,EAC5C,eAAe,EACf,gBAAgB,EAChB,wBAAwB,EACxB,0BAA0B,EAC1B,MAAM,GACP,CAAC;AACF,YAAY,EACV,SAAS,EACT,mBAAmB,EACnB,sBAAsB,EACtB,qBAAqB,EACrB,sCAAsC,EACtC,mCAAmC,EACnC,4CAA4C,EAC5C,eAAe,EACf,gBAAgB,EAChB,wBAAwB,GACzB,CAAC"}
@@ -12,8 +12,7 @@ export type StatusAttestation = (issuerConf: Out<EvaluateIssuerTrust>["issuerCon
12
12
  * @param credential - The credential to be verified
13
13
  * @param credentialCryptoContext - The credential's crypto context
14
14
  * @param context.appFetch (optional) fetch api implementation. Default: built-in fetch
15
- * @throws {@link CredentialInvalidStatusError} if the status attestation is invalid and thus the credential is not valid
16
- * @throws {@link StatusAttestationError} if an error occurs during the status attestation
15
+ * @throws {IssuerResponseError} with a specific code for more context
17
16
  * @returns The credential status attestation
18
17
  */
19
18
  export declare const statusAttestation: StatusAttestation;
@@ -1 +1 @@
1
- {"version":3,"file":"02-status-attestation.d.ts","sourceRoot":"","sources":["../../../../src/credential/status/02-status-attestation.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,GAAG,EACT,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACzE,OAAO,EAAE,KAAK,aAAa,EAAW,MAAM,6BAA6B,CAAC;AAE1E,OAAO,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAQpD,MAAM,MAAM,iBAAiB,GAAG,CAC9B,UAAU,EAAE,GAAG,CAAC,mBAAmB,CAAC,CAAC,YAAY,CAAC,EAClD,UAAU,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC,YAAY,CAAC,EAC/C,uBAAuB,EAAE,aAAa,EACtC,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,KAC5B,OAAO,CAAC;IACX,iBAAiB,EAAE,yBAAyB,CAAC,oBAAoB,CAAC,CAAC;CACpE,CAAC,CAAC;AAEH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,iBAAiB,EAAE,iBA2C/B,CAAC"}
1
+ {"version":3,"file":"02-status-attestation.d.ts","sourceRoot":"","sources":["../../../../src/credential/status/02-status-attestation.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,GAAG,EACT,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACzE,OAAO,EAAE,KAAK,aAAa,EAAW,MAAM,6BAA6B,CAAC;AAE1E,OAAO,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAQpD,MAAM,MAAM,iBAAiB,GAAG,CAC9B,UAAU,EAAE,GAAG,CAAC,mBAAmB,CAAC,CAAC,YAAY,CAAC,EAClD,UAAU,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC,YAAY,CAAC,EAC/C,uBAAuB,EAAE,aAAa,EACtC,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,KAC5B,OAAO,CAAC;IACX,iBAAiB,EAAE,yBAAyB,CAAC,oBAAoB,CAAC,CAAC;CACpE,CAAC,CAAC;AAEH;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,EAAE,iBA2C/B,CAAC"}
@@ -8,10 +8,9 @@ import * as Errors from "./utils/errors";
8
8
  import * as WalletInstanceAttestation from "./wallet-instance-attestation";
9
9
  import * as Trust from "./trust";
10
10
  import * as WalletInstance from "./wallet-instance";
11
- import * as Cie from "./cie";
12
11
  import { AuthorizationDetail, AuthorizationDetails } from "./utils/par";
13
12
  import { createCryptoContextFor } from "./utils/crypto";
14
13
  import type { IntegrityContext } from "./utils/integrity";
15
- export { SdJwt, PID, Credential, WalletInstanceAttestation, WalletInstance, Errors, Trust, createCryptoContextFor, AuthorizationDetail, AuthorizationDetails, fixBase64EncodingOnKey, Cie, };
14
+ export { SdJwt, PID, Credential, WalletInstanceAttestation, WalletInstance, Errors, Trust, createCryptoContextFor, AuthorizationDetail, AuthorizationDetails, fixBase64EncodingOnKey, };
16
15
  export type { IntegrityContext, AuthorizationContext };
17
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAGrD,OAAO,gCAAgC,CAAC;AAExC,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAC7B,OAAO,KAAK,KAAK,MAAM,UAAU,CAAC;AAClC,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAC;AACzC,OAAO,KAAK,yBAAyB,MAAM,+BAA+B,CAAC;AAC3E,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,cAAc,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAC7B,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,EACL,KAAK,EACL,GAAG,EACH,UAAU,EACV,yBAAyB,EACzB,cAAc,EACd,MAAM,EACN,KAAK,EACL,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,GAAG,GACJ,CAAC;AAEF,YAAY,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAGrD,OAAO,gCAAgC,CAAC;AAExC,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAC7B,OAAO,KAAK,KAAK,MAAM,UAAU,CAAC;AAClC,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAC;AACzC,OAAO,KAAK,yBAAyB,MAAM,+BAA+B,CAAC;AAC3E,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,cAAc,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,EACL,KAAK,EACL,GAAG,EACH,UAAU,EACV,yBAAyB,EACzB,cAAc,EACd,MAAM,EACN,KAAK,EACL,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,GACvB,CAAC;AAEF,YAAY,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,CAAC"}
@@ -7,6 +7,10 @@ import { UnexpectedStatusCodeError } from "./errors";
7
7
  * @returns The given response object
8
8
  */
9
9
  export declare const hasStatusOrThrow: (status: number, customError?: typeof UnexpectedStatusCodeError) => (res: Response) => Promise<Response>;
10
+ /**
11
+ * Utility function to parse a raw HTTP response as JSON if supported, otherwise as text.
12
+ */
13
+ export declare const parseRawHttpResponse: <T extends Record<string, unknown>>(response: Response) => Promise<string> | Promise<T>;
10
14
  export type Out<FN> = FN extends (...args: any[]) => Promise<any> ? Awaited<ReturnType<FN>> : FN extends (...args: any[]) => any ? ReturnType<FN> : never;
11
15
  /**
12
16
  * TODO [SIW-1310]: replace this function with a cryptographically secure one.
@@ -14,18 +18,6 @@ export type Out<FN> = FN extends (...args: any[]) => Promise<any> ? Awaited<Retu
14
18
  * @returns A random alphanumeric string of the given size
15
19
  */
16
20
  export declare const generateRandomAlphaNumericString: (size: number) => string;
17
- /**
18
- * Repeatedly checks a condition function until it returns true,
19
- * then resolves the returned promise. If the condition function does not return true
20
- * within the specified timeout, the promise is rejected.
21
- *
22
- * @param conditionFunction - A function that returns a boolean value.
23
- * The promise resolves when this function returns true.
24
- * @param timeout - An optional timeout in seconds. The promise is rejected if the
25
- * condition function does not return true within this time.
26
- * @returns A promise that resolves once the conditionFunction returns true or rejects if timed out.
27
- */
28
- export declare const until: (conditionFunction: () => boolean, timeoutSeconds?: number) => Promise<void>;
29
21
  /**
30
22
  * Get the hash of a credential without discloures.
31
23
  * A credential is a string like `header.body.sign~sd1~sd2....` where `~` is the separator between the credential and the discloures.
@@ -33,17 +25,5 @@ export declare const until: (conditionFunction: () => boolean, timeoutSeconds?:
33
25
  * @returns The hash of the credential without discloures
34
26
  */
35
27
  export declare const getCredentialHashWithouDiscloures: (credential: string) => Promise<string>;
36
- /**
37
- * Creates a promise that waits until the provided signal is aborted.
38
- * @returns {Object} An object with `listen` and `remove` methods to handle subscribing and unsubscribing.
39
- */
40
- export declare const createAbortPromiseFromSignal: (signal: AbortSignal) => {
41
- listen: () => Promise<"OPERATION_ABORTED">;
42
- remove: () => void;
43
- };
44
- export declare const isDefined: <T>(x: "" | T | null | undefined) => x is T;
45
- /**
46
- * Utility function to parse a raw HTTP response as JSON if supported, otherwise as text.
47
- */
48
- export declare const parseRawHttpResponse: <T extends Record<string, unknown>>(response: Response) => Promise<string> | Promise<T>;
28
+ export declare const safeJsonParse: <T>(text: string, withDefault?: T | undefined) => T | null;
49
29
  //# sourceMappingURL=misc.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"misc.d.ts","sourceRoot":"","sources":["../../../src/utils/misc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAGpE;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,WAClB,MAAM,gBAAgB,gCAAgC,WACnD,QAAQ,KAAG,QAAQ,QAAQ,CAUtC,CAAC;AAIJ,MAAM,MAAM,GAAG,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,GAC7D,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,GACvB,EAAE,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,GAClC,UAAU,CAAC,EAAE,CAAC,GACd,KAAK,CAAC;AAEV;;;;GAIG;AACH,eAAO,MAAM,gCAAgC,SAAU,MAAM,WAGjD,CAAC;AAEb;;;;;;;;;;GAUG;AACH,eAAO,MAAM,KAAK,sBACG,MAAM,OAAO,mBACf,MAAM,KACtB,QAAQ,IAAI,CAiBX,CAAC;AAEL;;;;;GAKG;AACH,eAAO,MAAM,iCAAiC,eAChC,MAAM,KACjB,QAAQ,MAAM,CAMhB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,4BAA4B,WAAY,WAAW;;;CAa/D,CAAC;AAEF,eAAO,MAAM,SAAS,6CACV,CAAC;AAEb;;GAEG;AACH,eAAO,MAAM,oBAAoB,gDACrB,QAAQ,iCAIC,CAAC"}
1
+ {"version":3,"file":"misc.d.ts","sourceRoot":"","sources":["../../../src/utils/misc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAGpE;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,WAClB,MAAM,gBAAgB,gCAAgC,WACnD,QAAQ,KAAG,QAAQ,QAAQ,CAUtC,CAAC;AAEJ;;GAEG;AACH,eAAO,MAAM,oBAAoB,gDACrB,QAAQ,iCAIC,CAAC;AAItB,MAAM,MAAM,GAAG,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,GAC7D,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,GACvB,EAAE,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,GAClC,UAAU,CAAC,EAAE,CAAC,GACd,KAAK,CAAC;AAEV;;;;GAIG;AACH,eAAO,MAAM,gCAAgC,SAAU,MAAM,WAGjD,CAAC;AAEb;;;;;GAKG;AACH,eAAO,MAAM,iCAAiC,eAChC,MAAM,KACjB,QAAQ,MAAM,CAMhB,CAAC;AAEF,eAAO,MAAM,aAAa,YAAa,MAAM,0CAM5C,CAAC"}
@@ -1,3 +1,4 @@
1
+ /// <reference types="react-native" />
1
2
  import { type CryptoContext } from "@pagopa/io-react-native-jwt";
2
3
  import type { IntegrityContext } from "..";
3
4
  /**
@@ -17,8 +18,7 @@ export declare function getAttestationRequest(challenge: string, wiaCryptoContex
17
18
  * @param params.appFetch (optional) Http client
18
19
  * @param walletProviderBaseUrl Base url for the Wallet Provider
19
20
  * @returns The retrieved Wallet Instance Attestation token
20
- * @throws {WalletInstanceRevokedError} The Wallet Instance was revoked
21
- * @throws {WalletInstanceNotFoundError} The Wallet Instance does not exist
21
+ * @throws {WalletProviderResponseError} with a specific code for more context
22
22
  */
23
23
  export declare const getAttestation: ({ wiaCryptoContext, integrityContext, walletProviderBaseUrl, appFetch, }: {
24
24
  wiaCryptoContext: CryptoContext;
@@ -1 +1 @@
1
- {"version":3,"file":"issuing.d.ts","sourceRoot":"","sources":["../../../src/wallet-instance-attestation/issuing.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAGnB,MAAM,6BAA6B,CAAC;AAGrC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,IAAI,CAAC;AAQ3C;;;;;;;;GAQG;AACH,wBAAsB,qBAAqB,CACzC,SAAS,EAAE,MAAM,EACjB,gBAAgB,EAAE,aAAa,EAC/B,gBAAgB,EAAE,gBAAgB,EAClC,qBAAqB,EAAE,MAAM,GAC5B,OAAO,CAAC,MAAM,CAAC,CAoCjB;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc;sBAMP,aAAa;sBACb,gBAAgB;2BACX,MAAM;;;;;MAE3B,QAAQ,MAAM,CA6BjB,CAAC"}
1
+ {"version":3,"file":"issuing.d.ts","sourceRoot":"","sources":["../../../src/wallet-instance-attestation/issuing.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,KAAK,aAAa,EAGnB,MAAM,6BAA6B,CAAC;AAGrC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,IAAI,CAAC;AAQ3C;;;;;;;;GAQG;AACH,wBAAsB,qBAAqB,CACzC,SAAS,EAAE,MAAM,EACjB,gBAAgB,EAAE,aAAa,EAC/B,gBAAgB,EAAE,gBAAgB,EAClC,qBAAqB,EAAE,MAAM,GAC5B,OAAO,CAAC,MAAM,CAAC,CAoCjB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc;sBAMP,aAAa;sBACb,gBAAgB;2BACX,MAAM;;;;;MAE3B,QAAQ,MAAM,CA6BjB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pagopa/io-react-native-wallet",
3
- "version": "0.25.0",
3
+ "version": "0.27.0",
4
4
  "description": "Provide data structures, helpers and API for IO Wallet",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -56,7 +56,6 @@
56
56
  "@pagopa/eslint-config": "^3.0.0",
57
57
  "@pagopa/io-react-native-crypto": "^0.2.3",
58
58
  "@pagopa/io-react-native-jwt": "^1.3.0",
59
- "@pagopa/react-native-cie": "^1.3.0",
60
59
  "@react-native/eslint-config": "^0.72.2",
61
60
  "@rushstack/eslint-patch": "^1.3.2",
62
61
  "@types/jest": "^28.1.2",
@@ -70,7 +69,6 @@
70
69
  "react": "18.2.0",
71
70
  "react-native": "0.72.14",
72
71
  "react-native-builder-bob": "^0.20.0",
73
- "react-native-webview": "^13.10.5",
74
72
  "typed-openapi": "^0.4.1",
75
73
  "typescript": "^5.0.2"
76
74
  },
@@ -80,10 +78,8 @@
80
78
  "peerDependencies": {
81
79
  "@pagopa/io-react-native-crypto": "*",
82
80
  "@pagopa/io-react-native-jwt": "*",
83
- "@pagopa/react-native-cie": "*",
84
81
  "react": "*",
85
- "react-native": "*",
86
- "react-native-webview": "*"
82
+ "react-native": "*"
87
83
  },
88
84
  "engines": {
89
85
  "node": ">= 16.0.0"
@@ -88,7 +88,7 @@ const selectResponseMode = (
88
88
  * the application session identifier on the Wallet Instance side (state),
89
89
  * the method (query or form_post.jwt) by which the Authorization Server
90
90
  * should transmit the Authorization Response containing the authorization code issued upon the end user's authentication (response_mode)
91
- * to the Wallet Instance's Token Endpoint to obtain the Access Token, and the redirect_uri of the Wallet Instance where the Authorization Response
91
+ * to the Wallet Instance's Token Endpoint to obtain the Access Token, and the redirectUri of the Wallet Instance where the Authorization Response
92
92
  * should be delivered. The redirect is achived by using a custom URL scheme that the Wallet Instance is registered to handle.
93
93
  * @param issuerConf The issuer configuration
94
94
  * @param credentialType The type of the credential to be requested returned by {@link selectCredentialDefinition}
@@ -1,21 +1,13 @@
1
1
  import {
2
2
  AuthorizationErrorShape,
3
3
  AuthorizationResultShape,
4
- type AuthorizationContext,
5
4
  type AuthorizationResult,
6
5
  } from "../../utils/auth";
7
- import {
8
- createAbortPromiseFromSignal,
9
- hasStatusOrThrow,
10
- isDefined,
11
- until,
12
- type Out,
13
- } from "../../utils/misc";
6
+ import { hasStatusOrThrow, type Out } from "../../utils/misc";
14
7
  import type { StartUserAuthorization } from "./03-start-user-authorization";
15
8
  import parseUrl from "parse-url";
16
9
  import { IssuerResponseError, ValidationFailed } from "../../utils/errors";
17
10
  import type { EvaluateIssuerTrust } from "./02-evaluate-issuer-trust";
18
- import { Linking } from "react-native";
19
11
  import {
20
12
  decode,
21
13
  encodeBase64,
@@ -26,23 +18,13 @@ import { RequestObject } from "../presentation/types";
26
18
  import uuid from "react-native-uuid";
27
19
  import { ResponseUriResultShape } from "./types";
28
20
  import { getJwtFromFormPost } from "../../utils/decoder";
29
- import {
30
- AuthorizationError,
31
- AuthorizationIdpError,
32
- OperationAbortedError,
33
- } from "./errors";
21
+ import { AuthorizationError, AuthorizationIdpError } from "./errors";
34
22
 
35
23
  /**
36
24
  * The interface of the phase to complete User authorization via strong identification when the response mode is "query" and the request credential is a PersonIdentificationData.
37
25
  */
38
26
  export type CompleteUserAuthorizationWithQueryMode = (
39
- issuerRequestUri: Out<StartUserAuthorization>["issuerRequestUri"],
40
- clientId: Out<StartUserAuthorization>["clientId"],
41
- issuerConf: Out<EvaluateIssuerTrust>["issuerConf"],
42
- idpHint: string,
43
- redirectUri: string,
44
- authorizationContext?: AuthorizationContext,
45
- signal?: AbortSignal
27
+ authRedirectUrl: string
46
28
  ) => Promise<AuthorizationResult>;
47
29
 
48
30
  export type CompleteUserAuthorizationWithFormPostJwtMode = (
@@ -63,98 +45,55 @@ export type GetRequestedCredentialToBePresented = (
63
45
  appFetch?: GlobalFetch["fetch"]
64
46
  ) => Promise<RequestObject>;
65
47
 
48
+ export type BuildAuthorizationUrl = (
49
+ issuerRequestUri: Out<StartUserAuthorization>["issuerRequestUri"],
50
+ clientId: Out<StartUserAuthorization>["clientId"],
51
+ issuerConf: Out<EvaluateIssuerTrust>["issuerConf"],
52
+ idpHint: string
53
+ ) => Promise<{
54
+ authUrl: string;
55
+ }>;
56
+
66
57
  /**
67
- * WARNING: This function must be called after {@link startUserAuthorization}. The next function to be called is {@link authorizeAccess}.
68
- * The interface of the phase to complete User authorization via strong identification when the response mode is "query" and the request credential is a PersonIdentificationData.
69
- * It is used to complete the user authorization by catching the redirectSchema from the authorization server which then contains the authorization response.
70
- * This function utilizes the authorization context to open an in-app browser capable of catching the redirectSchema to perform a get request to the authorization endpoint.
71
- * If the 302 redirect happens and the redirectSchema is caught, the function will return the authorization response after parsing it from the query string.
58
+ * WARNING: This function must be called after {@link startUserAuthorization}. The generated authUrl must be used to open a browser or webview capable of catching the redirectSchema to perform a get request to the authorization endpoint.
59
+ * Builds the authorization URL to which the end user should be redirected to continue the authentication flow.
72
60
  * @param issuerRequestUri the URI of the issuer where the request is sent
73
61
  * @param clientId Identifies the current client across all the requests of the issuing flow returned by {@link startUserAuthorization}
74
62
  * @param issuerConf The issuer configuration returned by {@link evaluateIssuerTrust}
75
- * @param authorizationContext The context to identify the user which will be used to start the authorization. It's needed only when requesting a PersonalIdentificationData credential. The implementantion should open an in-app browser capable of catching the redirectSchema.
76
- * If not specified, the default browser is used
77
- * @param idphint Unique identifier of the SPID IDP selected by the user
78
- * @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
79
- * @param signal An optional {@link AbortSignal} to abort the operation when using the default browser
80
- * @throws {AuthorizationError} if an error occurs during the authorization process
81
- * @throws {AuthorizationIdpError} if an error occurs during the authorization process and the error is related to the IDP
82
- * @throws {OperationAbortedError} if the caller aborts the operation via the provided signal
83
- * @returns the authorization response which contains code, state and iss
63
+ * @param idpHint Unique identifier of the IDP selected by the user
64
+ * @returns An object containing the authorization URL
84
65
  */
85
- export const completeUserAuthorizationWithQueryMode: CompleteUserAuthorizationWithQueryMode =
86
- async (
87
- issuerRequestUri,
88
- clientId,
89
- issuerConf,
90
- idpHint,
91
- redirectUri,
92
- authorizationContext,
93
- signal
94
- ) => {
95
- const authzRequestEndpoint =
96
- issuerConf.oauth_authorization_server.authorization_endpoint;
97
- const params = new URLSearchParams({
98
- client_id: clientId,
99
- request_uri: issuerRequestUri,
100
- idphint: idpHint,
101
- });
102
- const authUrl = `${authzRequestEndpoint}?${params}`;
103
- var authRedirectUrl: string | undefined;
104
-
105
- if (authorizationContext) {
106
- const redirectSchema = new URL(redirectUri).protocol.replace(":", "");
107
- authRedirectUrl = await authorizationContext
108
- .authorize(authUrl, redirectSchema)
109
- .catch((e) => {
110
- throw new AuthorizationError(e.message);
111
- });
112
- } else {
113
- // handler for redirectUri
114
- const urlEventListener = Linking.addEventListener("url", ({ url }) => {
115
- if (url.includes(redirectUri)) {
116
- authRedirectUrl = url;
117
- }
118
- });
119
-
120
- const operationIsAborted = signal
121
- ? createAbortPromiseFromSignal(signal)
122
- : undefined;
123
- await Linking.openURL(authUrl);
66
+ export const buildAuthorizationUrl: BuildAuthorizationUrl = async (
67
+ issuerRequestUri,
68
+ clientId,
69
+ issuerConf,
70
+ idpHint
71
+ ) => {
72
+ const authzRequestEndpoint =
73
+ issuerConf.oauth_authorization_server.authorization_endpoint;
124
74
 
125
- /*
126
- * Waits for 120 seconds for the identificationRedirectUrl variable to be set
127
- * by the custom url handler. If the timeout is exceeded, throw an exception
128
- */
129
- const unitAuthRedirectIsNotUndefined = until(
130
- () => authRedirectUrl !== undefined,
131
- 120
132
- );
133
-
134
- /**
135
- * Simultaneously listen for the abort signal (when provided) and the redirect url.
136
- * The first event that occurs will resolve the promise.
137
- * This is useful to properly cleanup when the caller aborts this operation.
138
- */
139
- const winner = await Promise.race(
140
- [operationIsAborted?.listen(), unitAuthRedirectIsNotUndefined].filter(
141
- isDefined
142
- )
143
- ).finally(() => {
144
- urlEventListener.remove();
145
- operationIsAborted?.remove();
146
- });
75
+ const params = new URLSearchParams({
76
+ client_id: clientId,
77
+ request_uri: issuerRequestUri,
78
+ idphint: idpHint,
79
+ });
147
80
 
148
- if (winner === "OPERATION_ABORTED") {
149
- throw new OperationAbortedError("DefaultQueryModeAuthorization");
150
- }
81
+ const authUrl = `${authzRequestEndpoint}?${params}`;
151
82
 
152
- if (authRedirectUrl === undefined) {
153
- throw new AuthorizationError("Invalid authentication redirect url");
154
- }
155
- }
83
+ return { authUrl };
84
+ };
156
85
 
86
+ /**
87
+ * WARNING: This function must be called after obtaining the authorization redirect URL from the webviews (SPID and CIE L3) or browser for CIEID.
88
+ * Complete User authorization via strong identification when the response mode is "query" and the request credential is a PersonIdentificationData.
89
+ * This function parses the authorization redirect URL to extract the authorization response.
90
+ * @param authRedirectUrl The URL to which the end user should be redirected to start the authentication flow
91
+ * @returns the authorization response which contains code, state and iss
92
+ */
93
+ export const completeUserAuthorizationWithQueryMode: CompleteUserAuthorizationWithQueryMode =
94
+ async (authRedirectUrl) => {
157
95
  const query = parseUrl(authRedirectUrl).query;
96
+
158
97
  return parseAuthorizationResponse(query);
159
98
  };
160
99
 
@@ -40,6 +40,7 @@ export type AuthorizeAccess = (
40
40
  * @param context.dPopCryptoContext The DPoP crypto context
41
41
  * @param context.appFetch (optional) fetch api implementation. Default: built-in fetch
42
42
  * @throws {ValidationFailed} if an error occurs while parsing the token response
43
+ * @throws {IssuerResponseError} with a specific code for more context
43
44
  * @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.
44
45
  */
45
46
  export const authorizeAccess: AuthorizeAccess = async (
@@ -160,8 +160,7 @@ export const obtainCredential: ObtainCredential = async (
160
160
  * Handle the credential error by mapping it to a custom exception.
161
161
  * If the error is not an instance of {@link UnexpectedStatusCodeError}, it is thrown as is.
162
162
  * @param e - The error to be handled
163
- * @throws {@link CredentialRequestError} if the status code is different from 404
164
- * @throws {@link CredentialInvalidStatusError} if the status code is 404 (meaning the credential is invalid)
163
+ * @throws {IssuerResponseError} with a specific code for more context
165
164
  */
166
165
  const handleObtainCredentialError = (e: unknown) => {
167
166
  if (!(e instanceof UnexpectedStatusCodeError)) {
@@ -27,18 +27,3 @@ export class AuthorizationIdpError extends IoWalletError {
27
27
  this.errorDescription = errorDescription;
28
28
  }
29
29
  }
30
-
31
- /**
32
- * Error subclass thrown when an operation has been aborted.
33
- */
34
- export class OperationAbortedError extends IoWalletError {
35
- code = "ERR_IO_WALLET_OPERATION_ABORTED";
36
-
37
- /** The aborted operation */
38
- operation: string;
39
-
40
- constructor(operation: string) {
41
- super(serializeAttrs({ operation }));
42
- this.operation = operation;
43
- }
44
- }
@@ -11,9 +11,11 @@ import {
11
11
  completeUserAuthorizationWithQueryMode,
12
12
  completeUserAuthorizationWithFormPostJwtMode,
13
13
  parseAuthorizationResponse,
14
+ buildAuthorizationUrl,
14
15
  type CompleteUserAuthorizationWithQueryMode,
15
16
  type CompleteUserAuthorizationWithFormPostJwtMode,
16
17
  type GetRequestedCredentialToBePresented,
18
+ type BuildAuthorizationUrl,
17
19
  getRequestedCredentialToBePresented,
18
20
  } from "./04-complete-user-authorization";
19
21
  import { authorizeAccess, type AuthorizeAccess } from "./05-authorize-access";
@@ -30,6 +32,7 @@ import * as Errors from "./errors";
30
32
  export {
31
33
  evaluateIssuerTrust,
32
34
  startUserAuthorization,
35
+ buildAuthorizationUrl,
33
36
  completeUserAuthorizationWithQueryMode,
34
37
  getRequestedCredentialToBePresented,
35
38
  completeUserAuthorizationWithFormPostJwtMode,
@@ -43,6 +46,7 @@ export type {
43
46
  StartFlow,
44
47
  EvaluateIssuerTrust,
45
48
  StartUserAuthorization,
49
+ BuildAuthorizationUrl,
46
50
  CompleteUserAuthorizationWithQueryMode,
47
51
  GetRequestedCredentialToBePresented,
48
52
  CompleteUserAuthorizationWithFormPostJwtMode,
@@ -30,8 +30,7 @@ export type StatusAttestation = (
30
30
  * @param credential - The credential to be verified
31
31
  * @param credentialCryptoContext - The credential's crypto context
32
32
  * @param context.appFetch (optional) fetch api implementation. Default: built-in fetch
33
- * @throws {@link CredentialInvalidStatusError} if the status attestation is invalid and thus the credential is not valid
34
- * @throws {@link StatusAttestationError} if an error occurs during the status attestation
33
+ * @throws {IssuerResponseError} with a specific code for more context
35
34
  * @returns The credential status attestation
36
35
  */
37
36
  export const statusAttestation: StatusAttestation = async (
@@ -83,8 +82,7 @@ export const statusAttestation: StatusAttestation = async (
83
82
  * Handle the status attestation error by mapping it to a custom exception.
84
83
  * If the error is not an instance of {@link UnexpectedStatusCodeError}, it is thrown as is.
85
84
  * @param e - The error to be handled
86
- * @throws {@link StatusAttestationError} if the status code is different from 404
87
- * @throws {@link CredentialInvalidStatusError} if the status code is 404 (meaning the credential is invalid)
85
+ * @throws {IssuerResponseError} with a specific code for more context
88
86
  */
89
87
  const handleStatusAttestationError = (e: unknown) => {
90
88
  if (!(e instanceof UnexpectedStatusCodeError)) {
package/src/index.ts CHANGED
@@ -11,7 +11,6 @@ import * as Errors from "./utils/errors";
11
11
  import * as WalletInstanceAttestation from "./wallet-instance-attestation";
12
12
  import * as Trust from "./trust";
13
13
  import * as WalletInstance from "./wallet-instance";
14
- import * as Cie from "./cie";
15
14
  import { AuthorizationDetail, AuthorizationDetails } from "./utils/par";
16
15
  import { createCryptoContextFor } from "./utils/crypto";
17
16
  import type { IntegrityContext } from "./utils/integrity";
@@ -28,7 +27,6 @@ export {
28
27
  AuthorizationDetail,
29
28
  AuthorizationDetails,
30
29
  fixBase64EncodingOnKey,
31
- Cie,
32
30
  };
33
31
 
34
32
  export type { IntegrityContext, AuthorizationContext };
package/src/utils/misc.ts CHANGED
@@ -22,6 +22,16 @@ export const hasStatusOrThrow =
22
22
  return res;
23
23
  };
24
24
 
25
+ /**
26
+ * Utility function to parse a raw HTTP response as JSON if supported, otherwise as text.
27
+ */
28
+ export const parseRawHttpResponse = <T extends Record<string, unknown>>(
29
+ response: Response
30
+ ) =>
31
+ response.headers.get("content-type")?.includes("application/json")
32
+ ? (response.json() as Promise<T>)
33
+ : response.text();
34
+
25
35
  // extract a type from an async function output
26
36
  // helpful to bind the input of a function to the output of another
27
37
  export type Out<FN> = FN extends (...args: any[]) => Promise<any>
@@ -40,39 +50,6 @@ export const generateRandomAlphaNumericString = (size: number) =>
40
50
  Math.floor(Math.random() * 36).toString(36)
41
51
  ).join("");
42
52
 
43
- /**
44
- * Repeatedly checks a condition function until it returns true,
45
- * then resolves the returned promise. If the condition function does not return true
46
- * within the specified timeout, the promise is rejected.
47
- *
48
- * @param conditionFunction - A function that returns a boolean value.
49
- * The promise resolves when this function returns true.
50
- * @param timeout - An optional timeout in seconds. The promise is rejected if the
51
- * condition function does not return true within this time.
52
- * @returns A promise that resolves once the conditionFunction returns true or rejects if timed out.
53
- */
54
- export const until = (
55
- conditionFunction: () => boolean,
56
- timeoutSeconds?: number
57
- ): Promise<void> =>
58
- new Promise<void>((resolve, reject) => {
59
- const start = Date.now();
60
- const poll = () => {
61
- if (conditionFunction()) {
62
- resolve();
63
- } else if (
64
- timeoutSeconds !== undefined &&
65
- Date.now() - start >= timeoutSeconds * 1000
66
- ) {
67
- reject(new Error("Timeout exceeded"));
68
- } else {
69
- setTimeout(poll, 400);
70
- }
71
- };
72
-
73
- poll();
74
- });
75
-
76
53
  /**
77
54
  * Get the hash of a credential without discloures.
78
55
  * A credential is a string like `header.body.sign~sd1~sd2....` where `~` is the separator between the credential and the discloures.
@@ -89,34 +66,10 @@ export const getCredentialHashWithouDiscloures = async (
89
66
  return sha256(credential.slice(0, tildeIndex));
90
67
  };
91
68
 
92
- /**
93
- * Creates a promise that waits until the provided signal is aborted.
94
- * @returns {Object} An object with `listen` and `remove` methods to handle subscribing and unsubscribing.
95
- */
96
- export const createAbortPromiseFromSignal = (signal: AbortSignal) => {
97
- let listener: () => void;
98
- return {
99
- listen: () =>
100
- new Promise<"OPERATION_ABORTED">((resolve) => {
101
- if (signal.aborted) {
102
- return resolve("OPERATION_ABORTED");
103
- }
104
- listener = () => resolve("OPERATION_ABORTED");
105
- signal.addEventListener("abort", listener);
106
- }),
107
- remove: () => signal.removeEventListener("abort", listener),
108
- };
69
+ export const safeJsonParse = <T>(text: string, withDefault?: T): T | null => {
70
+ try {
71
+ return JSON.parse(text);
72
+ } catch (_) {
73
+ return withDefault ?? null;
74
+ }
109
75
  };
110
-
111
- export const isDefined = <T>(x: T | undefined | null | ""): x is T =>
112
- Boolean(x);
113
-
114
- /**
115
- * Utility function to parse a raw HTTP response as JSON if supported, otherwise as text.
116
- */
117
- export const parseRawHttpResponse = <T extends Record<string, unknown>>(
118
- response: Response
119
- ) =>
120
- response.headers.get("content-type")?.includes("application/json")
121
- ? (response.json() as Promise<T>)
122
- : response.text();