@pagopa/io-react-native-wallet 0.9.2 → 0.10.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. package/lib/commonjs/credential/issuance/06-obtain-credential.js +2 -34
  2. package/lib/commonjs/credential/issuance/06-obtain-credential.js.map +1 -1
  3. package/lib/commonjs/credential/issuance/07-verify-and-parse-credential.js +169 -0
  4. package/lib/commonjs/credential/issuance/07-verify-and-parse-credential.js.map +1 -0
  5. package/lib/commonjs/credential/issuance/08-confirm-credential.js +6 -0
  6. package/lib/commonjs/credential/issuance/08-confirm-credential.js.map +1 -0
  7. package/lib/commonjs/credential/issuance/const.js +6 -1
  8. package/lib/commonjs/credential/issuance/const.js.map +1 -1
  9. package/lib/commonjs/credential/issuance/index.js +7 -0
  10. package/lib/commonjs/credential/issuance/index.js.map +1 -1
  11. package/lib/commonjs/index.js +3 -1
  12. package/lib/commonjs/index.js.map +1 -1
  13. package/lib/commonjs/sd-jwt/__test__/index.test.js +33 -1
  14. package/lib/commonjs/sd-jwt/__test__/index.test.js.map +1 -1
  15. package/lib/commonjs/sd-jwt/index.js +15 -6
  16. package/lib/commonjs/sd-jwt/index.js.map +1 -1
  17. package/lib/commonjs/sd-jwt/types.js +1 -1
  18. package/lib/commonjs/trust/types.js +7 -2
  19. package/lib/commonjs/trust/types.js.map +1 -1
  20. package/lib/commonjs/utils/misc.js +2 -2
  21. package/lib/commonjs/utils/misc.js.map +1 -1
  22. package/lib/commonjs/utils/par.js +2 -2
  23. package/lib/commonjs/utils/par.js.map +1 -1
  24. package/lib/module/credential/issuance/06-obtain-credential.js +3 -34
  25. package/lib/module/credential/issuance/06-obtain-credential.js.map +1 -1
  26. package/lib/module/credential/issuance/07-verify-and-parse-credential.js +163 -0
  27. package/lib/module/credential/issuance/07-verify-and-parse-credential.js.map +1 -0
  28. package/lib/module/credential/issuance/08-confirm-credential.js +2 -0
  29. package/lib/module/credential/issuance/08-confirm-credential.js.map +1 -0
  30. package/lib/module/credential/issuance/const.js +2 -0
  31. package/lib/module/credential/issuance/const.js.map +1 -1
  32. package/lib/module/credential/issuance/index.js +2 -1
  33. package/lib/module/credential/issuance/index.js.map +1 -1
  34. package/lib/module/index.js +2 -1
  35. package/lib/module/index.js.map +1 -1
  36. package/lib/module/sd-jwt/__test__/index.test.js +33 -1
  37. package/lib/module/sd-jwt/__test__/index.test.js.map +1 -1
  38. package/lib/module/sd-jwt/index.js +10 -6
  39. package/lib/module/sd-jwt/index.js.map +1 -1
  40. package/lib/module/sd-jwt/types.js +1 -1
  41. package/lib/module/trust/types.js +7 -2
  42. package/lib/module/trust/types.js.map +1 -1
  43. package/lib/module/utils/misc.js +2 -2
  44. package/lib/module/utils/misc.js.map +1 -1
  45. package/lib/module/utils/par.js +2 -2
  46. package/lib/module/utils/par.js.map +1 -1
  47. package/lib/typescript/credential/issuance/06-obtain-credential.d.ts +2 -1
  48. package/lib/typescript/credential/issuance/06-obtain-credential.d.ts.map +1 -1
  49. package/lib/typescript/credential/issuance/07-verify-and-parse-credential.d.ts +36 -0
  50. package/lib/typescript/credential/issuance/07-verify-and-parse-credential.d.ts.map +1 -0
  51. package/lib/typescript/credential/issuance/08-confirm-credential.d.ts +11 -0
  52. package/lib/typescript/credential/issuance/08-confirm-credential.d.ts.map +1 -0
  53. package/lib/typescript/credential/issuance/const.d.ts +3 -0
  54. package/lib/typescript/credential/issuance/const.d.ts.map +1 -1
  55. package/lib/typescript/credential/issuance/index.d.ts +4 -3
  56. package/lib/typescript/credential/issuance/index.d.ts.map +1 -1
  57. package/lib/typescript/index.d.ts +2 -1
  58. package/lib/typescript/index.d.ts.map +1 -1
  59. package/lib/typescript/sd-jwt/index.d.ts +222 -5
  60. package/lib/typescript/sd-jwt/index.d.ts.map +1 -1
  61. package/lib/typescript/sd-jwt/types.d.ts +1 -1
  62. package/lib/typescript/trust/index.d.ts +10 -2
  63. package/lib/typescript/trust/index.d.ts.map +1 -1
  64. package/lib/typescript/trust/types.d.ts +254 -22
  65. package/lib/typescript/trust/types.d.ts.map +1 -1
  66. package/lib/typescript/utils/misc.d.ts +1 -1
  67. package/lib/typescript/utils/misc.d.ts.map +1 -1
  68. package/lib/typescript/utils/par.d.ts +7 -7
  69. package/package.json +2 -2
  70. package/src/credential/issuance/06-obtain-credential.ts +3 -51
  71. package/src/credential/issuance/07-verify-and-parse-credential.ts +229 -0
  72. package/src/credential/issuance/08-confirm-credential.ts +14 -0
  73. package/src/credential/issuance/const.ts +6 -0
  74. package/src/credential/issuance/index.ts +7 -1
  75. package/src/index.ts +2 -0
  76. package/src/sd-jwt/__test__/index.test.ts +32 -1
  77. package/src/sd-jwt/index.ts +14 -8
  78. package/src/sd-jwt/types.ts +1 -1
  79. package/src/trust/types.ts +6 -2
  80. package/src/utils/misc.ts +4 -2
  81. package/src/utils/par.ts +2 -2
