@pagopa/io-react-native-wallet 2.2.0 → 2.4.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 (167) hide show
  1. package/README.md +4 -3
  2. package/lib/commonjs/credential/index.js +3 -1
  3. package/lib/commonjs/credential/index.js.map +1 -1
  4. package/lib/commonjs/credential/issuance/03-start-user-authorization.js +24 -6
  5. package/lib/commonjs/credential/issuance/03-start-user-authorization.js.map +1 -1
  6. package/lib/commonjs/credential/issuance/04-complete-user-authorization.js +26 -2
  7. package/lib/commonjs/credential/issuance/04-complete-user-authorization.js.map +1 -1
  8. package/lib/commonjs/credential/issuance/README.md +155 -18
  9. package/lib/commonjs/credential/issuance/index.js +9 -1
  10. package/lib/commonjs/credential/issuance/index.js.map +1 -1
  11. package/lib/commonjs/credential/issuance/mrtd-pop/01-verify-and-parse-challenge-info.js +57 -0
  12. package/lib/commonjs/credential/issuance/mrtd-pop/01-verify-and-parse-challenge-info.js.map +1 -0
  13. package/lib/commonjs/credential/issuance/mrtd-pop/02-init-challenge.js +61 -0
  14. package/lib/commonjs/credential/issuance/mrtd-pop/02-init-challenge.js.map +1 -0
  15. package/lib/commonjs/credential/issuance/mrtd-pop/03-validate-challenge.js +95 -0
  16. package/lib/commonjs/credential/issuance/mrtd-pop/03-validate-challenge.js.map +1 -0
  17. package/lib/commonjs/credential/issuance/mrtd-pop/README.md +92 -0
  18. package/lib/commonjs/credential/issuance/mrtd-pop/index.js +33 -0
  19. package/lib/commonjs/credential/issuance/mrtd-pop/index.js.map +1 -0
  20. package/lib/commonjs/credential/issuance/mrtd-pop/types.js +57 -0
  21. package/lib/commonjs/credential/issuance/mrtd-pop/types.js.map +1 -0
  22. package/lib/commonjs/credential/offer/01-start-flow.js +75 -0
  23. package/lib/commonjs/credential/offer/01-start-flow.js.map +1 -0
  24. package/lib/commonjs/credential/offer/02-fetch-credential-offer.js +45 -0
  25. package/lib/commonjs/credential/offer/02-fetch-credential-offer.js.map +1 -0
  26. package/lib/commonjs/credential/offer/README.md +174 -0
  27. package/lib/commonjs/credential/offer/errors.js +22 -0
  28. package/lib/commonjs/credential/offer/errors.js.map +1 -0
  29. package/lib/commonjs/credential/offer/index.js +25 -0
  30. package/lib/commonjs/credential/offer/index.js.map +1 -0
  31. package/lib/commonjs/credential/offer/types.js +51 -0
  32. package/lib/commonjs/credential/offer/types.js.map +1 -0
  33. package/lib/commonjs/credential/presentation/01-start-flow.js +1 -1
  34. package/lib/commonjs/credentials-catalogue/README.md +15 -0
  35. package/lib/commonjs/credentials-catalogue/fetch-and-parse-catalogue.js +42 -0
  36. package/lib/commonjs/credentials-catalogue/fetch-and-parse-catalogue.js.map +1 -0
  37. package/lib/commonjs/credentials-catalogue/index.js +13 -0
  38. package/lib/commonjs/credentials-catalogue/index.js.map +1 -0
  39. package/lib/commonjs/credentials-catalogue/types.js +99 -0
  40. package/lib/commonjs/credentials-catalogue/types.js.map +1 -0
  41. package/lib/commonjs/index.js +3 -1
  42. package/lib/commonjs/index.js.map +1 -1
  43. package/lib/commonjs/utils/auth.js +9 -1
  44. package/lib/commonjs/utils/auth.js.map +1 -1
  45. package/lib/commonjs/utils/par.js +7 -2
  46. package/lib/commonjs/utils/par.js.map +1 -1
  47. package/lib/commonjs/utils/zod.js +28 -0
  48. package/lib/commonjs/utils/zod.js.map +1 -0
  49. package/lib/module/credential/index.js +2 -1
  50. package/lib/module/credential/index.js.map +1 -1
  51. package/lib/module/credential/issuance/03-start-user-authorization.js +24 -6
  52. package/lib/module/credential/issuance/03-start-user-authorization.js.map +1 -1
  53. package/lib/module/credential/issuance/04-complete-user-authorization.js +25 -2
  54. package/lib/module/credential/issuance/04-complete-user-authorization.js.map +1 -1
  55. package/lib/module/credential/issuance/README.md +155 -18
  56. package/lib/module/credential/issuance/index.js +3 -2
  57. package/lib/module/credential/issuance/index.js.map +1 -1
  58. package/lib/module/credential/issuance/mrtd-pop/01-verify-and-parse-challenge-info.js +50 -0
  59. package/lib/module/credential/issuance/mrtd-pop/01-verify-and-parse-challenge-info.js.map +1 -0
  60. package/lib/module/credential/issuance/mrtd-pop/02-init-challenge.js +52 -0
  61. package/lib/module/credential/issuance/mrtd-pop/02-init-challenge.js.map +1 -0
  62. package/lib/module/credential/issuance/mrtd-pop/03-validate-challenge.js +85 -0
  63. package/lib/module/credential/issuance/mrtd-pop/03-validate-challenge.js.map +1 -0
  64. package/lib/module/credential/issuance/mrtd-pop/README.md +92 -0
  65. package/lib/module/credential/issuance/mrtd-pop/index.js +5 -0
  66. package/lib/module/credential/issuance/mrtd-pop/index.js.map +1 -0
  67. package/lib/module/credential/issuance/mrtd-pop/types.js +46 -0
  68. package/lib/module/credential/issuance/mrtd-pop/types.js.map +1 -0
  69. package/lib/module/credential/offer/01-start-flow.js +66 -0
  70. package/lib/module/credential/offer/01-start-flow.js.map +1 -0
  71. package/lib/module/credential/offer/02-fetch-credential-offer.js +38 -0
  72. package/lib/module/credential/offer/02-fetch-credential-offer.js.map +1 -0
  73. package/lib/module/credential/offer/README.md +174 -0
  74. package/lib/module/credential/offer/errors.js +14 -0
  75. package/lib/module/credential/offer/errors.js.map +1 -0
  76. package/lib/module/credential/offer/index.js +5 -0
  77. package/lib/module/credential/offer/index.js.map +1 -0
  78. package/lib/module/credential/offer/types.js +41 -0
  79. package/lib/module/credential/offer/types.js.map +1 -0
  80. package/lib/module/credential/presentation/01-start-flow.js +1 -1
  81. package/lib/module/credentials-catalogue/README.md +15 -0
  82. package/lib/module/credentials-catalogue/fetch-and-parse-catalogue.js +35 -0
  83. package/lib/module/credentials-catalogue/fetch-and-parse-catalogue.js.map +1 -0
  84. package/lib/module/credentials-catalogue/index.js +2 -0
  85. package/lib/module/credentials-catalogue/index.js.map +1 -0
  86. package/lib/module/credentials-catalogue/types.js +89 -0
  87. package/lib/module/credentials-catalogue/types.js.map +1 -0
  88. package/lib/module/index.js +2 -1
  89. package/lib/module/index.js.map +1 -1
  90. package/lib/module/utils/auth.js +8 -0
  91. package/lib/module/utils/auth.js.map +1 -1
  92. package/lib/module/utils/par.js +7 -2
  93. package/lib/module/utils/par.js.map +1 -1
  94. package/lib/module/utils/zod.js +20 -0
  95. package/lib/module/utils/zod.js.map +1 -0
  96. package/lib/typescript/credential/index.d.ts +2 -1
  97. package/lib/typescript/credential/index.d.ts.map +1 -1
  98. package/lib/typescript/credential/issuance/01-start-flow.d.ts +1 -1
  99. package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts +14 -4
  100. package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts.map +1 -1
  101. package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts +9 -1
  102. package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts.map +1 -1
  103. package/lib/typescript/credential/issuance/index.d.ts +4 -3
  104. package/lib/typescript/credential/issuance/index.d.ts.map +1 -1
  105. package/lib/typescript/credential/issuance/mrtd-pop/01-verify-and-parse-challenge-info.d.ts +25 -0
  106. package/lib/typescript/credential/issuance/mrtd-pop/01-verify-and-parse-challenge-info.d.ts.map +1 -0
  107. package/lib/typescript/credential/issuance/mrtd-pop/02-init-challenge.d.ts +23 -0
  108. package/lib/typescript/credential/issuance/mrtd-pop/02-init-challenge.d.ts.map +1 -0
  109. package/lib/typescript/credential/issuance/mrtd-pop/03-validate-challenge.d.ts +39 -0
  110. package/lib/typescript/credential/issuance/mrtd-pop/03-validate-challenge.d.ts.map +1 -0
  111. package/lib/typescript/credential/issuance/mrtd-pop/index.d.ts +7 -0
  112. package/lib/typescript/credential/issuance/mrtd-pop/index.d.ts.map +1 -0
  113. package/lib/typescript/credential/issuance/mrtd-pop/types.d.ts +201 -0
  114. package/lib/typescript/credential/issuance/mrtd-pop/types.d.ts.map +1 -0
  115. package/lib/typescript/credential/offer/01-start-flow.d.ts +172 -0
  116. package/lib/typescript/credential/offer/01-start-flow.d.ts.map +1 -0
  117. package/lib/typescript/credential/offer/02-fetch-credential-offer.d.ts +20 -0
  118. package/lib/typescript/credential/offer/02-fetch-credential-offer.d.ts.map +1 -0
  119. package/lib/typescript/credential/offer/errors.d.ts +10 -0
  120. package/lib/typescript/credential/offer/errors.d.ts.map +1 -0
  121. package/lib/typescript/credential/offer/index.d.ts +7 -0
  122. package/lib/typescript/credential/offer/index.d.ts.map +1 -0
  123. package/lib/typescript/credential/offer/types.d.ts +264 -0
  124. package/lib/typescript/credential/offer/types.d.ts.map +1 -0
  125. package/lib/typescript/credential/presentation/01-start-flow.d.ts +1 -1
  126. package/lib/typescript/credentials-catalogue/fetch-and-parse-catalogue.d.ts +15 -0
  127. package/lib/typescript/credentials-catalogue/fetch-and-parse-catalogue.d.ts.map +1 -0
  128. package/lib/typescript/credentials-catalogue/index.d.ts +3 -0
  129. package/lib/typescript/credentials-catalogue/index.d.ts.map +1 -0
  130. package/lib/typescript/credentials-catalogue/types.d.ts +844 -0
  131. package/lib/typescript/credentials-catalogue/types.d.ts.map +1 -0
  132. package/lib/typescript/index.d.ts +2 -1
  133. package/lib/typescript/index.d.ts.map +1 -1
  134. package/lib/typescript/utils/auth.d.ts +11 -0
  135. package/lib/typescript/utils/auth.d.ts.map +1 -1
  136. package/lib/typescript/utils/par.d.ts +34 -4
  137. package/lib/typescript/utils/par.d.ts.map +1 -1
  138. package/lib/typescript/utils/zod.d.ts +15 -0
  139. package/lib/typescript/utils/zod.d.ts.map +1 -0
  140. package/package.json +21 -2
  141. package/src/credential/index.ts +2 -1
  142. package/src/credential/issuance/01-start-flow.ts +1 -1
  143. package/src/credential/issuance/03-start-user-authorization.ts +30 -7
  144. package/src/credential/issuance/04-complete-user-authorization.ts +43 -1
  145. package/src/credential/issuance/README.md +155 -18
  146. package/src/credential/issuance/index.ts +7 -1
  147. package/src/credential/issuance/mrtd-pop/01-verify-and-parse-challenge-info.ts +70 -0
  148. package/src/credential/issuance/mrtd-pop/02-init-challenge.ts +82 -0
  149. package/src/credential/issuance/mrtd-pop/03-validate-challenge.ts +140 -0
  150. package/src/credential/issuance/mrtd-pop/README.md +92 -0
  151. package/src/credential/issuance/mrtd-pop/index.ts +27 -0
  152. package/src/credential/issuance/mrtd-pop/types.ts +65 -0
  153. package/src/credential/offer/01-start-flow.ts +89 -0
  154. package/src/credential/offer/02-fetch-credential-offer.ts +54 -0
  155. package/src/credential/offer/README.md +174 -0
  156. package/src/credential/offer/errors.ts +17 -0
  157. package/src/credential/offer/index.ts +16 -0
  158. package/src/credential/offer/types.ts +59 -0
  159. package/src/credential/presentation/01-start-flow.ts +1 -1
  160. package/src/credentials-catalogue/README.md +15 -0
  161. package/src/credentials-catalogue/fetch-and-parse-catalogue.ts +54 -0
  162. package/src/credentials-catalogue/index.ts +2 -0
  163. package/src/credentials-catalogue/types.ts +97 -0
  164. package/src/index.ts +2 -0
  165. package/src/utils/auth.ts +12 -0
  166. package/src/utils/par.ts +12 -4
  167. package/src/utils/zod.ts +28 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/credentials-catalogue/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAmDzB,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqB5B,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAatC,CAAC;AACH,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAC/C,OAAO,2BAA2B,CACnC,CAAC"}
