@pagopa/io-react-native-wallet 3.3.0 → 3.4.1

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 (170) 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.mdoc.js +6 -12
  6. package/lib/commonjs/credential/issuance/common/06-verify-and-parse-credential.mdoc.js.map +1 -1
  7. package/lib/commonjs/credential/issuance/common/06-verify-and-parse-credential.sdjwt.js +5 -3
  8. package/lib/commonjs/credential/issuance/common/06-verify-and-parse-credential.sdjwt.js.map +1 -1
  9. package/lib/commonjs/credential/issuance/v1.0.0/02-start-user-authorization.js +2 -1
  10. package/lib/commonjs/credential/issuance/v1.0.0/02-start-user-authorization.js.map +1 -1
  11. package/lib/commonjs/credential/issuance/v1.0.0/03-complete-user-authorization.js +8 -5
  12. package/lib/commonjs/credential/issuance/v1.0.0/03-complete-user-authorization.js.map +1 -1
  13. package/lib/commonjs/credential/issuance/v1.0.0/index.js +2 -1
  14. package/lib/commonjs/credential/issuance/v1.0.0/index.js.map +1 -1
  15. package/lib/commonjs/credential/issuance/v1.0.0/mappers.js +3 -1
  16. package/lib/commonjs/credential/issuance/v1.0.0/mappers.js.map +1 -1
  17. package/lib/commonjs/credential/issuance/v1.3.3/02-start-user-authorization.js +1 -1
  18. package/lib/commonjs/credential/issuance/v1.3.3/02-start-user-authorization.js.map +1 -1
  19. package/lib/commonjs/credential/issuance/v1.3.3/03-complete-user-authorization.js +108 -69
  20. package/lib/commonjs/credential/issuance/v1.3.3/03-complete-user-authorization.js.map +1 -1
  21. package/lib/commonjs/credential/issuance/v1.3.3/05-obtain-credential.js +4 -1
  22. package/lib/commonjs/credential/issuance/v1.3.3/05-obtain-credential.js.map +1 -1
  23. package/lib/commonjs/credential/issuance/v1.3.3/index.js +2 -1
  24. package/lib/commonjs/credential/issuance/v1.3.3/index.js.map +1 -1
  25. package/lib/commonjs/credential/issuance/v1.3.3/mappers.js +9 -10
  26. package/lib/commonjs/credential/issuance/v1.3.3/mappers.js.map +1 -1
  27. package/lib/commonjs/credential/presentation/api/types.js.map +1 -1
  28. package/lib/commonjs/credential/presentation/common/utils/http.js +9 -4
  29. package/lib/commonjs/credential/presentation/common/utils/http.js.map +1 -1
  30. package/lib/commonjs/credential/presentation/v1.0.0/07-send-authorization-response.js +3 -1
  31. package/lib/commonjs/credential/presentation/v1.0.0/07-send-authorization-response.js.map +1 -1
  32. package/lib/commonjs/credential/presentation/v1.3.3/05-verify-request-object.js +11 -10
  33. package/lib/commonjs/credential/presentation/v1.3.3/05-verify-request-object.js.map +1 -1
  34. package/lib/commonjs/credential/presentation/v1.3.3/07-send-authorization-response.js +2 -0
  35. package/lib/commonjs/credential/presentation/v1.3.3/07-send-authorization-response.js.map +1 -1
  36. package/lib/commonjs/credential/presentation/v1.3.3/mappers.js +1 -1
  37. package/lib/commonjs/credential/presentation/v1.3.3/mappers.js.map +1 -1
  38. package/lib/commonjs/credentials-catalogue/api/DigitalCredentialsCatalogue.js +2 -1
  39. package/lib/commonjs/credentials-catalogue/api/DigitalCredentialsCatalogue.js.map +1 -1
  40. package/lib/commonjs/credentials-catalogue/common/get-status-l10n-ids.js +23 -0
  41. package/lib/commonjs/credentials-catalogue/common/get-status-l10n-ids.js.map +1 -0
  42. package/lib/commonjs/credentials-catalogue/v1.0.0/index.js +3 -1
  43. package/lib/commonjs/credentials-catalogue/v1.0.0/index.js.map +1 -1
  44. package/lib/commonjs/credentials-catalogue/v1.3.3/index.js +3 -1
  45. package/lib/commonjs/credentials-catalogue/v1.3.3/index.js.map +1 -1
  46. package/lib/commonjs/utils/config.js +9 -1
  47. package/lib/commonjs/utils/config.js.map +1 -1
  48. package/lib/module/credential/issuance/README.md +32 -14
  49. package/lib/module/credential/issuance/api/IssuerConfig.js +1 -0
  50. package/lib/module/credential/issuance/api/IssuerConfig.js.map +1 -1
  51. package/lib/module/credential/issuance/common/06-verify-and-parse-credential.mdoc.js +6 -12
  52. package/lib/module/credential/issuance/common/06-verify-and-parse-credential.mdoc.js.map +1 -1
  53. package/lib/module/credential/issuance/common/06-verify-and-parse-credential.sdjwt.js +5 -3
  54. package/lib/module/credential/issuance/common/06-verify-and-parse-credential.sdjwt.js.map +1 -1
  55. package/lib/module/credential/issuance/v1.0.0/02-start-user-authorization.js +2 -1
  56. package/lib/module/credential/issuance/v1.0.0/02-start-user-authorization.js.map +1 -1
  57. package/lib/module/credential/issuance/v1.0.0/03-complete-user-authorization.js +6 -4
  58. package/lib/module/credential/issuance/v1.0.0/03-complete-user-authorization.js.map +1 -1
  59. package/lib/module/credential/issuance/v1.0.0/index.js +3 -2
  60. package/lib/module/credential/issuance/v1.0.0/index.js.map +1 -1
  61. package/lib/module/credential/issuance/v1.0.0/mappers.js +3 -1
  62. package/lib/module/credential/issuance/v1.0.0/mappers.js.map +1 -1
  63. package/lib/module/credential/issuance/v1.3.3/02-start-user-authorization.js +1 -1
  64. package/lib/module/credential/issuance/v1.3.3/02-start-user-authorization.js.map +1 -1
  65. package/lib/module/credential/issuance/v1.3.3/03-complete-user-authorization.js +108 -70
  66. package/lib/module/credential/issuance/v1.3.3/03-complete-user-authorization.js.map +1 -1
  67. package/lib/module/credential/issuance/v1.3.3/05-obtain-credential.js +4 -1
  68. package/lib/module/credential/issuance/v1.3.3/05-obtain-credential.js.map +1 -1
  69. package/lib/module/credential/issuance/v1.3.3/index.js +3 -2
  70. package/lib/module/credential/issuance/v1.3.3/index.js.map +1 -1
  71. package/lib/module/credential/issuance/v1.3.3/mappers.js +9 -10
  72. package/lib/module/credential/issuance/v1.3.3/mappers.js.map +1 -1
  73. package/lib/module/credential/presentation/api/types.js.map +1 -1
  74. package/lib/module/credential/presentation/common/utils/http.js +9 -4
  75. package/lib/module/credential/presentation/common/utils/http.js.map +1 -1
  76. package/lib/module/credential/presentation/v1.0.0/07-send-authorization-response.js +3 -1
  77. package/lib/module/credential/presentation/v1.0.0/07-send-authorization-response.js.map +1 -1
  78. package/lib/module/credential/presentation/v1.3.3/05-verify-request-object.js +11 -10
  79. package/lib/module/credential/presentation/v1.3.3/05-verify-request-object.js.map +1 -1
  80. package/lib/module/credential/presentation/v1.3.3/07-send-authorization-response.js +2 -0
  81. package/lib/module/credential/presentation/v1.3.3/07-send-authorization-response.js.map +1 -1
  82. package/lib/module/credential/presentation/v1.3.3/mappers.js +1 -1
  83. package/lib/module/credential/presentation/v1.3.3/mappers.js.map +1 -1
  84. package/lib/module/credentials-catalogue/api/DigitalCredentialsCatalogue.js +1 -1
  85. package/lib/module/credentials-catalogue/api/DigitalCredentialsCatalogue.js.map +1 -1
  86. package/lib/module/credentials-catalogue/common/get-status-l10n-ids.js +16 -0
  87. package/lib/module/credentials-catalogue/common/get-status-l10n-ids.js.map +1 -0
  88. package/lib/module/credentials-catalogue/v1.0.0/index.js +3 -1
  89. package/lib/module/credentials-catalogue/v1.0.0/index.js.map +1 -1
  90. package/lib/module/credentials-catalogue/v1.3.3/index.js +3 -1
  91. package/lib/module/credentials-catalogue/v1.3.3/index.js.map +1 -1
  92. package/lib/module/utils/config.js +7 -0
  93. package/lib/module/utils/config.js.map +1 -1
  94. package/lib/typescript/credential/issuance/api/02-start-user-authorization.d.ts +1 -0
  95. package/lib/typescript/credential/issuance/api/02-start-user-authorization.d.ts.map +1 -1
  96. package/lib/typescript/credential/issuance/api/03-complete-user-authorization.d.ts +19 -5
  97. package/lib/typescript/credential/issuance/api/03-complete-user-authorization.d.ts.map +1 -1
  98. package/lib/typescript/credential/issuance/api/IssuerConfig.d.ts +1 -0
  99. package/lib/typescript/credential/issuance/api/IssuerConfig.d.ts.map +1 -1
  100. package/lib/typescript/credential/issuance/common/06-verify-and-parse-credential.mdoc.d.ts.map +1 -1
  101. package/lib/typescript/credential/issuance/common/06-verify-and-parse-credential.sdjwt.d.ts.map +1 -1
  102. package/lib/typescript/credential/issuance/v1.0.0/02-start-user-authorization.d.ts.map +1 -1
  103. package/lib/typescript/credential/issuance/v1.0.0/03-complete-user-authorization.d.ts +2 -1
  104. package/lib/typescript/credential/issuance/v1.0.0/03-complete-user-authorization.d.ts.map +1 -1
  105. package/lib/typescript/credential/issuance/v1.0.0/index.d.ts.map +1 -1
  106. package/lib/typescript/credential/issuance/v1.0.0/mappers.d.ts +1 -0
  107. package/lib/typescript/credential/issuance/v1.0.0/mappers.d.ts.map +1 -1
  108. package/lib/typescript/credential/issuance/v1.3.3/03-complete-user-authorization.d.ts +2 -1
  109. package/lib/typescript/credential/issuance/v1.3.3/03-complete-user-authorization.d.ts.map +1 -1
  110. package/lib/typescript/credential/issuance/v1.3.3/05-obtain-credential.d.ts.map +1 -1
  111. package/lib/typescript/credential/issuance/v1.3.3/index.d.ts.map +1 -1
  112. package/lib/typescript/credential/issuance/v1.3.3/mappers.d.ts +7 -4
  113. package/lib/typescript/credential/issuance/v1.3.3/mappers.d.ts.map +1 -1
  114. package/lib/typescript/credential/presentation/api/05-verify-request-object.d.ts +1 -1
  115. package/lib/typescript/credential/presentation/api/types.d.ts +3 -7
  116. package/lib/typescript/credential/presentation/api/types.d.ts.map +1 -1
  117. package/lib/typescript/credential/presentation/common/utils/http.d.ts +1 -1
  118. package/lib/typescript/credential/presentation/common/utils/http.d.ts.map +1 -1
  119. package/lib/typescript/credential/presentation/v1.3.3/05-verify-request-object.d.ts.map +1 -1
  120. package/lib/typescript/credential/presentation/v1.3.3/07-send-authorization-response.d.ts.map +1 -1
  121. package/lib/typescript/credential/presentation/v1.3.3/mappers.d.ts +8 -8
  122. package/lib/typescript/credential/presentation/v1.3.3/types.d.ts +8 -8
  123. package/lib/typescript/credentials-catalogue/api/DigitalCredentialsCatalogue.d.ts +6 -0
  124. package/lib/typescript/credentials-catalogue/api/DigitalCredentialsCatalogue.d.ts.map +1 -1
  125. package/lib/typescript/credentials-catalogue/api/index.d.ts +14 -2
  126. package/lib/typescript/credentials-catalogue/api/index.d.ts.map +1 -1
  127. package/lib/typescript/credentials-catalogue/common/get-status-l10n-ids.d.ts +9 -0
  128. package/lib/typescript/credentials-catalogue/common/get-status-l10n-ids.d.ts.map +1 -0
  129. package/lib/typescript/credentials-catalogue/v1.0.0/index.d.ts.map +1 -1
  130. package/lib/typescript/credentials-catalogue/v1.3.3/index.d.ts.map +1 -1
  131. package/lib/typescript/trust/v1.3.3/types.d.ts +6 -4
  132. package/lib/typescript/trust/v1.3.3/types.d.ts.map +1 -1
  133. package/lib/typescript/utils/config.d.ts +4 -0
  134. package/lib/typescript/utils/config.d.ts.map +1 -1
  135. package/package.json +6 -6
  136. package/src/credential/issuance/README.md +32 -14
  137. package/src/credential/issuance/api/02-start-user-authorization.ts +1 -0
  138. package/src/credential/issuance/api/03-complete-user-authorization.ts +26 -5
  139. package/src/credential/issuance/api/IssuerConfig.ts +1 -0
  140. package/src/credential/issuance/common/06-verify-and-parse-credential.mdoc.ts +4 -20
  141. package/src/credential/issuance/common/06-verify-and-parse-credential.sdjwt.ts +8 -4
  142. package/src/credential/issuance/v1.0.0/02-start-user-authorization.ts +7 -1
  143. package/src/credential/issuance/v1.0.0/03-complete-user-authorization.ts +16 -4
  144. package/src/credential/issuance/v1.0.0/index.ts +4 -2
  145. package/src/credential/issuance/v1.0.0/mappers.ts +5 -0
  146. package/src/credential/issuance/v1.3.3/02-start-user-authorization.ts +1 -1
  147. package/src/credential/issuance/v1.3.3/03-complete-user-authorization.ts +141 -94
  148. package/src/credential/issuance/v1.3.3/05-obtain-credential.ts +7 -1
  149. package/src/credential/issuance/v1.3.3/index.ts +4 -2
  150. package/src/credential/issuance/v1.3.3/mappers.ts +9 -10
  151. package/src/credential/presentation/api/05-verify-request-object.ts +1 -1
  152. package/src/credential/presentation/api/types.ts +3 -7
  153. package/src/credential/presentation/common/utils/http.ts +2 -2
  154. package/src/credential/presentation/v1.0.0/07-send-authorization-response.ts +1 -1
  155. package/src/credential/presentation/v1.3.3/05-verify-request-object.ts +15 -14
  156. package/src/credential/presentation/v1.3.3/07-send-authorization-response.ts +2 -0
  157. package/src/credential/presentation/v1.3.3/mappers.ts +1 -1
  158. package/src/credentials-catalogue/api/DigitalCredentialsCatalogue.ts +4 -1
  159. package/src/credentials-catalogue/api/index.ts +15 -0
  160. package/src/credentials-catalogue/common/get-status-l10n-ids.ts +25 -0
  161. package/src/credentials-catalogue/v1.0.0/index.ts +2 -0
  162. package/src/credentials-catalogue/v1.3.3/index.ts +2 -0
  163. package/src/utils/config.ts +7 -0
  164. package/lib/commonjs/credential/presentation/common/utils.js +0 -28
  165. package/lib/commonjs/credential/presentation/common/utils.js.map +0 -1
  166. package/lib/module/credential/presentation/common/utils.js +0 -21
  167. package/lib/module/credential/presentation/common/utils.js.map +0 -1
  168. package/lib/typescript/credential/presentation/common/utils.d.ts +0 -11
  169. package/lib/typescript/credential/presentation/common/utils.d.ts.map +0 -1
  170. package/src/credential/presentation/common/utils.ts +0 -30
