@pagopa/io-react-native-wallet 2.2.0 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) 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/offer/01-start-flow.js +75 -0
  5. package/lib/commonjs/credential/offer/01-start-flow.js.map +1 -0
  6. package/lib/commonjs/credential/offer/02-fetch-credential-offer.js +45 -0
  7. package/lib/commonjs/credential/offer/02-fetch-credential-offer.js.map +1 -0
  8. package/lib/commonjs/credential/offer/README.md +174 -0
  9. package/lib/commonjs/credential/offer/errors.js +22 -0
  10. package/lib/commonjs/credential/offer/errors.js.map +1 -0
  11. package/lib/commonjs/credential/offer/index.js +25 -0
  12. package/lib/commonjs/credential/offer/index.js.map +1 -0
  13. package/lib/commonjs/credential/offer/types.js +51 -0
  14. package/lib/commonjs/credential/offer/types.js.map +1 -0
  15. package/lib/commonjs/credential/presentation/01-start-flow.js +1 -1
  16. package/lib/commonjs/credentials-catalogue/README.md +15 -0
  17. package/lib/commonjs/credentials-catalogue/fetch-and-parse-catalogue.js +42 -0
  18. package/lib/commonjs/credentials-catalogue/fetch-and-parse-catalogue.js.map +1 -0
  19. package/lib/commonjs/credentials-catalogue/index.js +13 -0
  20. package/lib/commonjs/credentials-catalogue/index.js.map +1 -0
  21. package/lib/commonjs/credentials-catalogue/types.js +99 -0
  22. package/lib/commonjs/credentials-catalogue/types.js.map +1 -0
  23. package/lib/commonjs/index.js +3 -1
  24. package/lib/commonjs/index.js.map +1 -1
  25. package/lib/commonjs/utils/zod.js +28 -0
  26. package/lib/commonjs/utils/zod.js.map +1 -0
  27. package/lib/module/credential/index.js +2 -1
  28. package/lib/module/credential/index.js.map +1 -1
  29. package/lib/module/credential/offer/01-start-flow.js +66 -0
  30. package/lib/module/credential/offer/01-start-flow.js.map +1 -0
  31. package/lib/module/credential/offer/02-fetch-credential-offer.js +38 -0
  32. package/lib/module/credential/offer/02-fetch-credential-offer.js.map +1 -0
  33. package/lib/module/credential/offer/README.md +174 -0
  34. package/lib/module/credential/offer/errors.js +14 -0
  35. package/lib/module/credential/offer/errors.js.map +1 -0
  36. package/lib/module/credential/offer/index.js +5 -0
  37. package/lib/module/credential/offer/index.js.map +1 -0
  38. package/lib/module/credential/offer/types.js +41 -0
  39. package/lib/module/credential/offer/types.js.map +1 -0
  40. package/lib/module/credential/presentation/01-start-flow.js +1 -1
  41. package/lib/module/credentials-catalogue/README.md +15 -0
  42. package/lib/module/credentials-catalogue/fetch-and-parse-catalogue.js +35 -0
  43. package/lib/module/credentials-catalogue/fetch-and-parse-catalogue.js.map +1 -0
  44. package/lib/module/credentials-catalogue/index.js +2 -0
  45. package/lib/module/credentials-catalogue/index.js.map +1 -0
  46. package/lib/module/credentials-catalogue/types.js +89 -0
  47. package/lib/module/credentials-catalogue/types.js.map +1 -0
  48. package/lib/module/index.js +2 -1
  49. package/lib/module/index.js.map +1 -1
  50. package/lib/module/utils/zod.js +20 -0
  51. package/lib/module/utils/zod.js.map +1 -0
  52. package/lib/typescript/credential/index.d.ts +2 -1
  53. package/lib/typescript/credential/index.d.ts.map +1 -1
  54. package/lib/typescript/credential/issuance/01-start-flow.d.ts +1 -1
  55. package/lib/typescript/credential/offer/01-start-flow.d.ts +172 -0
  56. package/lib/typescript/credential/offer/01-start-flow.d.ts.map +1 -0
  57. package/lib/typescript/credential/offer/02-fetch-credential-offer.d.ts +20 -0
  58. package/lib/typescript/credential/offer/02-fetch-credential-offer.d.ts.map +1 -0
  59. package/lib/typescript/credential/offer/errors.d.ts +10 -0
  60. package/lib/typescript/credential/offer/errors.d.ts.map +1 -0
  61. package/lib/typescript/credential/offer/index.d.ts +7 -0
  62. package/lib/typescript/credential/offer/index.d.ts.map +1 -0
  63. package/lib/typescript/credential/offer/types.d.ts +264 -0
  64. package/lib/typescript/credential/offer/types.d.ts.map +1 -0
  65. package/lib/typescript/credential/presentation/01-start-flow.d.ts +1 -1
  66. package/lib/typescript/credentials-catalogue/fetch-and-parse-catalogue.d.ts +15 -0
  67. package/lib/typescript/credentials-catalogue/fetch-and-parse-catalogue.d.ts.map +1 -0
  68. package/lib/typescript/credentials-catalogue/index.d.ts +3 -0
  69. package/lib/typescript/credentials-catalogue/index.d.ts.map +1 -0
  70. package/lib/typescript/credentials-catalogue/types.d.ts +844 -0
  71. package/lib/typescript/credentials-catalogue/types.d.ts.map +1 -0
  72. package/lib/typescript/index.d.ts +2 -1
  73. package/lib/typescript/index.d.ts.map +1 -1
  74. package/lib/typescript/utils/zod.d.ts +15 -0
  75. package/lib/typescript/utils/zod.d.ts.map +1 -0
  76. package/package.json +21 -2
  77. package/src/credential/index.ts +2 -1
  78. package/src/credential/issuance/01-start-flow.ts +1 -1
  79. package/src/credential/offer/01-start-flow.ts +89 -0
  80. package/src/credential/offer/02-fetch-credential-offer.ts +54 -0
  81. package/src/credential/offer/README.md +174 -0
  82. package/src/credential/offer/errors.ts +17 -0
  83. package/src/credential/offer/index.ts +16 -0
  84. package/src/credential/offer/types.ts +59 -0
  85. package/src/credential/presentation/01-start-flow.ts +1 -1
  86. package/src/credentials-catalogue/README.md +15 -0
  87. package/src/credentials-catalogue/fetch-and-parse-catalogue.ts +54 -0
  88. package/src/credentials-catalogue/index.ts +2 -0
  89. package/src/credentials-catalogue/types.ts +97 -0
  90. package/src/index.ts +2 -0
  91. package/src/utils/zod.ts +28 -0