@@ -2,6 +2,7 @@ import type { AuthorizationContext } from "./utils/auth";
2
2
  import { fixBase64EncodingOnKey } from "./utils/jwk";
3
3
  import "react-native-url-polyfill/auto";
4
4
  import * as Credential from "./credential";
5
+ import * as CredentialsCatalogue from "./credentials-catalogue";
5
6
  import * as PID from "./pid";
6
7
  import * as SdJwt from "./sd-jwt";
7
8
  import * as Mdoc from "./mdoc";
@@ -13,6 +14,6 @@ import * as Logging from "./utils/logging";
13
14
  import { AuthorizationDetail, AuthorizationDetails } from "./utils/par";
14
15
  import { createCryptoContextFor } from "./utils/crypto";
15
16
  import type { IntegrityContext } from "./utils/integrity";
16
- export { SdJwt, Mdoc, PID, Credential, WalletInstanceAttestation, WalletInstance, Errors, Trust, createCryptoContextFor, AuthorizationDetail, AuthorizationDetails, fixBase64EncodingOnKey, Logging, };
17
+ export { SdJwt, Mdoc, PID, Credential, CredentialsCatalogue, WalletInstanceAttestation, WalletInstance, Errors, Trust, createCryptoContextFor, AuthorizationDetail, AuthorizationDetails, fixBase64EncodingOnKey, Logging, };
17
18
  export type { IntegrityContext, AuthorizationContext };