@@ -41,6 +41,7 @@ export const mapToIssuerConfig = createMapper<
41
41
  const {
42
42
  oauth_authorization_server,
43
43
  openid_credential_issuer,
44
+ openid_credential_verifier,
44
45
  federation_entity,
45
46
  } = x.metadata;
46
47
 
@@ -67,10 +68,12 @@ export const mapToIssuerConfig = createMapper<
67
68
  pushed_authorization_request_endpoint:
68
69
  oauth_authorization_server.pushed_authorization_request_endpoint,
69
70
  token_endpoint: oauth_authorization_server.token_endpoint,
70
- nonce_endpoint: openid_credential_issuer.nonce_endpoint!,
71
+ nonce_endpoint: openid_credential_issuer.nonce_endpoint ?? "",
71
72
  federation_entity: federation_entity ?? {},
72
73
  credential_issuance_batch_size:
73
74
  openid_credential_issuer.batch_credential_issuance?.batch_size,
75
+ encrypted_response_enc_values_supported:
76
+ openid_credential_verifier?.encrypted_response_enc_values_supported,
74
77
  };
75
78
  },
76
79
  { outputSchema: IssuerConfig } // Output validation for extra-safety
@@ -79,13 +82,9 @@ export const mapToIssuerConfig = createMapper<
79
82
  export const mapToRequestObject = createMapper<
