@pagopa/io-react-native-wallet 0.24.0 → 0.25.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (192) hide show
  1. package/lib/commonjs/client/generated/wallet-provider.js +39 -16
  2. package/lib/commonjs/client/generated/wallet-provider.js.map +1 -1
  3. package/lib/commonjs/client/index.js +25 -10
  4. package/lib/commonjs/client/index.js.map +1 -1
  5. package/lib/commonjs/credential/issuance/03-start-user-authorization.js +1 -1
  6. package/lib/commonjs/credential/issuance/04-complete-user-authorization.js +21 -14
  7. package/lib/commonjs/credential/issuance/04-complete-user-authorization.js.map +1 -1
  8. package/lib/commonjs/credential/issuance/05-authorize-access.js +5 -2
  9. package/lib/commonjs/credential/issuance/05-authorize-access.js.map +1 -1
  10. package/lib/commonjs/credential/issuance/06-obtain-credential.js +26 -17
  11. package/lib/commonjs/credential/issuance/06-obtain-credential.js.map +1 -1
  12. package/lib/commonjs/credential/issuance/README.md +8 -14
  13. package/lib/commonjs/credential/issuance/errors.js +52 -0
  14. package/lib/commonjs/credential/issuance/errors.js.map +1 -0
  15. package/lib/commonjs/credential/issuance/index.js +7 -2
  16. package/lib/commonjs/credential/issuance/index.js.map +1 -1
  17. package/lib/commonjs/credential/issuance/types.js +1 -5
  18. package/lib/commonjs/credential/issuance/types.js.map +1 -1
  19. package/lib/commonjs/credential/presentation/01-start-flow.js +1 -1
  20. package/lib/commonjs/credential/presentation/01-start-flow.js.map +1 -1
  21. package/lib/commonjs/credential/presentation/03-get-request-object.js +2 -2
  22. package/lib/commonjs/credential/presentation/03-get-request-object.js.map +1 -1
  23. package/lib/commonjs/credential/presentation/04-send-authorization-response.js +2 -2
  24. package/lib/commonjs/credential/presentation/04-send-authorization-response.js.map +1 -1
  25. package/lib/commonjs/credential/presentation/errors.js +49 -0
  26. package/lib/commonjs/credential/presentation/errors.js.map +1 -0
  27. package/lib/commonjs/credential/presentation/index.js +5 -0
  28. package/lib/commonjs/credential/presentation/index.js.map +1 -1
  29. package/lib/commonjs/credential/status/02-status-attestation.js +8 -6
  30. package/lib/commonjs/credential/status/02-status-attestation.js.map +1 -1
  31. package/lib/commonjs/credential/status/README.md +5 -2
  32. package/lib/commonjs/credential/status/types.js +1 -14
  33. package/lib/commonjs/credential/status/types.js.map +1 -1
  34. package/lib/commonjs/credential/trustmark/get-credential-trustmark.js +14 -5
  35. package/lib/commonjs/credential/trustmark/get-credential-trustmark.js.map +1 -1
  36. package/lib/commonjs/sd-jwt/errors.js +40 -0
  37. package/lib/commonjs/sd-jwt/errors.js.map +1 -0
  38. package/lib/commonjs/sd-jwt/index.js +8 -4
  39. package/lib/commonjs/sd-jwt/index.js.map +1 -1
  40. package/lib/commonjs/sd-jwt/verifier.js +5 -1
  41. package/lib/commonjs/sd-jwt/verifier.js.map +1 -1
  42. package/lib/commonjs/trust/index.js +2 -2
  43. package/lib/commonjs/trust/index.js.map +1 -1
  44. package/lib/commonjs/utils/decoder.js +3 -1
  45. package/lib/commonjs/utils/decoder.js.map +1 -1
  46. package/lib/commonjs/utils/error-codes.js +51 -0
  47. package/lib/commonjs/utils/error-codes.js.map +1 -0
  48. package/lib/commonjs/utils/errors.js +119 -463
  49. package/lib/commonjs/utils/errors.js.map +1 -1
  50. package/lib/commonjs/utils/misc.js +21 -14
  51. package/lib/commonjs/utils/misc.js.map +1 -1
  52. package/lib/commonjs/utils/par.js +2 -1
  53. package/lib/commonjs/utils/par.js.map +1 -1
  54. package/lib/commonjs/wallet-instance/README.md +26 -5
  55. package/lib/commonjs/wallet-instance/index.js +33 -7
  56. package/lib/commonjs/wallet-instance/index.js.map +1 -1
  57. package/lib/commonjs/wallet-instance-attestation/README.md +8 -2
  58. package/lib/commonjs/wallet-instance-attestation/issuing.js +13 -10
  59. package/lib/commonjs/wallet-instance-attestation/issuing.js.map +1 -1
  60. package/lib/module/client/generated/wallet-provider.js +31 -11
  61. package/lib/module/client/generated/wallet-provider.js.map +1 -1
  62. package/lib/module/client/index.js +22 -8
  63. package/lib/module/client/index.js.map +1 -1
  64. package/lib/module/credential/issuance/03-start-user-authorization.js +1 -1
  65. package/lib/module/credential/issuance/04-complete-user-authorization.js +16 -9
  66. package/lib/module/credential/issuance/04-complete-user-authorization.js.map +1 -1
  67. package/lib/module/credential/issuance/05-authorize-access.js +7 -4
  68. package/lib/module/credential/issuance/05-authorize-access.js.map +1 -1
  69. package/lib/module/credential/issuance/06-obtain-credential.js +29 -20
  70. package/lib/module/credential/issuance/06-obtain-credential.js.map +1 -1
  71. package/lib/module/credential/issuance/README.md +8 -14
  72. package/lib/module/credential/issuance/errors.js +44 -0
  73. package/lib/module/credential/issuance/errors.js.map +1 -0
  74. package/lib/module/credential/issuance/index.js +3 -2
  75. package/lib/module/credential/issuance/index.js.map +1 -1
  76. package/lib/module/credential/issuance/types.js +0 -3
  77. package/lib/module/credential/issuance/types.js.map +1 -1
  78. package/lib/module/credential/presentation/01-start-flow.js +1 -1
  79. package/lib/module/credential/presentation/01-start-flow.js.map +1 -1
  80. package/lib/module/credential/presentation/03-get-request-object.js +3 -3
  81. package/lib/module/credential/presentation/03-get-request-object.js.map +1 -1
  82. package/lib/module/credential/presentation/04-send-authorization-response.js +3 -3
  83. package/lib/module/credential/presentation/04-send-authorization-response.js.map +1 -1
  84. package/lib/module/credential/presentation/errors.js +42 -0
  85. package/lib/module/credential/presentation/errors.js.map +1 -0
  86. package/lib/module/credential/presentation/index.js +2 -1
  87. package/lib/module/credential/presentation/index.js.map +1 -1
  88. package/lib/module/credential/status/02-status-attestation.js +11 -9
  89. package/lib/module/credential/status/02-status-attestation.js.map +1 -1
  90. package/lib/module/credential/status/README.md +5 -2
  91. package/lib/module/credential/status/types.js +0 -12
  92. package/lib/module/credential/status/types.js.map +1 -1
  93. package/lib/module/credential/trustmark/get-credential-trustmark.js +14 -5
  94. package/lib/module/credential/trustmark/get-credential-trustmark.js.map +1 -1
  95. package/lib/module/sd-jwt/errors.js +32 -0
  96. package/lib/module/sd-jwt/errors.js.map +1 -0
  97. package/lib/module/sd-jwt/index.js +5 -5
  98. package/lib/module/sd-jwt/index.js.map +1 -1
  99. package/lib/module/sd-jwt/verifier.js +5 -1
  100. package/lib/module/sd-jwt/verifier.js.map +1 -1
  101. package/lib/module/trust/index.js +3 -3
  102. package/lib/module/trust/index.js.map +1 -1
  103. package/lib/module/utils/decoder.js +3 -1
  104. package/lib/module/utils/decoder.js.map +1 -1
  105. package/lib/module/utils/error-codes.js +43 -0
  106. package/lib/module/utils/error-codes.js.map +1 -0
  107. package/lib/module/utils/errors.js +98 -438
  108. package/lib/module/utils/errors.js.map +1 -1
  109. package/lib/module/utils/misc.js +18 -11
  110. package/lib/module/utils/misc.js.map +1 -1
  111. package/lib/module/utils/par.js +3 -2
  112. package/lib/module/utils/par.js.map +1 -1
  113. package/lib/module/wallet-instance/README.md +26 -5
  114. package/lib/module/wallet-instance/index.js +32 -7
  115. package/lib/module/wallet-instance/index.js.map +1 -1
  116. package/lib/module/wallet-instance-attestation/README.md +8 -2
  117. package/lib/module/wallet-instance-attestation/issuing.js +15 -12
  118. package/lib/module/wallet-instance-attestation/issuing.js.map +1 -1
  119. package/lib/typescript/client/generated/wallet-provider.d.ts +138 -27
  120. package/lib/typescript/client/generated/wallet-provider.d.ts.map +1 -1
  121. package/lib/typescript/client/index.d.ts +7 -1
  122. package/lib/typescript/client/index.d.ts.map +1 -1
  123. package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts +1 -1
  124. package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts +1 -1
  125. package/lib/typescript/credential/issuance/04-complete-user-authorization.d.ts.map +1 -1
  126. package/lib/typescript/credential/issuance/05-authorize-access.d.ts.map +1 -1
  127. package/lib/typescript/credential/issuance/06-obtain-credential.d.ts.map +1 -1
  128. package/lib/typescript/credential/issuance/errors.d.ts +28 -0
  129. package/lib/typescript/credential/issuance/errors.d.ts.map +1 -0
  130. package/lib/typescript/credential/issuance/index.d.ts +3 -2
  131. package/lib/typescript/credential/issuance/index.d.ts.map +1 -1
  132. package/lib/typescript/credential/issuance/types.d.ts +0 -8
  133. package/lib/typescript/credential/issuance/types.d.ts.map +1 -1
  134. package/lib/typescript/credential/presentation/03-get-request-object.d.ts.map +1 -1
  135. package/lib/typescript/credential/presentation/04-send-authorization-response.d.ts.map +1 -1
  136. package/lib/typescript/credential/presentation/errors.d.ts +25 -0
  137. package/lib/typescript/credential/presentation/errors.d.ts.map +1 -0
  138. package/lib/typescript/credential/presentation/index.d.ts +2 -1
  139. package/lib/typescript/credential/presentation/index.d.ts.map +1 -1
  140. package/lib/typescript/credential/status/02-status-attestation.d.ts.map +1 -1
  141. package/lib/typescript/credential/status/types.d.ts +0 -15
  142. package/lib/typescript/credential/status/types.d.ts.map +1 -1
  143. package/lib/typescript/credential/trustmark/get-credential-trustmark.d.ts +4 -2
  144. package/lib/typescript/credential/trustmark/get-credential-trustmark.d.ts.map +1 -1
  145. package/lib/typescript/sd-jwt/errors.d.ts +20 -0
  146. package/lib/typescript/sd-jwt/errors.d.ts.map +1 -0
  147. package/lib/typescript/sd-jwt/index.d.ts +3 -2
  148. package/lib/typescript/sd-jwt/index.d.ts.map +1 -1
  149. package/lib/typescript/utils/error-codes.d.ts +45 -0
  150. package/lib/typescript/utils/error-codes.d.ts.map +1 -0
  151. package/lib/typescript/utils/errors.d.ts +88 -225
  152. package/lib/typescript/utils/errors.d.ts.map +1 -1
  153. package/lib/typescript/utils/misc.d.ts +9 -4
  154. package/lib/typescript/utils/misc.d.ts.map +1 -1
  155. package/lib/typescript/utils/par.d.ts.map +1 -1
  156. package/lib/typescript/wallet-instance/index.d.ts +17 -1
  157. package/lib/typescript/wallet-instance/index.d.ts.map +1 -1
  158. package/lib/typescript/wallet-instance-attestation/issuing.d.ts.map +1 -1
  159. package/lib/typescript/wallet-instance-attestation/types.d.ts +4 -4
  160. package/package.json +1 -1
  161. package/src/client/generated/wallet-provider.ts +43 -13
  162. package/src/client/index.ts +28 -15
  163. package/src/credential/issuance/03-start-user-authorization.ts +1 -1
  164. package/src/credential/issuance/04-complete-user-authorization.ts +21 -21
  165. package/src/credential/issuance/05-authorize-access.ts +7 -4
  166. package/src/credential/issuance/06-obtain-credential.ts +39 -39
  167. package/src/credential/issuance/README.md +8 -14
  168. package/src/credential/issuance/errors.ts +44 -0
  169. package/src/credential/issuance/index.ts +4 -2
  170. package/src/credential/issuance/types.ts +0 -8
  171. package/src/credential/presentation/01-start-flow.ts +1 -1
  172. package/src/credential/presentation/03-get-request-object.ts +3 -3
  173. package/src/credential/presentation/04-send-authorization-response.ts +3 -3
  174. package/src/credential/presentation/errors.ts +41 -0
  175. package/src/credential/presentation/index.ts +2 -0
  176. package/src/credential/status/02-status-attestation.ts +17 -25
  177. package/src/credential/status/README.md +5 -2
  178. package/src/credential/status/types.ts +0 -15
  179. package/src/credential/trustmark/get-credential-trustmark.ts +13 -4
  180. package/src/sd-jwt/errors.ts +39 -0
  181. package/src/sd-jwt/index.ts +5 -8
  182. package/src/sd-jwt/verifier.ts +5 -5
  183. package/src/trust/index.ts +3 -3
  184. package/src/utils/decoder.ts +3 -3
  185. package/src/utils/error-codes.ts +50 -0
  186. package/src/utils/errors.ts +152 -476
  187. package/src/utils/misc.ts +20 -17
  188. package/src/utils/par.ts +3 -2
  189. package/src/wallet-instance/README.md +26 -5
  190. package/src/wallet-instance/index.ts +40 -18
  191. package/src/wallet-instance-attestation/README.md +8 -2
  192. package/src/wallet-instance-attestation/issuing.ts +28 -36