@@ -0,0 +1,264 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * OAuth 2.0 Authorization Code flow parameters.
4
+ */
5
+ export declare const AuthorizationCodeGrantSchema: z.ZodObject<{
6
+ issuer_state: z.ZodOptional<z.ZodString>;
7
+ authorization_server: z.ZodOptional<z.ZodString>;
8
+ }, "strip", z.ZodTypeAny, {
9
+ issuer_state?: string | undefined;
10
+ authorization_server?: string | undefined;
11
+ }, {
12
+ issuer_state?: string | undefined;
13
+ authorization_server?: string | undefined;
14
+ }>;
15
+ export type AuthorizationCodeGrant = z.infer<typeof AuthorizationCodeGrantSchema>;
16
+ /**
17
+ * Transaction Code requirements for Pre-Authorized Code flow.
18
+ */
19
+ export declare const TransactionCodeSchema: z.ZodObject<{
20
+ input_mode: z.ZodOptional<z.ZodEnum<["numeric", "text"]>>;
21
+ length: z.ZodOptional<z.ZodNumber>;
22
+ description: z.ZodOptional<z.ZodString>;
23
+ }, "strip", z.ZodTypeAny, {
24
+ input_mode?: "numeric" | "text" | undefined;
25
+ length?: number | undefined;
26
+ description?: string | undefined;
27
+ }, {
28
+ input_mode?: "numeric" | "text" | undefined;
29
+ length?: number | undefined;
30
+ description?: string | undefined;
31
+ }>;
32
+ export type TransactionCode = z.infer<typeof TransactionCodeSchema>;
33
+ /**
34
+ * Pre-Authorized Code flow parameters.
35
+ */
36
+ export declare const PreAuthorizedCodeGrantSchema: z.ZodObject<{
37
+ "pre-authorized_code": z.ZodString;
38
+ tx_code: z.ZodOptional<z.ZodObject<{
39
+ input_mode: z.ZodOptional<z.ZodEnum<["numeric", "text"]>>;
40
+ length: z.ZodOptional<z.ZodNumber>;
41
+ description: z.ZodOptional<z.ZodString>;
42
+ }, "strip", z.ZodTypeAny, {
43
+ input_mode?: "numeric" | "text" | undefined;
44
+ length?: number | undefined;
45
+ description?: string | undefined;
46
+ }, {
47
+ input_mode?: "numeric" | "text" | undefined;
48
+ length?: number | undefined;
49
+ description?: string | undefined;
50
+ }>>;
51
+ authorization_server: z.ZodOptional<z.ZodString>;
52
+ }, "strip", z.ZodTypeAny, {
53
+ "pre-authorized_code": string;
54
+ tx_code?: {
55
+ input_mode?: "numeric" | "text" | undefined;
56
+ length?: number | undefined;
57
+ description?: string | undefined;
58
+ } | undefined;
59
+ authorization_server?: string | undefined;
60
+ }, {
61
+ "pre-authorized_code": string;
62
+ tx_code?: {
63
+ input_mode?: "numeric" | "text" | undefined;
64
+ length?: number | undefined;
65
+ description?: string | undefined;
66
+ } | undefined;
67
+ authorization_server?: string | undefined;
68
+ }>;
69
+ export type PreAuthorizedCodeGrant = z.infer<typeof PreAuthorizedCodeGrantSchema>;
70
+ /**
71
+ * Supported grant types for Credential Offer.
72
+ */
73
+ export declare const GrantsSchema: z.ZodObject<{
74
+ authorization_code: z.ZodOptional<z.ZodObject<{
75
+ issuer_state: z.ZodOptional<z.ZodString>;
76
+ authorization_server: z.ZodOptional<z.ZodString>;
77
+ }, "strip", z.ZodTypeAny, {
78
+ issuer_state?: string | undefined;
79
+ authorization_server?: string | undefined;
80
+ }, {
81
+ issuer_state?: string | undefined;
82
+ authorization_server?: string | undefined;
83
+ }>>;
84
+ "urn:ietf:params:oauth:grant-type:pre-authorized_code": z.ZodOptional<z.ZodObject<{
85
+ "pre-authorized_code": z.ZodString;
86
+ tx_code: z.ZodOptional<z.ZodObject<{
87
+ input_mode: z.ZodOptional<z.ZodEnum<["numeric", "text"]>>;
88
+ length: z.ZodOptional<z.ZodNumber>;
89
+ description: z.ZodOptional<z.ZodString>;
90
+ }, "strip", z.ZodTypeAny, {
91
+ input_mode?: "numeric" | "text" | undefined;
92
+ length?: number | undefined;
93
+ description?: string | undefined;
94
+ }, {
95
+ input_mode?: "numeric" | "text" | undefined;
96
+ length?: number | undefined;
97
+ description?: string | undefined;
98
+ }>>;
99
+ authorization_server: z.ZodOptional<z.ZodString>;
100
+ }, "strip", z.ZodTypeAny, {
101
+ "pre-authorized_code": string;
102
+ tx_code?: {
103
+ input_mode?: "numeric" | "text" | undefined;
104
+ length?: number | undefined;
105
+ description?: string | undefined;
106
+ } | undefined;
107
+ authorization_server?: string | undefined;
108
+ }, {
109
+ "pre-authorized_code": string;
110
+ tx_code?: {
111
+ input_mode?: "numeric" | "text" | undefined;
112
+ length?: number | undefined;
113
+ description?: string | undefined;
114
+ } | undefined;
115
+ authorization_server?: string | undefined;
116
+ }>>;
117
+ }, "strip", z.ZodTypeAny, {
118
+ authorization_code?: {
119
+ issuer_state?: string | undefined;
120
+ authorization_server?: string | undefined;
121
+ } | undefined;
122
+ "urn:ietf:params:oauth:grant-type:pre-authorized_code"?: {
123
+ "pre-authorized_code": string;
124
+ tx_code?: {
125
+ input_mode?: "numeric" | "text" | undefined;
126
+ length?: number | undefined;
127
+ description?: string | undefined;
128
+ } | undefined;
129
+ authorization_server?: string | undefined;
130
+ } | undefined;
131
+ }, {
132
+ authorization_code?: {
133
+ issuer_state?: string | undefined;
134
+ authorization_server?: string | undefined;
135
+ } | undefined;
136
+ "urn:ietf:params:oauth:grant-type:pre-authorized_code"?: {
137
+ "pre-authorized_code": string;
138
+ tx_code?: {
139
+ input_mode?: "numeric" | "text" | undefined;
140
+ length?: number | undefined;
141
+ description?: string | undefined;
142
+ } | undefined;
143
+ authorization_server?: string | undefined;
144
+ } | undefined;
145
+ }>;
146
+ export type Grants = z.infer<typeof GrantsSchema>;
147
+ /**
148
+ * Credential Offer object as defined in OpenID4VCI Section 4.1.1.
149
+ */
150
+ export declare const CredentialOfferSchema: z.ZodObject<{
151
+ credential_issuer: z.ZodString;
152
+ credential_configuration_ids: z.ZodArray<z.ZodString, "many">;
153
+ grants: z.ZodOptional<z.ZodObject<{
154
+ authorization_code: z.ZodOptional<z.ZodObject<{
155
+ issuer_state: z.ZodOptional<z.ZodString>;
156
+ authorization_server: z.ZodOptional<z.ZodString>;
157
+ }, "strip", z.ZodTypeAny, {
158
+ issuer_state?: string | undefined;
159
+ authorization_server?: string | undefined;
160
+ }, {
161
+ issuer_state?: string | undefined;
162
+ authorization_server?: string | undefined;
163
+ }>>;
164
+ "urn:ietf:params:oauth:grant-type:pre-authorized_code": z.ZodOptional<z.ZodObject<{
165
+ "pre-authorized_code": z.ZodString;
166
+ tx_code: z.ZodOptional<z.ZodObject<{
167
+ input_mode: z.ZodOptional<z.ZodEnum<["numeric", "text"]>>;
168
+ length: z.ZodOptional<z.ZodNumber>;
169
+ description: z.ZodOptional<z.ZodString>;
170
+ }, "strip", z.ZodTypeAny, {
171
+ input_mode?: "numeric" | "text" | undefined;
172
+ length?: number | undefined;
173
+ description?: string | undefined;
174
+ }, {
175
+ input_mode?: "numeric" | "text" | undefined;
176
+ length?: number | undefined;
177
+ description?: string | undefined;
178
+ }>>;
179
+ authorization_server: z.ZodOptional<z.ZodString>;
180
+ }, "strip", z.ZodTypeAny, {
181
+ "pre-authorized_code": string;
182
+ tx_code?: {
183
+ input_mode?: "numeric" | "text" | undefined;
184
+ length?: number | undefined;
185
+ description?: string | undefined;
186
+ } | undefined;
187
+ authorization_server?: string | undefined;
188
+ }, {
189
+ "pre-authorized_code": string;
190
+ tx_code?: {
191
+ input_mode?: "numeric" | "text" | undefined;
192
+ length?: number | undefined;
193
+ description?: string | undefined;
194
+ } | undefined;
195
+ authorization_server?: string | undefined;
196
+ }>>;
197
+ }, "strip", z.ZodTypeAny, {
198
+ authorization_code?: {
199
+ issuer_state?: string | undefined;
200
+ authorization_server?: string | undefined;
201
+ } | undefined;
202
+ "urn:ietf:params:oauth:grant-type:pre-authorized_code"?: {
203
+ "pre-authorized_code": string;
204
+ tx_code?: {
205
+ input_mode?: "numeric" | "text" | undefined;
206
+ length?: number | undefined;
207
+ description?: string | undefined;
208
+ } | undefined;
209
+ authorization_server?: string | undefined;
210
+ } | undefined;
211
+ }, {
212
+ authorization_code?: {
213
+ issuer_state?: string | undefined;
214
+ authorization_server?: string | undefined;
215
+ } | undefined;
216
+ "urn:ietf:params:oauth:grant-type:pre-authorized_code"?: {
217
+ "pre-authorized_code": string;
218
+ tx_code?: {
219
+ input_mode?: "numeric" | "text" | undefined;
220
+ length?: number | undefined;
221
+ description?: string | undefined;
222
+ } | undefined;
223
+ authorization_server?: string | undefined;
224
+ } | undefined;
225
+ }>>;
226
+ }, "strip", z.ZodTypeAny, {
227
+ credential_issuer: string;
228
+ credential_configuration_ids: string[];
229
+ grants?: {
230
+ authorization_code?: {
231
+ issuer_state?: string | undefined;
232
+ authorization_server?: string | undefined;
233
+ } | undefined;
234
+ "urn:ietf:params:oauth:grant-type:pre-authorized_code"?: {
235
+ "pre-authorized_code": string;
236
+ tx_code?: {
237
+ input_mode?: "numeric" | "text" | undefined;
238
+ length?: number | undefined;
239
+ description?: string | undefined;
240
+ } | undefined;
241
+ authorization_server?: string | undefined;
242
+ } | undefined;
243
+ } | undefined;
244
+ }, {
245
+ credential_issuer: string;
246
+ credential_configuration_ids: string[];
247
+ grants?: {
248
+ authorization_code?: {
249
+ issuer_state?: string | undefined;
250
+ authorization_server?: string | undefined;
251
+ } | undefined;
252
+ "urn:ietf:params:oauth:grant-type:pre-authorized_code"?: {
253
+ "pre-authorized_code": string;
254
+ tx_code?: {
255
+ input_mode?: "numeric" | "text" | undefined;
256
+ length?: number | undefined;
257
+ description?: string | undefined;
258
+ } | undefined;
259
+ authorization_server?: string | undefined;
260
+ } | undefined;
261
+ } | undefined;
262
+ }>;
263
+ export type CredentialOffer = z.infer<typeof CredentialOfferSchema>;
264
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/credential/offer/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,eAAO,MAAM,4BAA4B;;;;;;;;;EAGvC,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAC1C,OAAO,4BAA4B,CACpC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;EAIhC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE;;GAEG;AACH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIvC,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAC1C,OAAO,4BAA4B,CACpC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIvB,CAAC;AAEH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAElD;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIhC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
@@ -18,7 +18,7 @@ declare const PresentationParams: z.ZodObject<{
18
18
  export type PresentationParams = z.infer<typeof PresentationParams>;
19
19
  /**
20
20
  * The beginning of the presentation flow.
21
- * To be implemented accordind to the user touchpoint
21
+ * To be implemented according to the user touchpoint
22
22
  *
23
23
  * @param params Presentation parameters, depending on the starting touchpoint
24
24
  * @returns The url for the Relying Party to connect with
@@ -0,0 +1,15 @@
1
+ import { DigitalCredentialsCatalogue } from "./types";
2
+ type GetCatalogueContext = {
3
+ appFetch?: GlobalFetch["fetch"];
4
+ };
5
+ /**
6
+ * Fetch and parse the Digital Credential Catalogue from the Trust Anchor.
7
+ * The catalogue's JWT signature is verified against the Trust Anchor's JWKs.
8
+ *
9
+ * @param trustAnchorUrl Base URL of the Trust Anchor
10
+ * @param context.appFetch (optional) fetch API implementation. Default: built-in fetch
11
+ * @returns The Digital Credential Catalogue payload
12
+ */
13
+ export declare const fetchAndParseCatalogue: (trustAnchorBaseUrl: string, { appFetch }?: GetCatalogueContext) => Promise<DigitalCredentialsCatalogue["payload"]>;
14
+ export {};
15
+ //# sourceMappingURL=fetch-and-parse-catalogue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch-and-parse-catalogue.d.ts","sourceRoot":"","sources":["../../../src/credentials-catalogue/fetch-and-parse-catalogue.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAGtD,KAAK,mBAAmB,GAAG;IACzB,QAAQ,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CACjC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,uBACb,MAAM,iBACJ,mBAAmB,KACxC,QAAQ,2BAA2B,CAAC,SAAS,CAAC,CAgChD,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { fetchAndParseCatalogue } from "./fetch-and-parse-catalogue";
2
+ export { type DigitalCredentialsCatalogue } from "./types";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/credentials-catalogue/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,KAAK,2BAA2B,EAAE,MAAM,SAAS,CAAC"}