@pagopa/io-react-native-wallet 3.3.0 → 3.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 (163) hide show
  1. package/README.md +1 -1
  2. package/lib/commonjs/credential/issuance/README.md +32 -14
  3. package/lib/commonjs/credential/issuance/api/IssuerConfig.js +1 -0
  4. package/lib/commonjs/credential/issuance/api/IssuerConfig.js.map +1 -1
  5. package/lib/commonjs/credential/issuance/common/06-verify-and-parse-credential.sdjwt.js +5 -3
  6. package/lib/commonjs/credential/issuance/common/06-verify-and-parse-credential.sdjwt.js.map +1 -1
  7. package/lib/commonjs/credential/issuance/v1.0.0/02-start-user-authorization.js +2 -1
  8. package/lib/commonjs/credential/issuance/v1.0.0/02-start-user-authorization.js.map +1 -1
  9. package/lib/commonjs/credential/issuance/v1.0.0/03-complete-user-authorization.js +8 -5
  10. package/lib/commonjs/credential/issuance/v1.0.0/03-complete-user-authorization.js.map +1 -1
  11. package/lib/commonjs/credential/issuance/v1.0.0/index.js +2 -1
  12. package/lib/commonjs/credential/issuance/v1.0.0/index.js.map +1 -1
  13. package/lib/commonjs/credential/issuance/v1.0.0/mappers.js +3 -1
  14. package/lib/commonjs/credential/issuance/v1.0.0/mappers.js.map +1 -1
  15. package/lib/commonjs/credential/issuance/v1.3.3/02-start-user-authorization.js +1 -1
  16. package/lib/commonjs/credential/issuance/v1.3.3/02-start-user-authorization.js.map +1 -1
  17. package/lib/commonjs/credential/issuance/v1.3.3/03-complete-user-authorization.js +108 -69
  18. package/lib/commonjs/credential/issuance/v1.3.3/03-complete-user-authorization.js.map +1 -1
  19. package/lib/commonjs/credential/issuance/v1.3.3/05-obtain-credential.js +1 -1
  20. package/lib/commonjs/credential/issuance/v1.3.3/05-obtain-credential.js.map +1 -1
  21. package/lib/commonjs/credential/issuance/v1.3.3/index.js +2 -1
  22. package/lib/commonjs/credential/issuance/v1.3.3/index.js.map +1 -1
  23. package/lib/commonjs/credential/issuance/v1.3.3/mappers.js +9 -10
  24. package/lib/commonjs/credential/issuance/v1.3.3/mappers.js.map +1 -1
  25. package/lib/commonjs/credential/presentation/api/types.js.map +1 -1
  26. package/lib/commonjs/credential/presentation/common/utils/http.js +9 -4
  27. package/lib/commonjs/credential/presentation/common/utils/http.js.map +1 -1
  28. package/lib/commonjs/credential/presentation/v1.0.0/07-send-authorization-response.js +3 -1
  29. package/lib/commonjs/credential/presentation/v1.0.0/07-send-authorization-response.js.map +1 -1
  30. package/lib/commonjs/credential/presentation/v1.3.3/05-verify-request-object.js +11 -10
  31. package/lib/commonjs/credential/presentation/v1.3.3/05-verify-request-object.js.map +1 -1
  32. package/lib/commonjs/credential/presentation/v1.3.3/07-send-authorization-response.js +2 -0
  33. package/lib/commonjs/credential/presentation/v1.3.3/07-send-authorization-response.js.map +1 -1
  34. package/lib/commonjs/credential/presentation/v1.3.3/mappers.js +1 -1
  35. package/lib/commonjs/credential/presentation/v1.3.3/mappers.js.map +1 -1
  36. package/lib/commonjs/credentials-catalogue/api/DigitalCredentialsCatalogue.js +2 -1
  37. package/lib/commonjs/credentials-catalogue/api/DigitalCredentialsCatalogue.js.map +1 -1
  38. package/lib/commonjs/credentials-catalogue/common/get-status-l10n-ids.js +23 -0
  39. package/lib/commonjs/credentials-catalogue/common/get-status-l10n-ids.js.map +1 -0
  40. package/lib/commonjs/credentials-catalogue/v1.0.0/index.js +3 -1
  41. package/lib/commonjs/credentials-catalogue/v1.0.0/index.js.map +1 -1
  42. package/lib/commonjs/credentials-catalogue/v1.3.3/index.js +3 -1
  43. package/lib/commonjs/credentials-catalogue/v1.3.3/index.js.map +1 -1
  44. package/lib/commonjs/utils/config.js +9 -1
  45. package/lib/commonjs/utils/config.js.map +1 -1
  46. package/lib/module/credential/issuance/README.md +32 -14
  47. package/lib/module/credential/issuance/api/IssuerConfig.js +1 -0
  48. package/lib/module/credential/issuance/api/IssuerConfig.js.map +1 -1
  49. package/lib/module/credential/issuance/common/06-verify-and-parse-credential.sdjwt.js +5 -3
  50. package/lib/module/credential/issuance/common/06-verify-and-parse-credential.sdjwt.js.map +1 -1
  51. package/lib/module/credential/issuance/v1.0.0/02-start-user-authorization.js +2 -1
  52. package/lib/module/credential/issuance/v1.0.0/02-start-user-authorization.js.map +1 -1
  53. package/lib/module/credential/issuance/v1.0.0/03-complete-user-authorization.js +6 -4
  54. package/lib/module/credential/issuance/v1.0.0/03-complete-user-authorization.js.map +1 -1
  55. package/lib/module/credential/issuance/v1.0.0/index.js +3 -2
  56. package/lib/module/credential/issuance/v1.0.0/index.js.map +1 -1
  57. package/lib/module/credential/issuance/v1.0.0/mappers.js +3 -1
  58. package/lib/module/credential/issuance/v1.0.0/mappers.js.map +1 -1
  59. package/lib/module/credential/issuance/v1.3.3/02-start-user-authorization.js +1 -1
  60. package/lib/module/credential/issuance/v1.3.3/02-start-user-authorization.js.map +1 -1
  61. package/lib/module/credential/issuance/v1.3.3/03-complete-user-authorization.js +108 -70
  62. package/lib/module/credential/issuance/v1.3.3/03-complete-user-authorization.js.map +1 -1
  63. package/lib/module/credential/issuance/v1.3.3/05-obtain-credential.js +1 -1
  64. package/lib/module/credential/issuance/v1.3.3/05-obtain-credential.js.map +1 -1
  65. package/lib/module/credential/issuance/v1.3.3/index.js +3 -2
  66. package/lib/module/credential/issuance/v1.3.3/index.js.map +1 -1
  67. package/lib/module/credential/issuance/v1.3.3/mappers.js +9 -10
  68. package/lib/module/credential/issuance/v1.3.3/mappers.js.map +1 -1
  69. package/lib/module/credential/presentation/api/types.js.map +1 -1
  70. package/lib/module/credential/presentation/common/utils/http.js +9 -4
  71. package/lib/module/credential/presentation/common/utils/http.js.map +1 -1
  72. package/lib/module/credential/presentation/v1.0.0/07-send-authorization-response.js +3 -1
  73. package/lib/module/credential/presentation/v1.0.0/07-send-authorization-response.js.map +1 -1
  74. package/lib/module/credential/presentation/v1.3.3/05-verify-request-object.js +11 -10
  75. package/lib/module/credential/presentation/v1.3.3/05-verify-request-object.js.map +1 -1
  76. package/lib/module/credential/presentation/v1.3.3/07-send-authorization-response.js +2 -0
  77. package/lib/module/credential/presentation/v1.3.3/07-send-authorization-response.js.map +1 -1
  78. package/lib/module/credential/presentation/v1.3.3/mappers.js +1 -1
  79. package/lib/module/credential/presentation/v1.3.3/mappers.js.map +1 -1
  80. package/lib/module/credentials-catalogue/api/DigitalCredentialsCatalogue.js +1 -1
  81. package/lib/module/credentials-catalogue/api/DigitalCredentialsCatalogue.js.map +1 -1
  82. package/lib/module/credentials-catalogue/common/get-status-l10n-ids.js +16 -0
  83. package/lib/module/credentials-catalogue/common/get-status-l10n-ids.js.map +1 -0
  84. package/lib/module/credentials-catalogue/v1.0.0/index.js +3 -1
  85. package/lib/module/credentials-catalogue/v1.0.0/index.js.map +1 -1
  86. package/lib/module/credentials-catalogue/v1.3.3/index.js +3 -1
  87. package/lib/module/credentials-catalogue/v1.3.3/index.js.map +1 -1
  88. package/lib/module/utils/config.js +7 -0
  89. package/lib/module/utils/config.js.map +1 -1
  90. package/lib/typescript/credential/issuance/api/02-start-user-authorization.d.ts +1 -0
  91. package/lib/typescript/credential/issuance/api/02-start-user-authorization.d.ts.map +1 -1
  92. package/lib/typescript/credential/issuance/api/03-complete-user-authorization.d.ts +19 -5
  93. package/lib/typescript/credential/issuance/api/03-complete-user-authorization.d.ts.map +1 -1
  94. package/lib/typescript/credential/issuance/api/IssuerConfig.d.ts +1 -0
  95. package/lib/typescript/credential/issuance/api/IssuerConfig.d.ts.map +1 -1
  96. package/lib/typescript/credential/issuance/common/06-verify-and-parse-credential.sdjwt.d.ts.map +1 -1
  97. package/lib/typescript/credential/issuance/v1.0.0/02-start-user-authorization.d.ts.map +1 -1
  98. package/lib/typescript/credential/issuance/v1.0.0/03-complete-user-authorization.d.ts +2 -1
  99. package/lib/typescript/credential/issuance/v1.0.0/03-complete-user-authorization.d.ts.map +1 -1
  100. package/lib/typescript/credential/issuance/v1.0.0/index.d.ts.map +1 -1
  101. package/lib/typescript/credential/issuance/v1.0.0/mappers.d.ts +1 -0
  102. package/lib/typescript/credential/issuance/v1.0.0/mappers.d.ts.map +1 -1
  103. package/lib/typescript/credential/issuance/v1.3.3/03-complete-user-authorization.d.ts +2 -1
  104. package/lib/typescript/credential/issuance/v1.3.3/03-complete-user-authorization.d.ts.map +1 -1
  105. package/lib/typescript/credential/issuance/v1.3.3/index.d.ts.map +1 -1
  106. package/lib/typescript/credential/issuance/v1.3.3/mappers.d.ts +7 -4
  107. package/lib/typescript/credential/issuance/v1.3.3/mappers.d.ts.map +1 -1
  108. package/lib/typescript/credential/presentation/api/05-verify-request-object.d.ts +1 -1
  109. package/lib/typescript/credential/presentation/api/types.d.ts +3 -7
  110. package/lib/typescript/credential/presentation/api/types.d.ts.map +1 -1
  111. package/lib/typescript/credential/presentation/common/utils/http.d.ts +1 -1
  112. package/lib/typescript/credential/presentation/common/utils/http.d.ts.map +1 -1
  113. package/lib/typescript/credential/presentation/v1.3.3/05-verify-request-object.d.ts.map +1 -1
  114. package/lib/typescript/credential/presentation/v1.3.3/07-send-authorization-response.d.ts.map +1 -1
  115. package/lib/typescript/credential/presentation/v1.3.3/mappers.d.ts +8 -8
  116. package/lib/typescript/credential/presentation/v1.3.3/types.d.ts +8 -8
  117. package/lib/typescript/credentials-catalogue/api/DigitalCredentialsCatalogue.d.ts +6 -0
  118. package/lib/typescript/credentials-catalogue/api/DigitalCredentialsCatalogue.d.ts.map +1 -1
  119. package/lib/typescript/credentials-catalogue/api/index.d.ts +14 -2
  120. package/lib/typescript/credentials-catalogue/api/index.d.ts.map +1 -1
  121. package/lib/typescript/credentials-catalogue/common/get-status-l10n-ids.d.ts +9 -0
  122. package/lib/typescript/credentials-catalogue/common/get-status-l10n-ids.d.ts.map +1 -0
  123. package/lib/typescript/credentials-catalogue/v1.0.0/index.d.ts.map +1 -1
  124. package/lib/typescript/credentials-catalogue/v1.3.3/index.d.ts.map +1 -1
  125. package/lib/typescript/trust/v1.3.3/types.d.ts +6 -4
  126. package/lib/typescript/trust/v1.3.3/types.d.ts.map +1 -1
  127. package/lib/typescript/utils/config.d.ts +4 -0
  128. package/lib/typescript/utils/config.d.ts.map +1 -1
  129. package/package.json +6 -6
  130. package/src/credential/issuance/README.md +32 -14
  131. package/src/credential/issuance/api/02-start-user-authorization.ts +1 -0
  132. package/src/credential/issuance/api/03-complete-user-authorization.ts +26 -5
  133. package/src/credential/issuance/api/IssuerConfig.ts +1 -0
  134. package/src/credential/issuance/common/06-verify-and-parse-credential.sdjwt.ts +8 -4
  135. package/src/credential/issuance/v1.0.0/02-start-user-authorization.ts +7 -1
  136. package/src/credential/issuance/v1.0.0/03-complete-user-authorization.ts +16 -4
  137. package/src/credential/issuance/v1.0.0/index.ts +4 -2
  138. package/src/credential/issuance/v1.0.0/mappers.ts +5 -0
  139. package/src/credential/issuance/v1.3.3/02-start-user-authorization.ts +1 -1
  140. package/src/credential/issuance/v1.3.3/03-complete-user-authorization.ts +138 -94
  141. package/src/credential/issuance/v1.3.3/05-obtain-credential.ts +1 -1
  142. package/src/credential/issuance/v1.3.3/index.ts +4 -2
  143. package/src/credential/issuance/v1.3.3/mappers.ts +9 -10
  144. package/src/credential/presentation/api/05-verify-request-object.ts +1 -1
  145. package/src/credential/presentation/api/types.ts +3 -7
  146. package/src/credential/presentation/common/utils/http.ts +2 -2
  147. package/src/credential/presentation/v1.0.0/07-send-authorization-response.ts +1 -1
  148. package/src/credential/presentation/v1.3.3/05-verify-request-object.ts +15 -14
  149. package/src/credential/presentation/v1.3.3/07-send-authorization-response.ts +2 -0
  150. package/src/credential/presentation/v1.3.3/mappers.ts +1 -1
  151. package/src/credentials-catalogue/api/DigitalCredentialsCatalogue.ts +4 -1
  152. package/src/credentials-catalogue/api/index.ts +15 -0
  153. package/src/credentials-catalogue/common/get-status-l10n-ids.ts +25 -0
  154. package/src/credentials-catalogue/v1.0.0/index.ts +2 -0
  155. package/src/credentials-catalogue/v1.3.3/index.ts +2 -0
  156. package/src/utils/config.ts +7 -0
  157. package/lib/commonjs/credential/presentation/common/utils.js +0 -28
  158. package/lib/commonjs/credential/presentation/common/utils.js.map +0 -1
  159. package/lib/module/credential/presentation/common/utils.js +0 -21
  160. package/lib/module/credential/presentation/common/utils.js.map +0 -1
  161. package/lib/typescript/credential/presentation/common/utils.d.ts +0 -11
  162. package/lib/typescript/credential/presentation/common/utils.d.ts.map +0 -1
  163. package/src/credential/presentation/common/utils.ts +0 -30