@@ -45,7 +45,7 @@ const CredentialDefinitionMetadata = z.object({
45
45
  type SupportedCredentialMetadata = z.infer<typeof SupportedCredentialMetadata>;
46
46
  const SupportedCredentialMetadata = z.object({
47
47
  id: z.string(),
48
- format: z.literal("vc+sd-jwt"),
48
+ format: z.union([z.literal("vc+sd-jwt"), z.literal("vc+mdoc-cbor")]),
49
49
  cryptographic_binding_methods_supported: z.array(z.string()),
50
50
  cryptographic_suites_supported: z.array(z.string()),
51
51
  display: z.array(CredentialDisplayMetadata),
@@ -78,6 +78,9 @@ export const EntityConfigurationHeader = z.object({
78
78
  kid: z.string(),
79
79
  });
80
80
 
81
+ /**
82
+ * @see https://openid.net/specs/openid-connect-federation-1_0-29.html#name-federation-entity
83
+ */
81
84
  const FederationEntityMetadata = z
82
85
  .object({
83
86
  federation_fetch_endpoint: z.string().optional(),
@@ -85,6 +88,7 @@ const FederationEntityMetadata = z
85
88
  federation_resolve_endpoint: z.string().optional(),
86
89
  federation_trust_mark_status_endpoint: z.string().optional(),
87
90
  federation_trust_mark_list_endpoint: z.string().optional(),
91
+ organization_name: z.string().optional(),
88
92
  homepage_uri: z.string().optional(),
89
93
  policy_uri: z.string().optional(),
90
94
  logo_uri: z.string().optional(),
@@ -139,7 +143,7 @@ export const CredentialIssuerEntityConfiguration = BaseEntityConfiguration.and(
139
143
  credentials_supported: z.array(SupportedCredentialMetadata),
140
144
  jwks: z.object({ keys: z.array(JWK) }),
141
145
  }),
142
- /** Credential Issuers act as Relying Party
146
+ /** Credential Issuers act as Relying Party
143
147
  when they require the presentation of other credentials.
144
148
  This does not apply for PID issuance, which requires CIE authz. */
145
149
  wallet_relying_party: RelyingPartyMetadata.optional(),
package/src/utils/misc.ts CHANGED
@@ -7,10 +7,12 @@ import { IoWalletError } from "./errors";
7
7
  */
8
8
  export const hasStatus =
9
9
  (status: number) =>
10
- (res: Response): Response => {
10
+ async (res: Response): Promise<Response> => {
11
11
  if (res.status !== status) {
12
12
  throw new IoWalletError(
13
- `Http request failed. Expected ${status}, got ${res.status}, url: ${res.url}`
13
+ `Http request failed. Expected ${status}, got ${res.status}, url: ${
14
+ res.url
15
+ } with response: ${await res.text()}`
14
16
  );
15
17
  }
16
18
  return res;
package/src/utils/par.ts CHANGED
@@ -13,7 +13,7 @@ export const AuthorizationDetail = z.object({
13
13
  credential_definition: z.object({
14
14
  type: z.string(),
15
15
  }),
16
- format: z.literal("vc+sd-jwt"),
16
+ format: z.union([z.literal("vc+sd-jwt"), z.literal("vc+mdoc-cbor")]),
17
17
  type: z.literal("openid_credential"),
18
18
  });
19
19
 
@@ -48,7 +48,7 @@ export const makeParRequest =
48
48
  const iss = WalletInstanceAttestation.decode(walletInstanceAttestation)
49
49
  .payload.cnf.jwk.kid;
50
50
 
51
- /** A code challenge is provided so that the PAR is bound
51
+ /** A code challenge is provided so that the PAR is bound
52
52
  to the subsequent authorization code request
53
53
  @see https://datatracker.ietf.org/doc/html/rfc9126#name-request */
54
54
  const codeChallengeMethod = "s256";