80
83
  ParsedAuthorizeRequestResult,
81
84
  RequestObject
82
- >(({ payload }) => ({
83
- iss: payload.iss ?? "UNKNOWN_ISSUER",
84
- client_id: payload.client_id,
85
- dcql_query: payload.dcql_query,
86
- nonce: payload.nonce,
87
- response_uri: payload.response_uri,
88
- state: payload.state,
89
- response_mode: payload.response_mode,
90
- response_type: payload.response_type,
85
+ >(({ header, payload }) => ({
86
+ ...payload,
87
+ iss: payload.iss ?? "",
88
+ trust_chain: header.trust_chain,
89
+ x5c: header.x5c as string[] | undefined,
91
90
  }));
@@ -7,7 +7,7 @@ export interface VerifyRequestObjectApi {
7
7
  * @since 1.0.0
8
8
  *
9
9
  * @param requestObjectEncodedJwt The Request Object in JWT format
10
- * @param params.clientId The client ID to verify
10
+ * @param params.clientId The client ID to verify (it may include a prefix)
11
11
  * @param params.rpConf Optional Relying Party configuration (OpenID Federation clients only)
12
12
  * @param params.state Optional state
13
13
  * @returns The verified Request Object
@@ -72,13 +72,9 @@ export type RemotePresentationDetails = {
72
72
  type ClientMetadata = {
73
73
  jwks: jsonWebKeySet;
74
74
  encrypted_response_enc_values_supported: string[];
75
- client_id: string;
76
- client_name: string;
77
- logo_uri: string;
78
- application_type: "web";
79
- request_uris: string[];
80
- response_uris: string[];
81
75
  vp_formats_supported: Record<string, { "sd-jwt_alg_values"?: string[] }>;
76
+ client_name?: string;
77
+ logo_uri?: string;
82
78
  };
83
79
 
84
80
  /**
@@ -88,7 +84,7 @@ export type RequestObject = {
88
84
  iss: string;
89
85
  response_uri: string;
90
86
  nonce: string;
91
- state: string;
87
+ state?: string;
92
88
  client_id: string;
93
89
  dcql_query: Record<string, unknown>;
94
90
  response_type: "vp_token";
@@ -9,11 +9,11 @@ import type { DirectAuthorizationBodyPayload } from "../../v1.0.0/types";
9
9
  * @returns A URL-encoded string suitable for an `application/x-www-form-urlencoded` POST body.
10
10
  */
11
11
  export const buildDirectPostBody = async (
12
- requestObject: RequestObject,
12
+ { state }: RequestObject,
13
13
  payload: DirectAuthorizationBodyPayload
14
14
  ): Promise<string> => {
15
15
  const formUrlEncodedBody = new URLSearchParams({
16
- state: requestObject.state,
16
+ ...(state && { state }),
17
17
  ...Object.entries(payload).reduce(
18
18
  (acc, [key, value]) => ({
19
19
  ...acc,
@@ -81,7 +81,7 @@ export const buildDirectPostJwtBody = async (
81
81
  // Build the x-www-form-urlencoded form body
82
82
  const formBody = new URLSearchParams({
83
83
  response: encryptedResponse,
84
- state: requestObject.state,
84
+ ...(requestObject.state && { state: requestObject.state }),
85
85
  });
86
86
  return formBody.toString();
87
87
  };
@@ -14,7 +14,7 @@ import { mapToRequestObject } from "./mappers";
14
14
  import type { RawRequestObject } from "./types";
15
15
 
16
16
  export const verifyRequestObject: RemotePresentationApi["verifyRequestObject"] =
17
- async (requestObjectEncodedJwt, { clientId, rpConf }) => {
17
+ async (requestObjectEncodedJwt, { clientId: fullClientId, rpConf }) => {
18
18
  const parsedRequestObject = await sdkParseAuthorizeRequest({
19
19
  config: sdkConfigV1_3,
20
20
  requestObjectJwt: requestObjectEncodedJwt,
@@ -25,17 +25,22 @@ export const verifyRequestObject: RemotePresentationApi["verifyRequestObject"] =
25
25
 
26
26
  const rawRequestObject = parsedRequestObject as RawRequestObject;
27
27
 
28
- const clientIdPrefix = extractClientIdPrefix(clientId);
28
+ const { prefix, clientId } = extractClientIdPrefix(fullClientId);
29
29
 
30
- if (clientIdPrefix === ClientIdPrefix.X509_HASH) {
30
+ if (prefix === ClientIdPrefix.X509_HASH) {
31
31
  validateX509HashClient(rawRequestObject.header.x5c, clientId);
32
32
  }
33
33
 
34
34
  if (
35
- clientIdPrefix === ClientIdPrefix.OPENID_FEDERATION ||
36
- clientIdPrefix === ClientIdPrefix.NONE
35
+ prefix === ClientIdPrefix.OPENID_FEDERATION ||
36
+ prefix === ClientIdPrefix.NONE
37
37
  ) {
38
- validateOpenIDFederationClient(rawRequestObject, clientId, rpConf);
38
+ validateOpenIDFederationClient(
39
+ rawRequestObject,
40
+ fullClientId,
41
+ clientId,
42
+ rpConf
43
+ );
39
44
  }
40
45
 
41
46
  return {
@@ -45,6 +50,7 @@ export const verifyRequestObject: RemotePresentationApi["verifyRequestObject"] =
45
50
 
46
51
  const validateOpenIDFederationClient = (
47
52
  requestObject: RawRequestObject,
53
+ fullClientId: string,
48
54
  clientId: string,
49
55
  rpConf: RelyingPartyConfig | undefined
50
56
  ) => {
@@ -55,8 +61,8 @@ const validateOpenIDFederationClient = (
55
61
  }
56
62
 
57
63
  const isClientIdMatch =
58
- clientId === requestObject.payload.client_id &&
59
- stripOpenIdFederationPrefix(clientId) === rpConf.subject;
64
+ fullClientId === requestObject.payload.client_id &&
65
+ clientId === rpConf.subject;
60
66
 
61
67
  if (!isClientIdMatch) {
62
68
  throw new InvalidRequestObjectError(
@@ -67,10 +73,8 @@ const validateOpenIDFederationClient = (
67
73
 
68
74
  const validateX509HashClient = (
69
75
  certificateChain: string[],
70
- clientId: string
76
+ x509Hash: string
71
77
  ) => {
72
- const [, x509Hash] = clientId.split(":");
73
-
74
78
  const calculatedHash = QuickCrypto.createHash("sha-256")
75
79
  .update(certificateChain[0]!, "base64")
76
80
  .digest("base64url");
@@ -81,6 +85,3 @@ const validateX509HashClient = (
81
85
  );
82
86
  }
83
87
  };
84
-
85
- const stripOpenIdFederationPrefix = (clientId: string) =>
86
- clientId.replace("openid_federation:", "");
@@ -17,6 +17,7 @@ import { AuthorizationResponse } from "./types";
17
17
  import { buildDirectPostBody } from "../common/utils/http";
18
18
  import { prepareVpToken } from "../../../sd-jwt";
19
19
  import { createCryptoContextFor } from "../../../utils/crypto";
20
+ import { sdkConfigV1_3 } from "../../../utils/config";
20
21
  import { prepareVpTokenMdoc } from "../../../mdoc";
21
22
 
22
23
  /**
@@ -126,6 +127,7 @@ export const sendAuthorizationResponse: RemotePresentationApi["sendAuthorization
126
127
  );
127
128
 
128
129
  const { jarm } = await sdkCreateAuthorizationResponse({
130
+ config: sdkConfigV1_3,
129
131
  requestObject,
130
132
  rpJwks,
131
133
  vp_token,
@@ -21,7 +21,7 @@ export const mapToRelyingPartyConfig = createMapper<
21
21
 
22
22
  export const mapToRequestObject = createMapper<RawRequestObject, RequestObject>(
23
23
  ({ payload, header }) => ({
24
- iss: payload.iss,
24
+ iss: payload.iss ?? "",
25
25
  client_id: payload.client_id,
26
26
  dcql_query: payload.dcql_query,
27
27
  nonce: payload.nonce,
@@ -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
- };