@@ -1,8 +1,8 @@
1
- import { getCredentialHashWithouDiscloures, hasStatus, safeJsonParse } from "../../utils/misc";
1
+ import { getCredentialHashWithouDiscloures, hasStatusOrThrow } from "../../utils/misc";
2
2
  import { SignJWT } from "@pagopa/io-react-native-jwt";
3
3
  import uuid from "react-native-uuid";
4
- import { InvalidStatusAttestationResponse, StatusAttestationResponse } from "./types";
5
- import { StatusAttestationError, CredentialInvalidStatusError, UnexpectedStatusCodeError } from "../../utils/errors";
4
+ import { StatusAttestationResponse } from "./types";
5
+ import { IssuerResponseError, IssuerResponseErrorCodes, ResponseErrorBuilder, UnexpectedStatusCodeError } from "../../utils/errors";
6
6
  /**
7
7
  * WARNING: This function must be called after {@link startFlow}.
8
8
  * Verify the status of the credential attestation.
@@ -38,7 +38,7 @@ export const statusAttestation = async function (issuerConf, credential, credent
38
38
  "Content-Type": "application/json"
39
39
  },
40
40
  body: JSON.stringify(body)
41
- }).then(hasStatus(201)).then(raw => raw.json()).then(json => StatusAttestationResponse.parse(json)).catch(handleStatusAttestationError);
41
+ }).then(hasStatusOrThrow(201)).then(raw => raw.json()).then(json => StatusAttestationResponse.parse(json)).catch(handleStatusAttestationError);
42
42
  return {
43
43
  statusAttestation: result.status_attestation
44
44
  };
@@ -55,10 +55,12 @@ const handleStatusAttestationError = e => {
55
55
  if (!(e instanceof UnexpectedStatusCodeError)) {
56
56
  throw e;
57
57
  }
58
- if (e.statusCode === 404) {
59
- const maybeError = InvalidStatusAttestationResponse.safeParse(safeJsonParse(e.responseBody));
60
- throw new CredentialInvalidStatusError("Invalid status found for the given credential", maybeError.success ? maybeError.data.error : "unknown", e.message);
61
- }
62
- throw new StatusAttestationError(`Unable to obtain the status attestation for the given credential [response status code: ${e.statusCode}]`, e.message);
58
+ throw new ResponseErrorBuilder(IssuerResponseError).handle(404, {
59
+ code: IssuerResponseErrorCodes.CredentialInvalidStatus,
60
+ message: "Invalid status found for the given credential"
61
+ }).handle("*", {
62
+ code: IssuerResponseErrorCodes.StatusAttestationRequestFailed,
63
+ message: `Unable to obtain the status attestation for the given credential`
64
+ }).buildFrom(e);
63
65
  };
64
66
  //# sourceMappingURL=02-status-attestation.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getCredentialHashWithouDiscloures","hasStatus","safeJsonParse","SignJWT","uuid","InvalidStatusAttestationResponse","StatusAttestationResponse","StatusAttestationError","CredentialInvalidStatusError","UnexpectedStatusCodeError","statusAttestation","issuerConf","credential","credentialCryptoContext","appFetch","arguments","length","undefined","fetch","jwk","getPublicKey","credentialHash","statusAttUrl","openid_credential_issuer","status_attestation_endpoint","credentialPop","setPayload","aud","jti","v4","toString","credential_hash","credential_hash_alg","setProtectedHeader","alg","typ","kid","setIssuedAt","setExpirationTime","sign","body","credential_pop","result","method","headers","JSON","stringify","then","raw","json","parse","catch","handleStatusAttestationError","status_attestation","e","statusCode","maybeError","safeParse","responseBody","success","data","error","message"],"sourceRoot":"../../../../src","sources":["credential/status/02-status-attestation.ts"],"mappings":"AAAA,SACEA,iCAAiC,EACjCC,SAAS,EACTC,aAAa,QAER,kBAAkB;AAEzB,SAASC,OAAO,QAA4B,6BAA6B;AACzE,OAAOC,IAAI,MAAM,mBAAmB;AACpC,SACEC,gCAAgC,EAChCC,yBAAyB,QACpB,SAAS;AAChB,SACEC,sBAAsB,EACtBC,4BAA4B,EAC5BC,yBAAyB,QACpB,oBAAoB;AAW3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,iBAAoC,GAAG,eAAAA,CAClDC,UAAU,EACVC,UAAU,EACVC,uBAAuB,EAEpB;EAAA,IADHC,QAA8B,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGG,KAAK;EAEtC,MAAMC,GAAG,GAAG,MAAMN,uBAAuB,CAACO,YAAY,CAAC,CAAC;EACxD,MAAMC,cAAc,GAAG,MAAMrB,iCAAiC,CAACY,UAAU,CAAC;EAC1E,MAAMU,YAAY,GAChBX,UAAU,CAACY,wBAAwB,CAACC,2BAA2B;EACjE,MAAMC,aAAa,GAAG,MAAM,IAAItB,OAAO,CAACU,uBAAuB,CAAC,CAC7Da,UAAU,CAAC;IACVC,GAAG,EAAEL,YAAY;IACjBM,GAAG,EAAExB,IAAI,CAACyB,EAAE,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;IACzBC,eAAe,EAAEV,cAAc;IAC/BW,mBAAmB,EAAE;EACvB,CAAC,CAAC,CACDC,kBAAkB,CAAC;IAClBC,GAAG,EAAE,OAAO;IACZC,GAAG,EAAE,gCAAgC;IAC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W,GAAE,EAC1GD,CAAC,CAACQ,OACJ,CAAC;AACH,CAAC"}
1
+ {"version":3,"names":["getCredentialHashWithouDiscloures","hasStatusOrThrow","SignJWT","uuid","StatusAttestationResponse","IssuerResponseError","IssuerResponseErrorCodes","ResponseErrorBuilder","UnexpectedStatusCodeError","statusAttestation","issuerConf","credential","credentialCryptoContext","appFetch","arguments","length","undefined","fetch","jwk","getPublicKey","credentialHash","statusAttUrl","openid_credential_issuer","status_attestation_endpoint","credentialPop","setPayload","aud","jti","v4","toString","credential_hash","credential_hash_alg","setProtectedHeader","alg","typ","kid","setIssuedAt","setExpirationTime","sign","body","credential_pop","result","method","headers","JSON","stringify","then","raw","json","parse","catch","handleStatusAttestationError","status_attestation","e","handle","code","CredentialInvalidStatus","message","StatusAttestationRequestFailed","buildFrom"],"sourceRoot":"../../../../src","sources":["credential/status/02-status-attestation.ts"],"mappings":"AAAA,SACEA,iCAAiC,EACjCC,gBAAgB,QAEX,kBAAkB;AAEzB,SAA6BC,OAAO,QAAQ,6BAA6B;AACzE,OAAOC,IAAI,MAAM,mBAAmB;AACpC,SAASC,yBAAyB,QAAQ,SAAS;AACnD,SACEC,mBAAmB,EACnBC,wBAAwB,EACxBC,oBAAoB,EACpBC,yBAAyB,QACpB,oBAAoB;AAW3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,iBAAoC,GAAG,eAAAA,CAClDC,UAAU,EACVC,UAAU,EACVC,uBAAuB,EAEpB;EAAA,IADHC,QAA8B,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGG,KAAK;EAEtC,MAAMC,GAAG,GAAG,MAAMN,uBAAuB,CAACO,YAAY,CAAC,CAAC;EACxD,MAAMC,cAAc,GAAG,MAAMpB,iCAAiC,CAACW,UAAU,CAAC;EAC1E,MAAMU,YAAY,GAChBX,UAAU,CAACY,wBAAwB,CAACC,2BAA2B;EACjE,MAAMC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AChDiD,MAAM,CAAC,GAAG,EAAE;IACXC,IAAI,EAAEjD,wBAAwB,CAACkD,uBAAuB;IACtDC,OAAO,EAAE;EACX,CAAC,CAAC,CACDH,MAAM,CAAC,GAAG,EAAE;IACXC,IAAI,EAAEjD,wBAAwB,CAACoD,8BAA8B;IAC7DD,OAAO,EAAG;EACZ,CAAC,CAAC,CACDE,SAAS,CAACN,CAAC,CAAC;AACjB,CAAC"}
@@ -16,11 +16,14 @@ graph TD;
16
16
  1 --> 2
17
17
  ```
18
18
 
19
+
19
20
  ## Mapped results
20
21
 
21
- ### 404 Not Found (CredentialInvalidStatusError)
22
+ The following errors are mapped to a `IssuerResponseError` with specific codes.
22
23
 
23
- A `404 Not Found` response is returned by the credential issuer when the status attestation is invalid.
24
+ |HTTP Status|Error Code|Description|
25
+ |-----------|----------|-----------|
26
+ |`404 Not Found`|`ERR_CREDENTIAL_INVALID_STATUS`|This response is returned by the credential issuer when the status attestation is invalid. It might contain more details in the `reason` property.|
24
27
 
25
28
  ## Example
26
29
 
@@ -37,16 +37,4 @@ export const ParsedStatusAttestation = z.object({
37
37
  iat: UnixTime
38
38
  })
39
39
  });
40
-
41
- /**
42
- * Shape from parsing a status attestation response in case of error.
43
- */
44
- export const InvalidStatusAttestationResponse = z.object({
45
- error: z.string()
46
- });
47
-
48
- /**
49
- * Type from parsing a status attestation response in case of error.
50
- * Inferred from {@link InvalidStatusAttestationResponse}.
51
- */
52
40
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["UnixTime","JWK","z","StatusAttestationResponse","object","status_attestation","string","ParsedStatusAttestation","header","typ","literal","alg","kid","optional","payload","credential_hash_alg","credential_hash","cnf","jwk","exp","iat","InvalidStatusAttestationResponse","error"],"sourceRoot":"../../../../src","sources":["credential/status/types.ts"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,GAAG,QAAQ,iBAAiB;AACrC,OAAO,KAAKC,CAAC,MAAM,KAAK;;AAExB;AACA;AACA;AACA,OAAO,MAAMC,yBAAyB,GAAGD,CAAC,CAACE,MAAM,CAAC;EAChDC,kBAAkB,EAAEH,CAAC,CAACI,MAAM,CAAC;AAC/B,CAAC,CAAC;;AAEF;AACA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;AACA,OAAO,MAAMC,uBAAuB,GAAGL,CAAC,CAACE,MAAM,CAAC;EAC9CI,MAAM,EAAEN,CAAC,CAACE,MAAM,CAAC;IACfK,GAAG,EAAEP,CAAC,CAACQ,OAAO,CAAC,wBAAwB,CAAC;IACxCC,GAAG,EAAET,CAAC,CAACI,MAAM,CAAC,CAAC;IACfM,GAAG,EAAEV,CAAC,CAACI,MAAM,CAAC,CAAC,CAACO,QAAQ,CAAC;EAC3B,CAAC,CAAC;EACFC,OAAO,EAAEZ,CAAC,CAACE,MAAM,CAAC;IAChBW,mBAAmB,EAAEb,CAAC,CAACI,MAAM,CAAC,CAAC;IAC/BU,eAAe,EAAEd,CAAC,CAACI,MAAM,CAAC,CAAC;IAC3BW,GAAG,EAAEf,CAAC,CAACE,MAAM,CAAC;MACZc,GAAG,EAAEjB;IACP,CAAC,CAAC;IACFkB,GAAG,EAAEnB,QAAQ;IACboB,GAAG,EAAEpB;EACP,CAAC;AACH,CAAC,CAAC;;AAEF;AACA;AACA;AACA,OAAO,MAAMqB,gCAAgC,GAAGnB,CAAC,CAACE,MAAM,CAAC;EACvDkB,KAAK,EAAEpB,CAAC,CAACI,MAAM,CAAC;AAClB,CAAC,CAAC;;AAEF;AACA;AACA;AACA"}
1
+ {"version":3,"names":["UnixTime","JWK","z","StatusAttestationResponse","object","status_attestation","string","ParsedStatusAttestation","header","typ","literal","alg","kid","optional","payload","credential_hash_alg","credential_hash","cnf","jwk","exp","iat"],"sourceRoot":"../../../../src","sources":["credential/status/types.ts"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,GAAG,QAAQ,iBAAiB;AACrC,OAAO,KAAKC,CAAC,MAAM,KAAK;;AAExB;AACA;AACA;AACA,OAAO,MAAMC,yBAAyB,GAAGD,CAAC,CAACE,MAAM,CAAC;EAChDC,kBAAkB,EAAEH,CAAC,CAACI,MAAM,CAAC;AAC/B,CAAC,CAAC;;AAEF;AACA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;AACA,OAAO,MAAMC,uBAAuB,GAAGL,CAAC,CAACE,MAAM,CAAC;EAC9CI,MAAM,EAAEN,CAAC,CAACE,MAAM,CAAC;IACfK,GAAG,EAAEP,CAAC,CAACQ,OAAO,CAAC,wBAAwB,CAAC;IACxCC,GAAG,EAAET,CAAC,CAACI,MAAM,CAAC,CAAC;IACfM,GAAG,EAAEV,CAAC,CAACI,MAAM,CAAC,CAAC,CAACO,QAAQ,CAAC;EAC3B,CAAC,CAAC;EACFC,OAAO,EAAEZ,CAAC,CAACE,MAAM,CAAC;IAChBW,mBAAmB,EAAEb,CAAC,CAACI,MAAM,CAAC,CAAC;IAC/BU,eAAe,EAAEd,CAAC,CAACI,MAAM,CAAC,CAAC;IAC3BW,GAAG,EAAEf,CAAC,CAACE,MAAM,CAAC;MACZc,GAAG,EAAEjB;IACP,CAAC,CAAC;IACFkB,GAAG,EAAEnB,QAAQ;IACboB,GAAG,EAAEpB;EACP,CAAC;AACH,CAAC,CAAC"}
@@ -11,9 +11,11 @@ import { obfuscateString } from "../../utils/string";
11
11
  * @param credentialType The type of credential for which the trustmark is generated
12
12
  * @param docNumber (Optional) Document number contained in the credential, if applicable
13
13
  * @param expirationTime (Optional) Expiration time for the trustmark, default is 2 minutes.
14
- * If a number is provided, it is interpreted as a timestamp in seconds.
15
- * If a string is provided, it is interpreted as a time span and added to the current timestamp.
14
+ * If a number is provided, it is interpreted as a timestamp in seconds.
15
+ * If a string is provided, it is interpreted as a time span and added to the current timestamp.
16
+ * @throws {IoWalletError} If the WIA is expired
16
17
  * @throws {IoWalletError} If the public key associated to the WIA is not the same for the CryptoContext
18
+ * @throws {JWSSignatureVerificationFailed} If the WIA signature is not valid
17
19
  * @returns A promise containing the signed JWT and its expiration time in seconds
18
20
  */
19
21
  export const getCredentialTrustmark = async _ref => {
@@ -30,6 +32,13 @@ export const getCredentialTrustmark = async _ref => {
30
32
  const holderBindingKey = await wiaCryptoContext.getPublicKey();
31
33
  const decodedWia = WalletInstanceAttestation.decode(walletInstanceAttestation);
32
34
 
35
+ /**
36
+ * Check that the WIA is not expired
37
+ */
38
+ if (decodedWia.payload.exp * 1000 < Date.now()) {
39
+ throw new IoWalletError("Wallet Instance Attestation expired");
40
+ }
41
+
33
42
  /**
34
43
  * Verify holder binding by comparing thumbprints of the WIA and the CryptoContext key
35
44
  */
@@ -46,13 +55,13 @@ export const getCredentialTrustmark = async _ref => {
46
55
  alg: "ES256"
47
56
  }).setPayload({
48
57
  iss: walletInstanceAttestation,
49
- sub: credentialType,
50
58
  /**
51
59
  * If present, the document number is obfuscated before adding it to the payload
52
60
  */
53
61
  ...(docNumber ? {
54
- subtyp: obfuscateString(docNumber)
55
- } : {})
62
+ sub: obfuscateString(docNumber)
63
+ } : {}),
64
+ subtyp: credentialType
56
65
  }).setIssuedAt().setExpirationTime(expirationTime).sign();
57
66
  const decodedTrustmark = decodeJwt(signedTrustmarkJwt);
58
67
  return {
@@ -1 +1 @@
1
- {"version":3,"names":["SignJWT","thumbprint","decode","decodeJwt","WalletInstanceAttestation","IoWalletError","obfuscateString","getCredentialTrustmark","_ref","walletInstanceAttestation","wiaCryptoContext","credentialType","docNumber","expirationTime","holderBindingKey","getPublicKey","decodedWia","wiaThumbprint","payload","cnf","jwk","cryptoContextThumbprint","signedTrustmarkJwt","setProtectedHeader","alg","setPayload","iss","sub","subtyp","setIssuedAt","setExpirationTime","sign","decodedTrustmark","jwt","exp"],"sourceRoot":"../../../../src","sources":["credential/trustmark/get-credential-trustmark.ts"],"mappings":"AAAA,SACEA,OAAO,EACPC,UAAU,EAEVC,MAAM,IAAIC,SAAS,QACd,6BAA6B;AACpC,OAAO,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gB,GAAG7B,SAAS,CAACmB,kBAAkB,CAAC;EAEtD,OAAO;IACLW,GAAG,EAAEX,kBAAkB;IACvBT,cAAc,EAAEmB,gBAAgB,CAACd,OAAO,CAACgB,GAAG,IAAI;EAClD,CAAC;AACH,CAAC"}
1
+ {"version":3,"names":["SignJWT","thumbprint","decode","decodeJwt","WalletInstanceAttestation","IoWalletError","obfuscateString","getCredentialTrustmark","_ref","walletInstanceAttestation","wiaCryptoContext","credentialType","docNumber","expirationTime","holderBindingKey","getPublicKey","decodedWia","payload","exp","Date","now","wiaThumbprint","cnf","jwk","cryptoContextThumbprint","signedTrustmarkJwt","setProtectedHeader","alg","setPayload","iss","sub","subtyp","setIssuedAt","setExpirationTime","sign","decodedTrustmark","jwt"],"sourceRoot":"../../../../src","sources":["credential/trustmark/get-credential-trustmark.ts"],"mappings":"AAAA,SACEA,OAAO,EACPC,UAAU,EAEVC,MAAM,IAAIC,SAAS,QACd,6BAA6B;AACpC,OAAO,KAAKC,yBAAyB,MAAM,mCAAmC;AAC9E,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,eAAe,QAAQ,oBAAoB;AAoCpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,sBAAiD,GAAG,MAAAC,IAAA,IAM3D;EAAA,IANkE;IACtEC,yBAAyB;IACzBC,gBAAgB;IAChBC,cAAc;IACdC,SAAS;IACTC,cAAc,GAAG;EACnB,CAAC,GAAAL,IAAA;EACC;AACF;AACA;EACE,MAAMM,gBAAgB,GAAG,MAAMJ,gBAAgB,CAACK,YAAY,CAAC,CAAC;EAC9D,MAAMC,UAAU,GAAGZ,yBAAyB,CAACF,MAAM,CACjDO,yBACF,CAAC;;EAED;AACF;AACA;EACE,IAAIO,UAAU,CAACC,OAAO,CAACC,GAAG,GAAG,IAAI,GAAGC,IAAI,CAACC,GAAG,CAAC,CAAC,EAAE;IAC9C,MAAM,IAAIf,aAAa,CAAC,qCAAqC,CAAC;EAChE;;EAEA;AACF;AACA;EACE,MAAMgB,aAAa,GAAG,MAAMpB,UAAU,CAACe,UAAU,CAACC,OAAO,CAACK,GAAG,CAACC,GAAG,CAAC;EAClE,MAAMC,uBAAuB,GAAG,MAAMvB,UAAU,CAACa,gBAAgB,CAAC;EAElE,IAAIO,aAAa,KAAKG,uBAAuB,EAAE;IAC7C,MAAM,IAAInB,aAAa,CACpB,gFAA+EmB,uBAAwB,UAASH,aAAc,EACjI,CAAC;EACH;;EAEA;AACF;AACA;EACE,MAAMI,kBAAkB,GAAG,MAAM,IAAIzB,OAAO,CAACU,gBAAgB,CAAC,CAC3DgB,kBAAkB,CAAC;IAClBC,GAAG,EAAE;EACP,CAAC,CAAC,CACDC,UAAU,CAAC;IACVC,GAAG,EAAEpB,yBAAyB;IAC9B;AACN;AACA;IACM,IAAIG,SAAS,GAAG;MAAEkB,GAAG,EAAExB,eAAe,CAACM,SAAS;IAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACzDmB,MAAM,EAAEpB;EACV,CAAC,CAAC,CACDqB,WAAW,CAAC,CAAC,CACbC,iBAAiB,CAACpB,cAAc,CAAC,CACjCqB,IAAI,CAAC,CAAC;EAET,MAAMC,gBAAgB,GAAGhC,SAAS,CAACsB,kBAAkB,CAAC;EAEtD,OAAO;IACLW,GAAG,EAAEX,kBAAkB;IACvBZ,cAAc,EAAEsB,gBAAgB,CAAClB,OAAO,CAACC,GAAG,IAAI;EAClD,CAAC;AACH,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * When claims are requested but not found in the credential
3
+ *
4
+ */
5
+ export class ClaimsNotFoundBetweenDisclosures extends Error {
6
+ code = "ERR_CLAIMS_NOT_FOUND";
7
+
8
+ /** The Claims not found */
9
+
10
+ constructor(claims) {
11
+ const c = Array.isArray(claims) ? claims : [claims];
12
+ const message = `Some requested claims are not present in the disclosurable values, claims: ${c.join(", ")}`;
13
+ super(message);
14
+ this.claims = c;
15
+ }
16
+ }
17
+
18
+ /**
19
+ * When the SD-JWT does not contain an hashed reference to a given set of claims
20
+ */
21
+ export class ClaimsNotFoundInToken extends Error {
22
+ code = "ERR_CLAIMS_NOT_FOUND_IN_TOKEN";
23
+
24
+ /** The Claims not found */
25
+
26
+ constructor(claims) {
27
+ const claimsArray = Array.isArray(claims) ? claims : [claims];
28
+ super(`Some requested claims are not present in the disclosurable values: ${claimsArray.join(", ")}`);
29
+ this.claims = claimsArray;
30
+ }
31
+ }
32
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ClaimsNotFoundBetweenDisclosures","Error","code","constructor","claims","c","Array","isArray","message","join","ClaimsNotFoundInToken","claimsArray"],"sourceRoot":"../../../src","sources":["sd-jwt/errors.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA,OAAO,MAAMA,gCAAgC,SAASC,KAAK,CAAC;EAC1DC,IAAI,GAAG,sBAAsB;;EAE7B;;EAGAC,WAAWA,CAACC,MAAyB,EAAE;IACrC,MAAMC,CAAC,GAAGC,KAAK,CAACC,OAAO,CAACH,MAAM,CAAC,GAAGA,MAAM,GAAG,CAACA,MAAM,CAAC;IACnD,MAAMI,OAAO,GAAI,8EAA6EH,CAAC,CAACI,IAAI,CAClG,IACF,CAAE,EAAC;IACH,KAAK,CAACD,OAAO,CAAC;IACd,IAAI,CAACJ,MAAM,GAAGC,CAAC;EACjB;AACF;;AAEA;AACA;AACA;AACA,OAAO,MAAMK,qBAAqB,SAAST,KAAK,CAAC;EAC/CC,IAAI,GAAG,+BAA+B;;EAEtC;;EAGAC,WAAWA,CAACC,MAAyB,EAAE;IACrC,MAAMO,WAAW,GAAGL,KAAK,CAACC,OAAO,CAACH,MAAM,CAAC,GAAGA,MAAM,GAAG,CAACA,MAAM,CAAC;IAC7D,KAAK,CACF,sEAAqEO,WAAW,CAACF,IAAI,CACpF,IACF,CAAE,EACJ,CAAC;IACD,IAAI,CAACL,MAAM,GAAGO,WAAW;EAC3B;AACF"}
@@ -3,7 +3,7 @@ import { verify as verifyJwt } from "@pagopa/io-react-native-jwt";
3
3
  import { sha256ToBase64 } from "@pagopa/io-react-native-jwt";
4
4
  import { Disclosure, SdJwt4VC } from "./types";
5
5
  import { verifyDisclosure } from "./verifier";
6
- import { ClaimsNotFoundBetweenDislosures, ClaimsNotFoundInToken } from "../utils/errors";
6
+ import * as Errors from "./errors";
7
7
  import { Base64 } from "js-base64";
8
8
  const decodeDisclosure = encoded => {
9
9
  const utf8String = Base64.decode(encoded); // Decode Base64 into UTF-8 string
@@ -64,7 +64,7 @@ export const decode = (token, customSchema) => {
64
64
  * @param token The encoded token that represents a valid sd-jwt for verifiable credentials
65
65
  * @param claims The list of claims to be disclosed
66
66
  *
67
- * @throws {ClaimsNotFoundBetweenDislosures} When one or more claims does not relate to any discloure.
67
+ * @throws {ClaimsNotFoundBetweenDisclosures} When one or more claims does not relate to any discloure.
68
68
  * @throws {ClaimsNotFoundInToken} When one or more claims are not contained in the SD-JWT token.
69
69
  * @returns The encoded token with only the requested disclosures, along with the path each claim can be found on the SD-JWT token
70
70
  *
@@ -87,7 +87,7 @@ export const disclose = async (token, claims) => {
87
87
 
88
88
  // check every claim represents a known disclosure
89
89
  if (!disclosure) {
90
- throw new ClaimsNotFoundBetweenDislosures(claim);
90
+ throw new Errors.ClaimsNotFoundBetweenDisclosures(claim);
91
91
  }
92
92
  const hash = await sha256ToBase64(disclosure.encoded);
93
93
 
@@ -100,7 +100,7 @@ export const disclose = async (token, claims) => {
100
100
  path: `verified_claims.claims._sd[${index}]`
101
101
  };
102
102
  }
103
- throw new ClaimsNotFoundInToken(claim);
103
+ throw new Errors.ClaimsNotFoundInToken(claim);
104
104
  }));
105
105
  const filteredDisclosures = rawDisclosures.filter(d => {
106
106
  const {
@@ -149,5 +149,5 @@ export const verify = async (token, publicKey, customSchema) => {
149
149
  disclosures: decoded.disclosures.map(d => d.decoded)
150
150
  };
151
151
  };
152
- export { SdJwt4VC };
152
+ export { SdJwt4VC, Errors };
153
153
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["decode","decodeJwt","verify","verifyJwt","sha256ToBase64","Disclosure","SdJwt4VC","verifyDisclosure","ClaimsNotFoundBetweenDislosures","ClaimsNotFoundInToken","Base64","decodeDisclosure","encoded","utf8String","decoded","parse","JSON","token","customSchema","slice","rawSdJwt","rawDisclosures","split","decodedJwt","parser","sdJwt","header","protectedHeader","payload","disclosures","map","disclose","claims","paths","Promise","all","claim","disclosure","find","_ref","name","hash","_sd","includes","index","indexOf","path","filteredDisclosures","filter","d","disclosedToken","join","publicKey"],"sourceRoot":"../../../src","sources":["sd-jwt/index.ts"],"mappings":"AAEA,SAASA,MAAM,IAAIC,SAAS,QAAQ,6BAA6B;AACjE,SAASC,MAAM,IAAIC,SAAS,QAAQ,6BAA6B;AACjE,SAASC,cAAc,QAAQ,6BAA6B;AAC5D,SAASC,UAAU,EAAEC,QAAQ,QAAoC,SAAS;AAC1E,SAASC,gBAAgB,QAAQ,YAAY;AAE7C,SACEC,+BAA+B,EAC/BC,qBAAqB,QAChB,iBAAiB;AACxB,SAASC,MAAM,QAAQ,WAAW;AAElC,MAAMC,gBAAgB,GAAIC,OAAe,IAA4B;EACnE,MAAMC,UAAU,GAAGH,MAAM,CAACV,MAAM,CAACY,OAAO,CAAC,CAAC,CAAC;EAC3C,MAAME,OAAO,GAAGT,UAAU,CAACU,KAAK,CAACC,IAAI,CAACD,KAAK,CAACF,UAAU,CAAC,CAAC;EACxD,OAAO;IAAEC,OAAO;IAAEF;EAAQ,CAAC;AAC7B,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMZ,MAAM,GAAGA,CACpBiB,KAAa,EACbC,YAAgB,KAIb;EACH;EACA,IAAID,KAAK,CAACE,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;IAC3BF,KAAK,GAAGA,KAAK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AS,CAAC;;EAEpC;EACA,MAAMpB,MAAM,GAAG,CAAC,GAAGlB,OAAO,CAACW,KAAK,CAACG,OAAO,CAACc,GAAG,CAAC;EAE7C,MAAMR,OAAO,CAACC,GAAG,CACfrB,OAAO,CAACe,WAAW,CAACC,GAAG,CACrB,MAAOO,UAAU,IAAK,MAAM9B,gBAAgB,CAAC8B,UAAU,EAAEL,MAAM,CACjE,CACF,CAAC;EAED,OAAO;IACLP,KAAK,EAAEX,OAAO,CAACW,KAAK;IACpBI,WAAW,EAAEf,OAAO,CAACe,WAAW,CAACC,GAAG,CAAEmB,CAAC,IAAKA,CAAC,CAACnC,OAAO;EACvD,CAAC;AACH,CAAC;AAED,SAASR,QAAQ"}
1
+ {"version":3,"names":["decode","decodeJwt","verify","verifyJwt","sha256ToBase64","Disclosure","SdJwt4VC","verifyDisclosure","Errors","Base64","decodeDisclosure","encoded","utf8String","decoded","parse","JSON","token","customSchema","slice","rawSdJwt","rawDisclosures","split","decodedJwt","parser","sdJwt","header","protectedHeader","payload","disclosures","map","disclose","claims","paths","Promise","all","claim","disclosure","find","_ref","name","ClaimsNotFoundBetweenDisclosures","hash","_sd","includes","index","indexOf","path","ClaimsNotFoundInToken","filteredDisclosures","filter","d","disclosedToken","join","publicKey"],"sourceRoot":"../../../src","sources":["sd-jwt/index.ts"],"mappings":"AAEA,SAASA,MAAM,IAAIC,SAAS,QAAQ,6BAA6B;AACjE,SAASC,MAAM,IAAIC,SAAS,QAAQ,6BAA6B;AACjE,SAASC,cAAc,QAAQ,6BAA6B;AAC5D,SAASC,UAAU,EAAEC,QAAQ,QAAoC,SAAS;AAC1E,SAASC,gBAAgB,QAAQ,YAAY;AAE7C,OAAO,KAAKC,MAAM,MAAM,UAAU;AAClC,SAASC,MAAM,QAAQ,WAAW;AAElC,MAAMC,gBAAgB,GAAIC,OAAe,IAA4B;EACnE,MAAMC,UAAU,GAAGH,MAAM,CAACT,MAAM,CAACW,OAAO,CAAC,CAAC,CAAC;EAC3C,M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EnB;EAAM,CAAC;AACzC,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM9B,MAAM,GAAG,MAAAA,CACpBc,KAAa,EACbqC,SAAsB,EACtBpC,YAAgB,KAC8C;EAC9D;EACA,MAAM,CAACE,QAAQ,GAAG,EAAE,CAAC,GAAGH,KAAK,CAACK,KAAK,CAAC,GAAG,CAAC;EACxC,MAAMR,OAAO,GAAGb,MAAM,CAACgB,KAAK,EAAEC,YAAY,CAAC;;EAE3C;EACA,MAAMd,SAAS,CAACgB,QAAQ,EAAEkC,SAAS,CAAC;;EAEpC;EACA,MAAMtB,MAAM,GAAG,CAAC,GAAGlB,OAAO,CAACW,KAAK,CAACG,OAAO,CAACe,GAAG,CAAC;EAE7C,MAAMT,OAAO,CAACC,GAAG,CACfrB,OAAO,CAACe,WAAW,CAACC,GAAG,CACrB,MAAOO,UAAU,IAAK,MAAM7B,gBAAgB,CAAC6B,UAAU,EAAEL,MAAM,CACjE,CACF,CAAC;EAED,OAAO;IACLP,KAAK,EAAEX,OAAO,CAACW,KAAK;IACpBI,WAAW,EAAEf,OAAO,CAACe,WAAW,CAACC,GAAG,CAAEqB,CAAC,IAAKA,CAAC,CAACrC,OAAO;EACvD,CAAC;AACH,CAAC;AAED,SAASP,QAAQ,EAAEE,MAAM"}
@@ -7,7 +7,11 @@ export const verifyDisclosure = async (_ref, claims) => {
7
7
  } = _ref;
8
8
  let hash = await sha256ToBase64(encoded);
9
9
  if (!claims.includes(hash)) {
10
- throw new ValidationFailed("Validation of disclosure failed", `${decoded}`, "Disclosure hash not found in claims");
10
+ throw new ValidationFailed({
11
+ message: "Validation of disclosure failed",
12
+ claim: `${decoded}`,
13
+ reason: "Disclosure hash not found in claims"
14
+ });
11
15
  }
12
16
  };
13
17
  //# sourceMappingURL=verifier.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["sha256ToBase64","ValidationFailed","verifyDisclosure","_ref","claims","encoded","decoded","hash","includes"],"sourceRoot":"../../../src","sources":["sd-jwt/verifier.ts"],"mappings":"AAAA,SAASA,cAAc,QAAQ,6BAA6B;AAE5D,SAASC,gBAAgB,QAAQ,iBAAiB;AAGlD,OAAO,MAAMC,gBAAgB,GAAG,MAAAA,CAAAC,IAAA,EAE9BC,MAAoC,KACjC;EAAA,IAFH;IAAEC,OAAO;IAAEC;EAA+B,CAAC,GAAAH,IAAA;EAG3C,IAAII,IAAI,GAAG,MAAMP,cAAc,CAACK,OAAO,CAAC;EACxC,IAAI,CAACD,MAAM,CAACI,QAAQ,CAACD,IAAI,CAAC,EAAE;IAC1B,MAAM,IAAIN,gBAAgB,CACxB,iCAAiC,EAChC,GAAEK,OAAQ,EAAC,EACZ,qCACF,CAAC;EACH;AACF,CAAC"}
1
+ {"version":3,"names":["sha256ToBase64","ValidationFailed","verifyDisclosure","_ref","claims","encoded","decoded","hash","includes","message","claim","reason"],"sourceRoot":"../../../src","sources":["sd-jwt/verifier.ts"],"mappings":"AAAA,SAASA,cAAc,QAAQ,6BAA6B;AAE5D,SAASC,gBAAgB,QAAQ,iBAAiB;AAGlD,OAAO,MAAMC,gBAAgB,GAAG,MAAAA,CAAAC,IAAA,EAE9BC,MAAoC,KACjC;EAAA,IAFH;IAAEC,OAAO;IAAEC;EAA+B,CAAC,GAAAH,IAAA;EAG3C,IAAII,IAAI,GAAG,MAAMP,cAAc,CAACK,OAAO,CAAC;EACxC,IAAI,CAACD,MAAM,CAACI,QAAQ,CAACD,IAAI,CAAC,EAAE;IAC1B,MAAM,IAAIN,gBAAgB,CAAC;MACzBQ,OAAO,EAAE,iCAAiC;MAC1CC,KAAK,EAAG,GAAEJ,OAAQ,EAAC;MACnBK,MAAM,EAAE;IACV,CAAC,CAAC;EACJ;AACF,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { decode as decodeJwt } from "@pagopa/io-react-native-jwt";
2
2
  import { WalletProviderEntityConfiguration, TrustAnchorEntityConfiguration, CredentialIssuerEntityConfiguration, RelyingPartyEntityConfiguration, EntityConfiguration, EntityStatement } from "./types";
3
3
  import { validateTrustChain, renewTrustChain } from "./chain";
4
- import { hasStatus } from "../utils/misc";
4
+ import { hasStatusOrThrow } from "../utils/misc";
5
5
  /**
6
6
  * Verify a given trust chain is actually valid.
7
7
  * It can handle fast chain renewal, which means we try to fetch a fresh version of each statement.
@@ -44,7 +44,7 @@ export async function getSignedEntityConfiguration(entityBaseUrl) {
44
44
  const wellKnownUrl = `${entityBaseUrl}/.well-known/openid-federation`;
45
45
  return await appFetch(wellKnownUrl, {
46
46
  method: "GET"
47
- }).then(hasStatus(200)).then(res => res.text());
47
+ }).then(hasStatusOrThrow(200)).then(res => res.text());
48
48
  }
49
49
 
50
50
  /**
@@ -126,6 +126,6 @@ export async function getSignedEntityStatement(accreditationBodyBaseUrl, subordi
126
126
  })}`;
127
127
  return await appFetch(url, {
128
128
  method: "GET"
129
- }).then(hasStatus(200)).then(res => res.text());
129
+ }).then(hasStatusOrThrow(200)).then(res => res.text());
130
130
  }
131
131
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["decode","decodeJwt","WalletProviderEntityConfiguration","TrustAnchorEntityConfiguration","CredentialIssuerEntityConfiguration","RelyingPartyEntityConfiguration","EntityConfiguration","EntityStatement","validateTrustChain","renewTrustChain","hasStatus","verifyTrustChain","trustAnchorEntity","chain","appFetch","fetch","renewOnFail","arguments","length","undefined","error","renewedChain","getSignedEntityConfiguration","entityBaseUrl","wellKnownUrl","method","then","res","text","fetchAndParseEntityConfiguration","schema","responseText","responseJwt","parse","header","protectedHeader","payload","getWalletProviderEntityConfiguration","options","getCredentialIssuerEntityConfiguration","getTrustAnchorEntityConfiguration","getRelyingPartyEntityConfiguration","getEntityConfiguration","getEntityStatement","accreditationBodyBaseUrl","subordinatedEntityBaseUrl","getSignedEntityStatement","url","URLSearchParams","sub"],"sourceRoot":"../../../src","sources":["trust/index.ts"],"mappings":"AAAA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OAAO,CAAC;;AAE/E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeK,kBAAkBA,CACtCC,wBAAgC,EAChCC,yBAAiC,EAMjC;EAAA,IALA;IACE/B,QAAQ,GAAGC;EAGb,CAAC,GAAAE,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAEN,MAAMc,YAAY,GAAG,MAAMe,wBAAwB,CACjDF,wBAAwB,EACxBC,yBAAyB,EACzB;IACE/B;EACF,CACF,CAAC;EAED,MAAMkB,WAAW,GAAG/B,SAAS,CAAC8B,YAAY,CAAC;EAC3C,OAAOxB,eAAe,CAAC0B,KAAK,CAAC;IAC3BC,MAAM,EAAEF,WAAW,CAACG,eAAe;IACnCC,OAAO,EAAEJ,WAAW,CAACI;EACvB,CAAC,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeU,wBAAwBA,CAC5CF,wBAAgC,EAChCC,yBAAiC,EAMjC;EAAA,IALA;IACE/B,QAAQ,GAAGC;EAGb,CAAC,GAAAE,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAEN,MAAM8B,GAAG,GAAI,GAAEH,wBAAyB,UAAS,IAAII,eAAe,CAAC;IACnEC,GAAG,EAAEJ;EACP,CAAC,CAAE,EAAC;EAEJ,OAAO,MAAM/B,QAAQ,CAACiC,GAAG,EAAE;IACzBtB,MAAM,EAAE;EACV,CAAC,CAAC,CACCC,IAAI,CAAChB,SAAS,CAAC,GAAG,CAAC,CAAC,CACpBgB,IAAI,CAAEC,GAAG,IAAKA,GAAG,CAACC,IAAI,CAAC,CAAC,CAAC;AAC9B"}
1
+ {"version":3,"names":["decode","decodeJwt","WalletProviderEntityConfiguration","TrustAnchorEntityConfiguration","CredentialIssuerEntityConfiguration","RelyingPartyEntityConfiguration","EntityConfiguration","EntityStatement","validateTrustChain","renewTrustChain","hasStatusOrThrow","verifyTrustChain","trustAnchorEntity","chain","appFetch","fetch","renewOnFail","arguments","length","undefined","error","renewedChain","getSignedEntityConfiguration","entityBaseUrl","wellKnownUrl","method","then","res","text","fetchAndParseEntityConfiguration","schema","responseText","responseJwt","parse","header","protectedHeader","payload","getWalletProviderEntityConfiguration","options","getCredentialIssuerEntityConfiguration","getTrustAnchorEntityConfiguration","getRelyingPartyEntityConfiguration","getEntityConfiguration","getEntityStatement","accreditationBodyBaseUrl","subordinatedEntityBaseUrl","getSignedEntityStatement","url","URLSearchParams","sub"],"sourceRoot":"../../../src","sources":["trust/index.ts"],"mappings":"AAAA,SAASA,MAAM,IAAIC,SAAS,QAAQ,6BAA6B;AACjE,SACEC,iCAAiC,EACjCC,8BAA8B,EAC9BC,mCAAmC,EACnCC,+BAA+B,EAC/BC,mBAAmB,EACnBC,eAAe,QACV,SAAS;AAChB,SAASC,kBAAkB,EAAEC,eAAe,QAAQ,SAAS;AAC7D,SAASC,gBAAgB,QAAQ,eAAe;AAWhD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,gBAAgBA,CACpCC,iBAAiD,EACjDC,KAAe,EAKiC;EAAA,IAJhD;IACEC,QAAQ,GAAGC,KAAK;IAChBC,WAAW,GAAG;EAC4C,CAAC,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAElE,IAAI;IACF,OAAOT,kBAAkB,CAACI,iBAAiB,EAAEC,KAAK,CAAC;EACrD,CAAC,CAAC,OAAOO,KAAK,EAAE;IACd,IAAIJ,WAAW,EAAE;MACf,MAAMK,YAAY,GAAG,MAAMZ,eAAe,CAACI,KAAK,EAAEC,QAAQ,CAAC;MAC3D,OAAON,kBAAkB,CAACI,iBAAiB,EAAES,YAAY,CAAC;IAC5D,CAAC,MAAM;MACL,MAAMD,KAAK;IAC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AEN,MAAM8B,GAAG,GAAI,GAAEH,wBAAyB,UAAS,IAAII,eAAe,CAAC;IACnEC,GAAG,EAAEJ;EACP,CAAC,CAAE,EAAC;EAEJ,OAAO,MAAM/B,QAAQ,CAACiC,GAAG,EAAE;IACzBtB,MAAM,EAAE;EACV,CAAC,CAAC,CACCC,IAAI,CAAChB,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAC3BgB,IAAI,CAAEC,GAAG,IAAKA,GAAG,CAACC,IAAI,CAAC,CAAC,CAAC;AAC9B"}
@@ -44,6 +44,8 @@ export const getJwtFromFormPost = async formData => {
44
44
  };
45
45
  }
46
46
  }
47
- throw new ValidationFailed(`Unable to obtain JWT from form_post.jwt. Form data: ${formData}`);
47
+ throw new ValidationFailed({
48
+ message: `Unable to obtain JWT from form_post.jwt. Form data: ${formData}`
49
+ });
48
50
  };
49
51
  //# sourceMappingURL=decoder.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["decode","decodeJwt","ValidationFailed","getJwtFromFormPost","formData","formPostRegex","lineExpressionRegex","match","exec","responseJwt","jwt","replace","decodedJwt"],"sourceRoot":"../../../src","sources":["utils/decoder.ts"],"mappings":"AAAA,SAASA,MAAM,IAAIC,SAAS,QAAQ,6BAA6B;AAEjE,SAASC,gBAAgB,QAAQ,UAAU;;AAE3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,kBAAkB,GAAG,MAChCC,QAAgB,IAC0C;EAC1D,MAAMC,aAAa,GAAG,iDAAiD;EACvE,MAAMC,mBAAmB,GAAG,sBAAsB;EAElD,MAAMC,KAAK,GAAGF,aAAa,CAACG,IAAI,CAACJ,QAAQ,CAAC;EAC1C,IAAIG,KAAK,IAAIA,KAAK,CAAC,CAAC,CAAC,EAAE;IACrB,MAAME,WAAW,GAAGF,KAAK,CAAC,CAAC,CAAC;IAE5B,IAAIE,WAAW,EAAE;MACf,MAAMC,GAAG,GAAGD,WAAW,CAACE,OAAO,CAACL,mBAAmB,EAAE,EAAE,CAAC;MACxD,MAAMM,UAAU,GAAGX,SAAS,CAACS,GAAG,CAAC;MACjC,OAAO;QAAEA,GAAG;QAAEE;MAAW,CAAC;IAC5B;EACF;EAEA,MAAM,IAAIV,gBAAgB,CACvB,uDAAsDE,QAAS,EAClE,CAAC;AACH,CAAC"}
1
+ {"version":3,"names":["decode","decodeJwt","ValidationFailed","getJwtFromFormPost","formData","formPostRegex","lineExpressionRegex","match","exec","responseJwt","jwt","replace","decodedJwt","message"],"sourceRoot":"../../../src","sources":["utils/decoder.ts"],"mappings":"AAAA,SAASA,MAAM,IAAIC,SAAS,QAAQ,6BAA6B;AAEjE,SAASC,gBAAgB,QAAQ,UAAU;;AAE3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,kBAAkB,GAAG,MAChCC,QAAgB,IAC0C;EAC1D,MAAMC,aAAa,GAAG,iDAAiD;EACvE,MAAMC,mBAAmB,GAAG,sBAAsB;EAElD,MAAMC,KAAK,GAAGF,aAAa,CAACG,IAAI,CAACJ,QAAQ,CAAC;EAC1C,IAAIG,KAAK,IAAIA,KAAK,CAAC,CAAC,CAAC,EAAE;IACrB,MAAME,WAAW,GAAGF,KAAK,CAAC,CAAC,CAAC;IAE5B,IAAIE,WAAW,EAAE;MACf,MAAMC,GAAG,GAAGD,WAAW,CAACE,OAAO,CAACL,mBAAmB,EAAE,EAAE,CAAC;MACxD,MAAMM,UAAU,GAAGX,SAAS,CAACS,GAAG,CAAC;MACjC,OAAO;QAAEA,GAAG;QAAEE;MAAW,CAAC;IAC5B;EACF;EAEA,MAAM,IAAIV,gBAAgB,CAAC;IACzBW,OAAO,EAAG,uDAAsDT,QAAS;EAC3E,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,43 @@
1
+ export const IssuerResponseErrorCodes = {
2
+ IssuerGenericError: "ERR_ISSUER_GENERIC_ERROR",
3
+ /**
4
+ * Error code thrown when a credential cannot be issued immediately because it follows the async flow.
5
+ */
6
+ CredentialIssuingNotSynchronous: "ERR_CREDENTIAL_ISSUING_NOT_SYNCHRONOUS",
7
+ /**
8
+ * Error code thrown when an error occurs while requesting a credential.
9
+ */
10
+ CredentialRequestFailed: "ERR_CREDENTIAL_REQUEST_FAILED",
11
+ /**
12
+ * Error code thrown when a credential status is invalid, either during issuance or when requesting a status attestation.
13
+ */
14
+ CredentialInvalidStatus: "ERR_CREDENTIAL_INVALID_STATUS",
15
+ /**
16
+ * Error code thrown when an error occurs while obtaining a status attestation for a credential.
17
+ */
18
+ StatusAttestationRequestFailed: "ERR_STATUS_ATTESTATION_REQUEST_FAILED"
19
+ };
20
+ export const WalletProviderResponseErrorCodes = {
21
+ WalletProviderGenericError: "ERR_IO_WALLET_PROVIDER_GENERIC_ERROR",
22
+ /**
23
+ * An error code thrown when an error occurs during the wallet instance creation process.
24
+ */
25
+ WalletInstanceCreationFailed: "ERR_IO_WALLET_INSTANCE_CREATION_FAILED",
26
+ /**
27
+ * An error code thrown when validation fail
28
+ */
29
+ WalletInstanceAttestationIssuingFailed: "ERR_IO_WALLET_INSTANCE_ATTESTATION_ISSUING_FAILED",
30
+ /**
31
+ * An error code thrown when the requester does not pass the integrity checks when interacting with the Wallet Provider.
32
+ */
33
+ WalletInstanceIntegrityFailed: "ERR_IO_WALLET_INSTANCE_INTEGRITY_FAILED",
34
+ /**
35
+ * An error code thrown when obtaining a wallet instance attestation but the wallet instance is revoked.
36
+ */
37
+ WalletInstanceRevoked: "ERR_IO_WALLET_INSTANCE_REVOKED",
38
+ /**
39
+ * An error code thrown when obtaining a wallet instance attestation but the wallet instance is not found.
40
+ */
41
+ WalletInstanceNotFound: "ERR_IO_WALLET_INSTANCE_NOT_FOUND"
42
+ };
43
+ //# sourceMappingURL=error-codes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["IssuerResponseErrorCodes","IssuerGenericError","CredentialIssuingNotSynchronous","CredentialRequestFailed","CredentialInvalidStatus","StatusAttestationRequestFailed","WalletProviderResponseErrorCodes","WalletProviderGenericError","WalletInstanceCreationFailed","WalletInstanceAttestationIssuingFailed","WalletInstanceIntegrityFailed","WalletInstanceRevoked","WalletInstanceNotFound"],"sourceRoot":"../../../src","sources":["utils/error-codes.ts"],"mappings":"AAAA,OAAO,MAAMA,wBAAwB,GAAG;EACtCC,kBAAkB,EAAE,0BAA0B;EAC9C;AACF;AACA;EACEC,+BAA+B,EAAE,wCAAwC;EACzE;AACF;AACA;EACEC,uBAAuB,EAAE,+BAA+B;EACxD;AACF;AACA;EACEC,uBAAuB,EAAE,+BAA+B;EACxD;AACF;AACA;EACEC,8BAA8B,EAAE;AAClC,CAAU;AAEV,OAAO,MAAMC,gCAAgC,GAAG;EAC9CC,0BAA0B,EAAE,sCAAsC;EAClE;AACF;AACA;EACEC,4BAA4B,EAAE,wCAAwC;EACtE;AACF;AACA;EACEC,sCAAsC,EACpC,mDAAmD;EACrD;AACF;AACA;EACEC,6BAA6B,EAAE,yCAAyC;EACxE;AACF;AACA;EACEC,qBAAqB,EAAE,gCAAgC;EACvD;AACF;AACA;EACEC,sBAAsB,EAAE;AAC1B,CAAU"}