@@ -20,13 +20,15 @@ const AdministrativeExpirationUserInfo = z.object({
20
20
  description_l10n_id: z.string(),
21
21
  });
22
22
 
23
- const AllowedState = z
23
+ export const AllowedState = z
24
24
  .object({
25
25
  title_l10n_id: z.string(),
26
26
  description_l10n_id: z.string(),
27
27
  })
28
28
  .catchall(z.string());
29
29
 
30
+ export type AllowedState = z.infer<typeof AllowedState>;
31
+
30
32
  const CredentialPurpose = z.object({
31
33
  id: z.string(),
32
34
  description: z.string().optional(),
@@ -116,6 +118,7 @@ export const DigitalCredential = z.object({
116
118
  formats: z.array(CredentialFormat).optional(),
117
119
  // claims: z.array(Claim), // TODO: [SIW-3978] Should we keep claims?
118
120
  });
121
+ export type DigitalCredential = z.infer<typeof DigitalCredential>;
119
122
 
120
123
  const TaxonomyPurpose = z.object({
121
124
  id: z.string(),
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  type CatalogueTranslations,
3
+ type DigitalCredential,
3
4
  type DigitalCredentialsCatalogue,
4
5
  type LocalizationInfo,
5
6
  type Taxonomy,
@@ -48,10 +49,24 @@ export interface CredentialsCatalogueApi {
48
49
  locales: string[],
49
50
  ctx?: FetchContext
50
51
  ): Promise<CatalogueTranslations>;
52
+
53
+ /**
54
+ * Given a statusBit (e.g. "0x00", "0x0B") and a DigitalCredential from the
55
+ * catalogue, returns the matching l10n IDs or undefined if not found.
56
+ * The comparison is case-insensitive to handle uppercase statusBit values
57
+ * returned by verifyAndParseStatusList against lowercase keys in the catalogue.
58
+ *
59
+ * @since 1.0.0
60
+ */
61
+ getStatusL10nIds(
62
+ statusBit: string,
63
+ credentialConfig: DigitalCredential
64
+ ): { titleL10nId: string; descriptionL10nId: string } | undefined;
51
65
  }
52
66
 
53
67
  export {
54
68
  type CatalogueTranslations,
69
+ type DigitalCredential,
55
70
  type DigitalCredentialsCatalogue,
56
71
  type LocalizationInfo,
57
72
  type Taxonomy,
@@ -0,0 +1,25 @@
1
+ import { AllowedState } from "../api/DigitalCredentialsCatalogue";
2
+ import { type CredentialsCatalogueApi } from "../api";
3
+
4
+ /**
5
+ * Given a statusBit (e.g. "0x00", "0x0B") and a DigitalCredential from the
6
+ * catalogue, returns the matching l10n IDs or undefined if not found.
7
+ * The comparison is case-insensitive to handle uppercase statusBit values
8
+ * returned by verifyAndParseStatusList against lowercase keys in the catalogue.
9
+ */
10
+ export const getStatusL10nIds: CredentialsCatalogueApi["getStatusL10nIds"] = (
11
+ statusBit,
12
+ credentialConfig
13
+ ) => {
14
+ const normalizedBit = statusBit.toLowerCase();
15
+ const match = credentialConfig.validity_info.allowed_states.find(
16
+ (s): s is AllowedState =>
17
+ typeof s === "object" &&
18
+ Object.keys(s).some((k) => k.toLowerCase() === normalizedBit)
19
+ );
20
+ if (!match) return undefined;
21
+ return {
22
+ titleL10nId: match.title_l10n_id,
23
+ descriptionL10nId: match.description_l10n_id,
24
+ };
25
+ };
@@ -1,6 +1,8 @@
1
1
  import type { CredentialsCatalogueApi } from "../api";
2
2
  import { fetchAndParseCatalogue } from "./fetch-and-parse-catalogue";
3
+ import { getStatusL10nIds } from "../common/get-status-l10n-ids";
3
4
 
4
5
  export const CredentialsCatalogue: CredentialsCatalogueApi = {
5
6
  fetchAndParseCatalogue,
7
+ getStatusL10nIds,
6
8
  };
@@ -1,8 +1,10 @@
1
1
  import type { CredentialsCatalogueApi } from "../api";
2
2
  import { fetchAndParseCatalogue } from "./fetch-and-parse-catalogue";
3
3
  import { fetchTranslations } from "./fetch-translations";
4
+ import { getStatusL10nIds } from "../common/get-status-l10n-ids";
4
5
 
5
6
  export const CredentialsCatalogue: CredentialsCatalogueApi = {
6
7
  fetchAndParseCatalogue,
7
8
  fetchTranslations,
9
+ getStatusL10nIds,
8
10
  };
@@ -16,3 +16,10 @@ export const sdkConfigV1_0 = new IoWalletSdkConfig({
16
16
  export const sdkConfigV1_3 = new IoWalletSdkConfig({
17
17
  itWalletSpecsVersion: ItWalletSpecsVersion.V1_3,
18
18
  });
19
+
20
+ /**
21
+ * IO Wallet SDK configuration object for v1.4 specs.
22
+ */
23
+ export const sdkConfigV1_4 = new IoWalletSdkConfig({
24
+ itWalletSpecsVersion: ItWalletSpecsVersion.V1_4,
25
+ });
@@ -1,28 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.buildDirectPostBody = void 0;
7
- /**
8
- * Builds a URL-encoded form body for a direct POST response without encryption.
9
- *
10
- * @param requestObject - Contains state, nonce, and other relevant info.
11
- * @param payload - Object that contains either the VP token to encrypt and the stringified mapping of the credential disclosures or the error code
12
- * @returns A URL-encoded string suitable for an `application/x-www-form-urlencoded` POST body.
13
- */
14
- const buildDirectPostBody = async (requestObject, payload) => {
15
- const formUrlEncodedBody = new URLSearchParams({
16
- state: requestObject.state,
17
- ...Object.entries(payload).reduce((acc, _ref) => {
18
- let [key, value] = _ref;
19
- return {
20
- ...acc,
21
- [key]: Array.isArray(value) || typeof value === "object" ? JSON.stringify(value) : value
22
- };
23
- }, {})
24
- });
25
- return formUrlEncodedBody.toString();
26
- };
27
- exports.buildDirectPostBody = buildDirectPostBody;
28
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["buildDirectPostBody","requestObject","payload","formUrlEncodedBody","URLSearchParams","state","Object","entries","reduce","acc","_ref","key","value","Array","isArray","JSON","stringify","toString","exports"],"sourceRoot":"../../../../../src","sources":["credential/presentation/common/utils.ts"],"mappings":";;;;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,mBAAmB,GAAG,MAAAA,CACjCC,aAA4B,EAC5BC,OAAuC,KACnB;EACpB,MAAMC,kBAAkB,GAAG,IAAIC,eAAe,CAAC;IAC7CC,KAAK,EAAEJ,aAAa,CAACI,KAAK;IAC1B,GAAGC,MAAM,CAACC,OAAO,CAACL,OAAO,CAAC,CAACM,MAAM,CAC/B,CAACC,GAAG,EAAAC,IAAA;MAAA,IAAE,CAACC,GAAG,EAAEC,KAAK,CAAC,GAAAF,IAAA;MAAA,OAAM;QACtB,GAAGD,GAAG;QACN,CAACE,GAAG,GACFE,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC,IAAI,OAAOA,KAAK,KAAK,QAAQ,GAC7CG,IAAI,CAACC,SAAS,CAACJ,KAAK,CAAC,GACrBA;MACR,CAAC;IAAA,CAAC,EACF,CAAC,CACH;EACF,CAAC,CAAC;EAEF,OAAOT,kBAAkB,CAACc,QAAQ,CAAC,CAAC;AACtC,CAAC;AAACC,OAAA,CAAAlB,mBAAA,GAAAA,mBAAA"}
@@ -1,21 +0,0 @@
1
- /**
2
- * Builds a URL-encoded form body for a direct POST response without encryption.
3
- *
4
- * @param requestObject - Contains state, nonce, and other relevant info.
5
- * @param payload - Object that contains either the VP token to encrypt and the stringified mapping of the credential disclosures or the error code
6
- * @returns A URL-encoded string suitable for an `application/x-www-form-urlencoded` POST body.
7
- */
8
- export const buildDirectPostBody = async (requestObject, payload) => {
9
- const formUrlEncodedBody = new URLSearchParams({
10
- state: requestObject.state,
11
- ...Object.entries(payload).reduce((acc, _ref) => {
12
- let [key, value] = _ref;
13
- return {
14
- ...acc,
15
- [key]: Array.isArray(value) || typeof value === "object" ? JSON.stringify(value) : value
16
- };
17
- }, {})
18
- });
19
- return formUrlEncodedBody.toString();
20
- };
21
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["buildDirectPostBody","requestObject","payload","formUrlEncodedBody","URLSearchParams","state","Object","entries","reduce","acc","_ref","key","value","Array","isArray","JSON","stringify","toString"],"sourceRoot":"../../../../../src","sources":["credential/presentation/common/utils.ts"],"mappings":"AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,mBAAmB,GAAG,MAAAA,CACjCC,aAA4B,EAC5BC,OAAuC,KACnB;EACpB,MAAMC,kBAAkB,GAAG,IAAIC,eAAe,CAAC;IAC7CC,KAAK,EAAEJ,aAAa,CAACI,KAAK;IAC1B,GAAGC,MAAM,CAACC,OAAO,CAACL,OAAO,CAAC,CAACM,MAAM,CAC/B,CAACC,GAAG,EAAAC,IAAA;MAAA,IAAE,CAACC,GAAG,EAAEC,KAAK,CAAC,GAAAF,IAAA;MAAA,OAAM;QACtB,GAAGD,GAAG;QACN,CAACE,GAAG,GACFE,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC,IAAI,OAAOA,KAAK,KAAK,QAAQ,GAC7CG,IAAI,CAACC,SAAS,CAACJ,KAAK,CAAC,GACrBA;MACR,CAAC;IAAA,CAAC,EACF,CAAC,CACH;EACF,CAAC,CAAC;EAEF,OAAOT,kBAAkB,CAACc,QAAQ,CAAC,CAAC;AACtC,CAAC"}
@@ -1,11 +0,0 @@
1
- import type { RequestObject } from "../api";
2
- import type { DirectAuthorizationBodyPayload } from "../v1.0.0/types";
3
- /**
4
- * Builds a URL-encoded form body for a direct POST response without encryption.
5
- *
6
- * @param requestObject - Contains state, nonce, and other relevant info.
7
- * @param payload - Object that contains either the VP token to encrypt and the stringified mapping of the credential disclosures or the error code
8
- * @returns A URL-encoded string suitable for an `application/x-www-form-urlencoded` POST body.
9
- */
10
- export declare const buildDirectPostBody: (requestObject: RequestObject, payload: DirectAuthorizationBodyPayload) => Promise<string>;
11
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/credential/presentation/common/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,iBAAiB,CAAC;AAEtE;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,GAC9B,eAAe,aAAa,EAC5B,SAAS,8BAA8B,KACtC,OAAO,CAAC,MAAM,CAgBhB,CAAC"}
@@ -1,30 +0,0 @@
1
- import type { RequestObject } from "../api";
2
- import type { DirectAuthorizationBodyPayload } from "../v1.0.0/types";
3
-
4
- /**
5
- * Builds a URL-encoded form body for a direct POST response without encryption.
6
- *
7
- * @param requestObject - Contains state, nonce, and other relevant info.
8
- * @param payload - Object that contains either the VP token to encrypt and the stringified mapping of the credential disclosures or the error code
9
- * @returns A URL-encoded string suitable for an `application/x-www-form-urlencoded` POST body.
10
- */
11
- export const buildDirectPostBody = async (
12
- requestObject: RequestObject,
13
- payload: DirectAuthorizationBodyPayload
14
- ): Promise<string> => {
15
- const formUrlEncodedBody = new URLSearchParams({
16
- state: requestObject.state,
17
- ...Object.entries(payload).reduce(
18
- (acc, [key, value]) => ({
19
- ...acc,
20
- [key]:
21
- Array.isArray(value) || typeof value === "object"
22
- ? JSON.stringify(value)
23
- : value,
24
- }),
25
- {} as Record<string, string>
26
- ),
27
- });
28
-
29
- return formUrlEncodedBody.toString();
30
- };