18
19
  //# 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,IAAI,MAAM,QAAQ,CAAC;AAC/B,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,OAAO,MAAM,iBAAiB,CAAC;AAC3C,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,IAAI,EACJ,GAAG,EACH,UAAU,EACV,yBAAyB,EACzB,cAAc,EACd,MAAM,EACN,KAAK,EACL,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,OAAO,GACR,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,oBAAoB,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAC7B,OAAO,KAAK,KAAK,MAAM,UAAU,CAAC;AAClC,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,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,OAAO,MAAM,iBAAiB,CAAC;AAC3C,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,IAAI,EACJ,GAAG,EACH,UAAU,EACV,oBAAoB,EACpB,yBAAyB,EACzB,cAAc,EACd,MAAM,EACN,KAAK,EACL,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,OAAO,GACR,CAAC;AAEF,YAAY,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,CAAC"}
@@ -49,4 +49,15 @@ export declare const AuthorizationErrorShape: z.ZodObject<{
49
49
  * Type of the identification result.
50
50
  */
51
51
  export type AuthorizationResult = z.infer<typeof AuthorizationResultShape>;
52
+ /**
53
+ * MRTD PoP Challenge Info response structure
54
+ */
55
+ export declare const AuthorizationChallengeResultShape: z.ZodObject<{
56
+ challenge_info: z.ZodString;
57
+ }, "strip", z.ZodTypeAny, {
58
+ challenge_info: string;
59
+ }, {
60
+ challenge_info: string;
61
+ }>;
62
+ export type AuthorizationChallengeResult = z.infer<typeof AuthorizationChallengeResultShape>;
52
63
  //# sourceMappingURL=auth.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/utils/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CACrE;AAED;;GAEG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;EAInC,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;EAKlC,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/utils/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CACrE;AAED;;GAEG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;EAInC,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;EAKlC,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE3E;;GAEG;AAEH,eAAO,MAAM,iCAAiC;;;;;;EAE5C,CAAC;AAEH,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAChD,OAAO,iCAAiC,CACzC,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { type CryptoContext } from "@pagopa/io-react-native-jwt";
2
2
  import * as z from "zod";
3
3
  export type AuthorizationDetail = z.infer<typeof AuthorizationDetail>;
4
- export declare const AuthorizationDetail: z.ZodObject<{
4
+ export declare const AuthorizationDetail: z.ZodUnion<[z.ZodObject<{
5
5
  type: z.ZodLiteral<"openid_credential">;
6
6
  credential_configuration_id: z.ZodString;
7
7
  }, "strip", z.ZodTypeAny, {
@@ -10,9 +10,24 @@ export declare const AuthorizationDetail: z.ZodObject<{
10
10
  }, {
11
11
  type: "openid_credential";
12
12
  credential_configuration_id: string;
13
- }>;
13
+ }>, z.ZodObject<{
14
+ type: z.ZodLiteral<"it_l2+document_proof">;
15
+ idphinting: z.ZodString;
16
+ challenge_method: z.ZodLiteral<"mrtd+ias">;
17
+ challenge_redirect_uri: z.ZodString;
18
+ }, "strip", z.ZodTypeAny, {
19
+ type: "it_l2+document_proof";
20
+ idphinting: string;
21
+ challenge_method: "mrtd+ias";
22
+ challenge_redirect_uri: string;
23
+ }, {
24
+ type: "it_l2+document_proof";
25
+ idphinting: string;
26
+ challenge_method: "mrtd+ias";
27
+ challenge_redirect_uri: string;
28
+ }>]>;
14
29
  export type AuthorizationDetails = z.infer<typeof AuthorizationDetails>;
15
- export declare const AuthorizationDetails: z.ZodArray<z.ZodObject<{
30
+ export declare const AuthorizationDetails: z.ZodArray<z.ZodUnion<[z.ZodObject<{
16
31
  type: z.ZodLiteral<"openid_credential">;
17
32
  credential_configuration_id: z.ZodString;
18
33
  }, "strip", z.ZodTypeAny, {
@@ -21,7 +36,22 @@ export declare const AuthorizationDetails: z.ZodArray<z.ZodObject<{
21
36
  }, {
22
37
  type: "openid_credential";
23
38
  credential_configuration_id: string;
24
- }>, "many">;
39
+ }>, z.ZodObject<{
40
+ type: z.ZodLiteral<"it_l2+document_proof">;
41
+ idphinting: z.ZodString;
42
+ challenge_method: z.ZodLiteral<"mrtd+ias">;
43
+ challenge_redirect_uri: z.ZodString;
44
+ }, "strip", z.ZodTypeAny, {
45
+ type: "it_l2+document_proof";
46
+ idphinting: string;
47
+ challenge_method: "mrtd+ias";
48
+ challenge_redirect_uri: string;
49
+ }, {
50
+ type: "it_l2+document_proof";
51
+ idphinting: string;
52
+ challenge_method: "mrtd+ias";
53
+ challenge_redirect_uri: string;
54
+ }>]>, "many">;
25
55
  export type ParResponse = z.infer<typeof ParResponse>;
26
56
  export declare const ParResponse: z.ZodObject<{
27
57
  request_uri: z.ZodString;
@@ -1 +1 @@
1
- {"version":3,"file":"par.d.ts","sourceRoot":"","sources":["../../../src/utils/par.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,aAAa,EAEnB,MAAM,6BAA6B,CAAC;AAErC,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAOzB,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AACtE,eAAO,MAAM,mBAAmB;;;;;;;;;EAG9B,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AACxE,eAAO,MAAM,oBAAoB;;;;;;;;;WAA+B,CAAC;AAEjE,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AACtD,eAAO,MAAM,WAAW;;;;;;;;;EAGtB,CAAC;AAEH,KAAK,kBAAkB,GACnB;IAAE,oBAAoB,EAAE,oBAAoB,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAC9D;IAAE,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnE,KAAK,iBAAiB,GAAG;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;CACb,GAAG,kBAAkB,CAAC;AAEvB;;GAEG;AACH,eAAO,MAAM,cAAc;sBAKL,aAAa;cACrB,WAAW,CAAC,OAAO,CAAC;oBAGjB,MAAM,6BACQ,MAAM,4FAS9B,iBAAiB,KACnB,QAAQ,MAAM,CA0EhB,CAAC"}
1
+ {"version":3,"file":"par.d.ts","sourceRoot":"","sources":["../../../src/utils/par.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,aAAa,EAEnB,MAAM,6BAA6B,CAAC;AAErC,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAOzB,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AACtE,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;IAW9B,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AACxE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;aAA+B,CAAC;AAEjE,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AACtD,eAAO,MAAM,WAAW;;;;;;;;;EAGtB,CAAC;AAEH,KAAK,kBAAkB,GACnB;IAAE,oBAAoB,EAAE,oBAAoB,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAC9D;IAAE,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnE,KAAK,iBAAiB,GAAG;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;CACb,GAAG,kBAAkB,CAAC;AAEvB;;GAEG;AACH,eAAO,MAAM,cAAc;sBAKL,aAAa;cACrB,WAAW,CAAC,OAAO,CAAC;oBAGjB,MAAM,6BACQ,MAAM,4FAS9B,iBAAiB,KACnB,QAAQ,MAAM,CA0EhB,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @see https://github.com/JacobWeisenburger/zod_utilz/blob/main/src/stringToJSON.ts
3
+ */
4
+ import { z } from "zod";
5
+ declare const literalSchema: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>;
6
+ type Literal = z.infer<typeof literalSchema>;
7
+ type Json = Literal | {
8
+ [key: string]: Json;
9
+ } | Json[];
10
+ export declare const json: () => z.ZodType<Json, z.ZodTypeDef, Json>;
11
+ export declare const stringToJSONSchema: z.ZodEffects<z.ZodString, string | number | boolean | {
12
+ [key: string]: Json;
13
+ } | Json[] | null, string>;
14
+ export {};
15
+ //# sourceMappingURL=zod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zod.d.ts","sourceRoot":"","sources":["../../../src/utils/zod.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,QAAA,MAAM,aAAa,iEAA2D,CAAC;AAE/E,KAAK,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAE7C,KAAK,IAAI,GAAG,OAAO,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAAG,IAAI,EAAE,CAAC;AAMvD,eAAO,MAAM,IAAI,2CAAmB,CAAC;AAErC,eAAO,MAAM,kBAAkB;;0BAS3B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pagopa/io-react-native-wallet",
3
- "version": "2.2.0",
3
+ "version": "2.4.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",
@@ -64,6 +64,7 @@
64
64
  "@types/react": "^19.0.0",
65
65
  "@types/react-native": "0.70.0",
66
66
  "@types/url-parse": "^1.4.11",
67
+ "auto-changelog": "^2.5.0",
67
68
  "del-cli": "^5.0.0",
68
69
  "eslint": "^8.4.1",
69
70
  "eslint-plugin-prettier": "^5.2.3",
@@ -73,12 +74,13 @@
73
74
  "react": "19.0.0",
74
75
  "react-native": "0.78.3",
75
76
  "react-native-builder-bob": "^0.20.0",
77
+ "release-it": "^15.0.0",
76
78
  "typed-openapi": "^0.4.1",
77
79
  "typescript": "5.0.4"
78
80
  },
79
81
  "peerDependencies": {
80
- "@pagopa/io-react-native-iso18013": "*",
81
82
  "@pagopa/io-react-native-crypto": "*",
83
+ "@pagopa/io-react-native-iso18013": "*",
82
84
  "@pagopa/io-react-native-jwt": "*",
83
85
  "react": "*",
84
86
  "react-native": "*"
@@ -87,6 +89,23 @@
87
89
  "node": ">= 16.0.0"
88
90
  },
89
91
  "packageManager": "yarn@1.22.19",
92
+ "release-it": {
93
+ "git": {
94
+ "commitMessage": "chore: release version ${version}",
95
+ "tagName": "v${version}",
96
+ "changelog": "yarn auto-changelog --stdout --commit-limit false -u --template https://raw.githubusercontent.com/release-it/release-it/master/templates/changelog-compact.hbs"
97
+ },
98
+ "hooks": {
99
+ "after:bump": "yarn auto-changelog -p && git add ."
100
+ },
101
+ "npm": {
102
+ "publish": false
103
+ },
104
+ "github": {
105
+ "release": true
106
+ },
107
+ "plugins": {}
108
+ },
90
109
  "jest": {
91
110
  "preset": "react-native",
92
111
  "modulePathIgnorePatterns": [
@@ -2,5 +2,6 @@ import * as Issuance from "./issuance";
2
2
  import * as Presentation from "./presentation";
3
3
  import * as Status from "./status";
4
4
  import * as Trustmark from "./trustmark";
5
+ import * as Offer from "./offer";
5
6
 
6
- export { Issuance, Presentation, Status, Trustmark };
7
+ export { Issuance, Presentation, Status, Trustmark, Offer };
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * WARNING: This is the first function to be called in the issuing flow. The next function to be called is {@link evaluateIssuerTrust}.
3
3
  * The beginning of the issuing flow.
4
- * To be implemented accordind to the user touchpoint
4
+ * To be implemented according to the user touchpoint
5
5
  *
6
6
  * @returns The configuration ID of the Credential to be issued and the url of the Issuer
7
7
  */
@@ -9,6 +9,7 @@ import { LogLevel, Logger } from "../../utils/logging";
9
9
  export type StartUserAuthorization = (
10
10
  issuerConf: Out<EvaluateIssuerTrust>["issuerConf"],
11
11
  credentialIds: string[],
12
+ proof: { proofType: "none" } | { proofType: "mrtd-pop"; idpHinting: string },
12
13
  context: {
13
14
  wiaCryptoContext: CryptoContext;
14
15
  walletInstanceAttestation: string;
@@ -114,21 +115,26 @@ const selectResponseMode = (
114
115
  * it is possible to use the same access token for the issuance of all requested credentials.
115
116
  * This is an HTTP POST request containing the Wallet Instance identifier (client id), the code challenge and challenge method as specified by PKCE according to RFC 9126
116
117
  * along with the WTE and its proof of possession (WTE-PoP).
117
- * Additionally, it includes a request object, which is a signed JWT encapsulating the type of digital credential requested (authorization_details),
118
- * the application session identifier on the Wallet Instance side (state),
118
+ * Additionally, it includes a request object, which is a signed JWT encapsulating the type of digital credential requested (authorization_details), challenge method and
119
+ * redirect URI for the document proof step (if L2 flow), the application session identifier on the Wallet Instance side (state),
119
120
  * the method (query or form_post.jwt) by which the Authorization Server
120
121
  * should transmit the Authorization Response containing the authorization code issued upon the end user's authentication (response_mode)
121
122
  * to the Wallet Instance's Token Endpoint to obtain the Access Token, and the redirectUri of the Wallet Instance where the Authorization Response
122
123
  * should be delivered. The redirect is achived by using a custom URL scheme that the Wallet Instance is registered to handle.
123
124
  * @param issuerConf The issuer configuration
124
125
  * @param credentialIds The credential configuration IDs to be requested
125
- * @param ctx The context object containing the Wallet Instance's cryptographic context, the Wallet Instance's attestation, the redirect URI and the fetch implementation
126
+ * @param proof The configuration for the proof to be used in the request: "none" for standard flows, "document" for L2+ with MRTD verification.
127
+ * @param ctx The context object containing;
128
+ * - wiaCryptoContext: the Wallet Instance's cryptographic context
129
+ * - walletInstanceAttestation: the Wallet Instance's attestation
130
+ * - redirectUri: the redirect URI
131
+ * - appFetch: (optional) the fetch implementation
126
132
  * @returns The URI to which the end user should be redirected to start the authentication flow, along with the client id, the code verifier and the credential definition(s)
127
133
  */
128
-
129
134
  export const startUserAuthorization: StartUserAuthorization = async (
130
135
  issuerConf,
131
136
  credentialIds,
137
+ proof,
132
138
  ctx
133
139
  ) => {
134
140
  const {
@@ -151,11 +157,28 @@ export const startUserAuthorization: StartUserAuthorization = async (
151
157
  const parEndpoint =
152
158
  issuerConf.oauth_authorization_server.pushed_authorization_request_endpoint;
153
159
  const aud = issuerConf.openid_credential_issuer.credential_issuer;
154
- const credentialDefinition = credentialIds.map((c) =>
155
- selectCredentialDefinition(issuerConf, c)
156
- );
157
160
  const responseMode = selectResponseMode(issuerConf, credentialIds);
158
161
  const getPar = makeParRequest({ wiaCryptoContext, appFetch });
162
+
163
+ const credentialDefinition = [
164
+ ...credentialIds.map((c) => selectCredentialDefinition(issuerConf, c)),
165
+ ];
166
+
167
+ if (proof.proofType === "mrtd-pop") {
168
+ /**
169
+ * When we requests a PID using eID Substantial Authentication with MRTD Verification, we must include
170
+ * an additional Authorization Details Object in the authorization_details
171
+ *
172
+ * See https://italia.github.io/eid-wallet-it-docs/versione-corrente/en/credential-issuance-endpoint.html#pushed-authorization-request-endpoint
173
+ */
174
+ credentialDefinition.push({
175
+ type: "it_l2+document_proof",
176
+ idphinting: proof.idpHinting,
177
+ challenge_method: "mrtd+ias",
178
+ challenge_redirect_uri: redirectUri,
179
+ });
180
+ }
181
+
159
182
  const issuerRequestUri = await getPar(
160
183
  parEndpoint,
161
184
  walletInstanceAttestation,
@@ -1,6 +1,8 @@
1
1
  import {
2
+ AuthorizationChallengeResultShape,
2
3
  AuthorizationErrorShape,
3
4
  AuthorizationResultShape,
5
+ type AuthorizationChallengeResult,
4
6
  type AuthorizationResult,
5
7
  } from "../../utils/auth";
6
8
  import { hasStatusOrThrow, type Out } from "../../utils/misc";
@@ -28,6 +30,10 @@ export type CompleteUserAuthorizationWithQueryMode = (
28
30
  authRedirectUrl: string
29
31
  ) => Promise<AuthorizationResult>;
30
32
 
33
+ export type ContinueUserAuthorizationWithMRTDPoPChallenge = (
34
+ authRedirectUrl: string
35
+ ) => Promise<AuthorizationChallengeResult>;
36
+
31
37
  export type CompleteUserAuthorizationWithFormPostJwtMode = (
32
38
  requestObject: Out<GetRequestedCredentialToBePresented>,
33
39
  pid: string,
@@ -54,6 +60,42 @@ export type BuildAuthorizationUrl = (
54
60
  authUrl: string;
55
61
  }>;
56
62
 
63
+ /**
64
+ * WARNING: this function must be called after obtaining the authorization redirect URL from the webviews (SPID and CIE L3) or browser for CIEID, and the PID
65
+ * issuance requires a MRTD PoP challenge.
66
+ * @param authRedirectUrl The URL to which the end user should be redirected to start the MRTD PoP validation flow
67
+ * @returns the authorization response which contains the challenge
68
+ */
69
+ export const continueUserAuthorizationWithMRTDPoPChallenge: ContinueUserAuthorizationWithMRTDPoPChallenge =
70
+ async (authRedirectUrl) => {
71
+ Logger.log(
72
+ LogLevel.DEBUG,
73
+ `The requested credential is a PersonIdentificationData and requires MRTD PoP, starting MRTD PoP validation from auth redirect`
74
+ );
75
+ const query = parseUrl(authRedirectUrl).query;
76
+
77
+ const authResParsed = AuthorizationChallengeResultShape.safeParse(query);
78
+ if (!authResParsed.success) {
79
+ const authErr = AuthorizationErrorShape.safeParse(query);
80
+ if (!authErr.success) {
81
+ Logger.log(
82
+ LogLevel.ERROR,
83
+ `Error while parsing the authorization response: ${authResParsed.error.message}`
84
+ );
85
+ throw new AuthorizationError(authResParsed.error.message); // an error occured while parsing the result and the error
86
+ }
87
+ Logger.log(
88
+ LogLevel.ERROR,
89
+ `Error while authorizating with the idp: ${JSON.stringify(authErr)}`
90
+ );
91
+ throw new AuthorizationIdpError(
92
+ authErr.data.error,
93
+ authErr.data.error_description
94
+ );
95
+ }
96
+ return authResParsed.data;
97
+ };
98
+
57
99
  /**
58
100
  * 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
101
  * Builds the authorization URL to which the end user should be redirected to continue the authentication flow.
@@ -97,7 +139,7 @@ export const completeUserAuthorizationWithQueryMode: CompleteUserAuthorizationWi
97
139
  async (authRedirectUrl) => {
98
140
  Logger.log(
99
141
  LogLevel.DEBUG,
100
- `The requeste credential is a PersonIdentificationData, completing the user authorization with query mode`
142
+ `The requested credential is a PersonIdentificationData, completing the user authorization with query mode`
101
143
  );
102
144
  const query = parseUrl(authRedirectUrl).query;
103
145
 
@@ -23,30 +23,45 @@ graph TD;
23
23
  6[obtainCredential]
24
24
  7[verifyAndParseCredential]
25
25
  credSel{Is credential an eID?}
26
+ proofSel{Requires MRTD PoP?}
27
+ M1[continueUserAuthorizationWithMRTDPoPChallenge]
28
+ subgraph MRTD PoP flow
29
+ M2[verifyAndParseChallengeInfo]
30
+ M3[initChallenge]
31
+ M4[validateChallenge]
32
+ end
26
33
 
27
34
  0 --> 1
28
35
  1 --> 2
29
36
  2 --> 3
30
37
  3 --> credSel
31
- credSel -->|Yes| E4
38
+ credSel -->|Yes| proofSel
32
39
  credSel -->|No| C4
40
+ proofSel --> |Yes| M1
41
+ proofSel --> |No| E4
33
42
  C4 --> C4.1
34
43
  C4.1 --> 5
35
44
  E4 --> 5
36
45
  5 --> 6
37
46
  6 --> 7
47
+
48
+ M1 --> M2
49
+ M2 --> M3
50
+ M3 --> M4
51
+ M4 --> E4
52
+
38
53
  ```
39
54
 
40
55
  ## Mapped results
41
56
 
42
57
  The following errors are mapped to a `IssuerResponseError` with specific codes.
43
58
 
44
- |HTTP Status|Error Code|Description|
45
- |-----------|----------|-----------|
46
- |`201 Created`|`ERR_CREDENTIAL_ISSUING_NOT_SYNCHRONOUS`| This response is returned by the credential issuer when the request has been queued because the credential cannot be issued synchronously. The consumer should try to obtain the credential at a later time. Although `201 Created` is not considered an error, it is mapped as an error in this context in order to handle the case where the credential issuance is not synchronous. This allows keeping the flow consistent and handle the case where the credential is not immediately available.|
47
- |`403 Forbidden`|`ERR_CREDENTIAL_INVALID_STATUS`|This response is returned by the credential issuer when the requested credential has an invalid status. It might contain more details in the `reason` property.|
48
- |`404 Not Found`|`ERR_CREDENTIAL_INVALID_STATUS`| This response is returned by the credential issuer when the authenticated user is not entitled to receive the requested credential. It might contain more details in the `reason` property.|
49
- |`*`|`ERR_ISSUER_GENERIC_ERROR`|This is a generic error code to map unexpected errors that occurred when interacting with the Issuer.|
59
+ | HTTP Status | Error Code | Description |
60
+ | --------------- | ---------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
61
+ | `201 Created` | `ERR_CREDENTIAL_ISSUING_NOT_SYNCHRONOUS` | This response is returned by the credential issuer when the request has been queued because the credential cannot be issued synchronously. The consumer should try to obtain the credential at a later time. Although `201 Created` is not considered an error, it is mapped as an error in this context in order to handle the case where the credential issuance is not synchronous. This allows keeping the flow consistent and handle the case where the credential is not immediately available. |
62
+ | `403 Forbidden` | `ERR_CREDENTIAL_INVALID_STATUS` | This response is returned by the credential issuer when the requested credential has an invalid status. It might contain more details in the `reason` property. |
63
+ | `404 Not Found` | `ERR_CREDENTIAL_INVALID_STATUS` | This response is returned by the credential issuer when the authenticated user is not entitled to receive the requested credential. It might contain more details in the `reason` property. |
64
+ | `*` | `ERR_ISSUER_GENERIC_ERROR` | This is a generic error code to map unexpected errors that occurred when interacting with the Issuer. |
50
65
 
51
66
  ## Strong authentication for eID issuance (Query Mode)
52
67
 
@@ -60,6 +75,17 @@ CIE+PIN(L3) requires a different flow due to the physical card presence. Helper
60
75
 
61
76
  The expected result from the authentication process is in provided in the query string as defined in the [JWT Secured Authorization Response Mode for OAuth 2.0 (JARM)](https://openid.net/specs/oauth-v2-jarm.html#name-response-mode-queryjwt).
62
77
 
78
+ #### eID Substantial Authentication (L2+) with MRTD Verification
79
+
80
+ MRTD Verification is a sub-flow of the Issuance flow and is used when the requested eID requires **eID Substantial Authentication (LoA3) with MRTD (Machine Readable Travel Document) Verification**. This method provides an alternative to CIEid LoA High authentication, requiring two distinct steps to complete the authorization:
81
+
82
+ 1. **Primary Authentication**: LoA3 electronic identification (SPID or CIEid L2).
83
+ 2. **MRTD Proof of Possession (PoP)**: Electronic document reading and cryptographic verification.
84
+
85
+ This process is initiated by the Authorization Server responding to the primary authentication step with a redirect that includes a challenge in the query string, which is handled by the `continueUserAuthorizationWithMRTDPoPChallenge` function. Once the MRTD PoP is completed, the user must continue the PID issuance flow with the `completeUserAuthorizationWithQueryMode` function.
86
+
87
+ Complete documentation for the MRTD PoP flow can be found here: [mrtd-pop](./mrtd-pop/README.md)
88
+
63
89
  ## Authentication through credentials (Form Post JWT Mode)
64
90
 
65
91
  When the credential is different than an eID, the flow requires the user to present other credentials in order to obtain the requested one. This is done through the `getRequestedCredentialToBePresented` followed by the `completeUserAuthorizationWithFormPostJwtMode`.
@@ -122,8 +148,9 @@ const { issuerConf } = await Credential.Issuance.evaluateIssuerTrust(issuerUrl);
122
148
  // Start user authorization
123
149
  const { issuerRequestUri, clientId, codeVerifier } =
124
150
  await Credential.Issuance.startUserAuthorization(
125
- issuerConf,
126
- [credentialId],
151
+ issuerConf,
152
+ [credentialId],
153
+ { proofType: "none" },
127
154
  {
128
155
  walletInstanceAttestation,
129
156
  redirectUri: REDIRECT_URI,
@@ -199,10 +226,10 @@ const { parsedCredential } =
199
226
  issuerConf,
200
227
  credential,
201
228
  credential_configuration_id,
202
- {
203
- credentialCryptoContext,
229
+ {
230
+ credentialCryptoContext,
204
231
  ignoreMissingAttributes: true,
205
- includeUndefinedAttributes: false
232
+ includeUndefinedAttributes: false
206
233
  },
207
234
  mockX509CertRoot
208
235
  );
@@ -285,6 +312,7 @@ const { issuerRequestUri, clientId, codeVerifier, credentialDefinition } =
285
312
  await Credential.Issuance.startUserAuthorization(
286
313
  issuerConf,
287
314
  [credentialId], // Request authorization for one or more credentials
315
+ { proofType: "none" },
288
316
  {
289
317
  walletInstanceAttestation,
290
318
  redirectUri,
@@ -296,12 +324,7 @@ const { issuerRequestUri, clientId, codeVerifier, credentialDefinition } =
296
324
  // Complete the authorization process with query mode with the authorizationContext which opens the browser
297
325
  const { code } =
298
326
  await Credential.Issuance.completeUserAuthorizationWithQueryMode(
299
- issuerRequestUri,
300
- clientId,
301
- issuerConf,
302
- idpHint,
303
- redirectUri,
304
- authorizationContext
327
+ issuerRequestUri
305
328
  );
306
329
 
307
330
  // Create DPoP context which will be used for the whole issuance flow
@@ -372,3 +395,117 @@ return {
372
395
  The result of this flow is a raw credential and a parsed credential which must be stored securely in the wallet along with its crypto key.
373
396
 
374
397
  </details>
398
+
399
+ <details>
400
+ <summary>eID issuance flow with MRTD PoP validation</summary>
401
+
402
+ ```ts
403
+ /**
404
+ *
405
+ * Previous steps are the sames as the "eID issuance flow" example
406
+ *
407
+ */
408
+
409
+ // Start user authorization indicating "mrtd-pop" as the proof type with the idpHint of the
410
+ // chosen identification method
411
+ const { issuerRequestUri, clientId, codeVerifier, credentialDefinition } =
412
+ await Credential.Issuance.startUserAuthorization(
413
+ issuerConf,
414
+ [credentialId],
415
+ { proofType: "mrtd-pop", idpHinting: idpHint },
416
+ {
417
+ walletInstanceAttestation,
418
+ redirectUri: redirectUri,
419
+ wiaCryptoContext,
420
+ appFetch,
421
+ }
422
+ );
423
+
424
+ // Obtain the Authorization URL
425
+ const { authUrl } = await Credential.Issuance.buildAuthorizationUrl(
426
+ issuerRequestUri,
427
+ clientId,
428
+ issuerConf,
429
+ idpHint
430
+ );
431
+
432
+ // Extract challenge info from the Authorization URL
433
+ const { challenge_info } =
434
+ await Credential.Issuance.continueUserAuthorizationWithMRTDPoPChallenge(
435
+ authUrl
436
+ );
437
+
438
+ // Verify and parse challenge info and extract challenge data: initialization url, session and nonce
439
+ const {
440
+ htu: initUrl,
441
+ mrtd_auth_session,
442
+ mrtd_pop_jwt_nonce,
443
+ } = await Credential.Issuance.MRTDPoP.verifyAndParseChallengeInfo(
444
+ issuerConf,
445
+ challenge_info,
446
+ { wiaCryptoContext }
447
+ );
448
+
449
+ // Initialize challenge and obtain the challenge text to sign the CIE PACE protocol and validation url
450
+ const {
451
+ htu: validationUrl,
452
+ challenge,
453
+ mrtd_pop_nonce,
454
+ } = await Credential.Issuance.MRTDPoP.initChallenge(
455
+ issuerConf,
456
+ initUrl,
457
+ mrtd_auth_session,
458
+ mrtd_pop_jwt_nonce,
459
+ {
460
+ walletInstanceAttestation,
461
+ wiaCryptoContext,
462
+ appFetch,
463
+ }
464
+ );
465
+
466
+ // CIE cryptographic interaction: you need to sign the challenge with the CIE through NFC interaction
467
+ const { nis, mrtds } = /* NFC interactions functions */
468
+
469
+ // Validate challenge
470
+ const { mrtd_val_pop_nonce, redirect_uri } =
471
+ await Credential.Issuance.MRTDPoP.validateChallenge(
472
+ issuerConf,
473
+ validationUrl,
474
+ mrtd_auth_session,
475
+ mrtd_pop_nonce,
476
+ mrtd,
477
+ ias,
478
+ {
479
+ walletInstanceAttestation,
480
+ wiaCryptoContext,
481
+ appFetch,
482
+ }
483
+ );
484
+
485
+ // Build the callback url
486
+ const { callbackUrl } = await Credential.Issuance.buildChallengeCallbackUrl(
487
+ redirect_uri,
488
+ mrtd_val_pop_nonce,
489
+ mrtd_auth_session
490
+ );
491
+
492
+ // 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.
493
+ const authRedirectUrl = /* From a browser or webview redirect */
494
+
495
+ // Complete the authorization process with query mode using the returned callback url
496
+ const { code } =
497
+ await Credential.Issuance.completeUserAuthorizationWithQueryMode(
498
+ authRedirectUrl
499
+ );
500
+
501
+ /**
502
+ *
503
+ * The next steps are the same as the "eID issuance flow" example
504
+ *
505
+ */
506
+ };
507
+ ```
508
+
509
+ The result of this flow is a raw credential and a parsed credential which must be stored securely in the wallet along with its crypto key.
510
+
511
+ </details>
@@ -8,15 +8,17 @@ import {
8
8
  type StartUserAuthorization,
9
9
  } from "./03-start-user-authorization";
10
10
  import {
11
+ continueUserAuthorizationWithMRTDPoPChallenge,
11
12
  completeUserAuthorizationWithQueryMode,
12
13
  completeUserAuthorizationWithFormPostJwtMode,
13
14
  parseAuthorizationResponse,
14
15
  buildAuthorizationUrl,
16
+ getRequestedCredentialToBePresented,
17
+ type ContinueUserAuthorizationWithMRTDPoPChallenge,
15
18
  type CompleteUserAuthorizationWithQueryMode,
16
19
  type CompleteUserAuthorizationWithFormPostJwtMode,
17
20
  type GetRequestedCredentialToBePresented,
18
21
  type BuildAuthorizationUrl,
19
- getRequestedCredentialToBePresented,
20
22
  } from "./04-complete-user-authorization";
21
23
  import { authorizeAccess, type AuthorizeAccess } from "./05-authorize-access";
22
24
  import {
@@ -28,12 +30,15 @@ import {
28
30
  type VerifyAndParseCredential,
29
31
  } from "./07-verify-and-parse-credential";
30
32
  import * as Errors from "./errors";
33
+ import * as MRTDPoP from "./mrtd-pop";
31
34
 
32
35
  export {
36
+ MRTDPoP,
33
37
  evaluateIssuerTrust,
34
38
  startUserAuthorization,
35
39
  buildAuthorizationUrl,
36
40
  completeUserAuthorizationWithQueryMode,
41
+ continueUserAuthorizationWithMRTDPoPChallenge,
37
42
  getRequestedCredentialToBePresented,
38
43
  completeUserAuthorizationWithFormPostJwtMode,
39
44
  authorizeAccess,
@@ -47,6 +52,7 @@ export type {
47
52
  EvaluateIssuerTrust,
48
53
  StartUserAuthorization,
49
54
  BuildAuthorizationUrl,
55
+ ContinueUserAuthorizationWithMRTDPoPChallenge,
50
56
  CompleteUserAuthorizationWithQueryMode,
51
57
  GetRequestedCredentialToBePresented,
52
58
  CompleteUserAuthorizationWithFormPostJwtMode,