@pagopa/io-react-native-wallet 0.2.1 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. package/lib/commonjs/index.js +9 -1
  2. package/lib/commonjs/index.js.map +1 -1
  3. package/lib/commonjs/pid/issuing.js +28 -0
  4. package/lib/commonjs/pid/issuing.js.map +1 -1
  5. package/lib/commonjs/pid/metadata.js +51 -0
  6. package/lib/commonjs/pid/metadata.js.map +1 -0
  7. package/lib/commonjs/pid/sd-jwt/index.js +2 -1
  8. package/lib/commonjs/pid/sd-jwt/index.js.map +1 -1
  9. package/lib/commonjs/rp/__test__/index.test.js +3 -5
  10. package/lib/commonjs/rp/__test__/index.test.js.map +1 -1
  11. package/lib/commonjs/rp/index.js +165 -15
  12. package/lib/commonjs/rp/index.js.map +1 -1
  13. package/lib/commonjs/rp/types.js +13 -1
  14. package/lib/commonjs/rp/types.js.map +1 -1
  15. package/lib/commonjs/sd-jwt/__test__/index.test.js +119 -0
  16. package/lib/commonjs/sd-jwt/__test__/index.test.js.map +1 -0
  17. package/lib/commonjs/sd-jwt/index.js +84 -4
  18. package/lib/commonjs/sd-jwt/index.js.map +1 -1
  19. package/lib/commonjs/sd-jwt/types.js +9 -0
  20. package/lib/commonjs/sd-jwt/types.js.map +1 -1
  21. package/lib/commonjs/sd-jwt/verifier.js +7 -5
  22. package/lib/commonjs/sd-jwt/verifier.js.map +1 -1
  23. package/lib/commonjs/utils/errors.js +76 -1
  24. package/lib/commonjs/utils/errors.js.map +1 -1
  25. package/lib/module/index.js +5 -1
  26. package/lib/module/index.js.map +1 -1
  27. package/lib/module/pid/issuing.js +30 -2
  28. package/lib/module/pid/issuing.js.map +1 -1
  29. package/lib/module/pid/metadata.js +43 -0
  30. package/lib/module/pid/metadata.js.map +1 -0
  31. package/lib/module/pid/sd-jwt/index.js +3 -3
  32. package/lib/module/pid/sd-jwt/index.js.map +1 -1
  33. package/lib/module/rp/__test__/index.test.js +3 -5
  34. package/lib/module/rp/__test__/index.test.js.map +1 -1
  35. package/lib/module/rp/index.js +168 -18
  36. package/lib/module/rp/index.js.map +1 -1
  37. package/lib/module/rp/types.js +11 -0
  38. package/lib/module/rp/types.js.map +1 -1
  39. package/lib/module/sd-jwt/__test__/index.test.js +118 -0
  40. package/lib/module/sd-jwt/__test__/index.test.js.map +1 -0
  41. package/lib/module/sd-jwt/index.js +83 -3
  42. package/lib/module/sd-jwt/index.js.map +1 -1
  43. package/lib/module/sd-jwt/types.js +10 -0
  44. package/lib/module/sd-jwt/types.js.map +1 -1
  45. package/lib/module/sd-jwt/verifier.js +8 -6
  46. package/lib/module/sd-jwt/verifier.js.map +1 -1
  47. package/lib/module/utils/errors.js +71 -0
  48. package/lib/module/utils/errors.js.map +1 -1
  49. package/lib/typescript/{index.d.ts → src/index.d.ts} +3 -1
  50. package/lib/typescript/src/index.d.ts.map +1 -0
  51. package/lib/typescript/src/pid/index.d.ts.map +1 -0
  52. package/lib/typescript/{pid → src/pid}/issuing.d.ts +9 -0
  53. package/lib/typescript/src/pid/issuing.d.ts.map +1 -0
  54. package/lib/typescript/src/pid/metadata.d.ts +528 -0
  55. package/lib/typescript/src/pid/metadata.d.ts.map +1 -0
  56. package/lib/typescript/src/pid/sd-jwt/converters.d.ts.map +1 -0
  57. package/lib/typescript/{pid → src/pid}/sd-jwt/index.d.ts +1 -1
  58. package/lib/typescript/src/pid/sd-jwt/index.d.ts.map +1 -0
  59. package/lib/typescript/src/pid/sd-jwt/types.d.ts.map +1 -0
  60. package/lib/typescript/src/rp/__test__/index.test.d.ts.map +1 -0
  61. package/lib/typescript/src/rp/index.d.ts +89 -0
  62. package/lib/typescript/src/rp/index.d.ts.map +1 -0
  63. package/lib/typescript/{rp → src/rp}/types.d.ts +71 -47
  64. package/lib/typescript/{rp → src/rp}/types.d.ts.map +1 -1
  65. package/lib/typescript/src/sd-jwt/__test__/converters.test.d.ts.map +1 -0
  66. package/lib/typescript/src/sd-jwt/__test__/index.test.d.ts +2 -0
  67. package/lib/typescript/src/sd-jwt/__test__/index.test.d.ts.map +1 -0
  68. package/lib/typescript/src/sd-jwt/__test__/types.test.d.ts.map +1 -0
  69. package/lib/typescript/src/sd-jwt/converters.d.ts.map +1 -0
  70. package/lib/typescript/{sd-jwt → src/sd-jwt}/index.d.ts +22 -2
  71. package/lib/typescript/src/sd-jwt/index.d.ts.map +1 -0
  72. package/lib/typescript/{sd-jwt → src/sd-jwt}/types.d.ts +12 -0
  73. package/lib/typescript/src/sd-jwt/types.d.ts.map +1 -0
  74. package/lib/typescript/src/sd-jwt/verifier.d.ts +3 -0
  75. package/lib/typescript/src/sd-jwt/verifier.d.ts.map +1 -0
  76. package/lib/typescript/src/utils/dpop.d.ts.map +1 -0
  77. package/lib/typescript/{utils → src/utils}/errors.d.ts +41 -0
  78. package/lib/typescript/src/utils/errors.d.ts.map +1 -0
  79. package/lib/typescript/src/utils/jwk.d.ts.map +1 -0
  80. package/lib/typescript/src/wallet-instance-attestation/index.d.ts.map +1 -0
  81. package/lib/typescript/src/wallet-instance-attestation/issuing.d.ts.map +1 -0
  82. package/lib/typescript/{wallet-instance-attestation → src/wallet-instance-attestation}/types.d.ts +8 -8
  83. package/lib/typescript/{wallet-instance-attestation → src/wallet-instance-attestation}/types.d.ts.map +1 -1
  84. package/package.json +7 -5
  85. package/src/index.ts +13 -1
  86. package/src/pid/issuing.ts +38 -1
  87. package/src/pid/metadata.ts +46 -0
  88. package/src/pid/sd-jwt/index.ts +7 -4
  89. package/src/rp/__test__/index.test.ts +5 -9
  90. package/src/rp/index.ts +208 -24
  91. package/src/rp/types.ts +16 -0
  92. package/src/sd-jwt/__test__/index.test.ts +171 -0
  93. package/src/sd-jwt/index.ts +84 -7
  94. package/src/sd-jwt/types.ts +13 -0
  95. package/src/sd-jwt/verifier.ts +5 -7
  96. package/src/utils/errors.ts +81 -0
  97. package/lib/typescript/index.d.ts.map +0 -1
  98. package/lib/typescript/pid/index.d.ts.map +0 -1
  99. package/lib/typescript/pid/issuing.d.ts.map +0 -1
  100. package/lib/typescript/pid/sd-jwt/converters.d.ts.map +0 -1
  101. package/lib/typescript/pid/sd-jwt/index.d.ts.map +0 -1
  102. package/lib/typescript/pid/sd-jwt/types.d.ts.map +0 -1
  103. package/lib/typescript/rp/__test__/index.test.d.ts.map +0 -1
  104. package/lib/typescript/rp/index.d.ts +0 -43
  105. package/lib/typescript/rp/index.d.ts.map +0 -1
  106. package/lib/typescript/sd-jwt/__test__/converters.test.d.ts.map +0 -1
  107. package/lib/typescript/sd-jwt/__test__/types.test.d.ts.map +0 -1
  108. package/lib/typescript/sd-jwt/converters.d.ts.map +0 -1
  109. package/lib/typescript/sd-jwt/index.d.ts.map +0 -1
  110. package/lib/typescript/sd-jwt/types.d.ts.map +0 -1
  111. package/lib/typescript/sd-jwt/verifier.d.ts +0 -3
  112. package/lib/typescript/sd-jwt/verifier.d.ts.map +0 -1
  113. package/lib/typescript/utils/dpop.d.ts.map +0 -1
  114. package/lib/typescript/utils/errors.d.ts.map +0 -1
  115. package/lib/typescript/utils/jwk.d.ts.map +0 -1
  116. package/lib/typescript/wallet-instance-attestation/index.d.ts.map +0 -1
  117. package/lib/typescript/wallet-instance-attestation/issuing.d.ts.map +0 -1
  118. /package/lib/typescript/{pid → src/pid}/index.d.ts +0 -0
  119. /package/lib/typescript/{pid → src/pid}/sd-jwt/converters.d.ts +0 -0
  120. /package/lib/typescript/{pid → src/pid}/sd-jwt/types.d.ts +0 -0
  121. /package/lib/typescript/{rp → src/rp}/__test__/index.test.d.ts +0 -0
  122. /package/lib/typescript/{sd-jwt → src/sd-jwt}/__test__/converters.test.d.ts +0 -0
  123. /package/lib/typescript/{sd-jwt → src/sd-jwt}/__test__/types.test.d.ts +0 -0
  124. /package/lib/typescript/{sd-jwt → src/sd-jwt}/converters.d.ts +0 -0
  125. /package/lib/typescript/{utils → src/utils}/dpop.d.ts +0 -0
  126. /package/lib/typescript/{utils → src/utils}/jwk.d.ts +0 -0
  127. /package/lib/typescript/{wallet-instance-attestation → src/wallet-instance-attestation}/index.d.ts +0 -0
  128. /package/lib/typescript/{wallet-instance-attestation → src/wallet-instance-attestation}/issuing.d.ts +0 -0
@@ -13,6 +13,16 @@ export const ObfuscatedDisclosures = z.object({
13
13
  */
14
14
 
15
15
  export const Disclosure = z.tuple([/* salt */z.string(), /* claim name */z.string(), /* claim value */z.unknown()]);
16
+
17
+ /**
18
+ * Encoding depends on the serialization algorithm used when generating the disclosure tokens.
19
+ * The SD-JWT reference itself take no decision about how to handle whitespaces in serialized objects.
20
+ * For such reason, we may find conveninent to have encoded and decode values stored explicitly in the same structure.
21
+ * Please note that `encoded` can always decode into `decode`, but `decode` may or may not be encoded with the same value of `encoded`
22
+ *
23
+ * @see https://www.ietf.org/id/draft-ietf-oauth-selective-disclosure-jwt-05.html#name-disclosures-for-object-prop
24
+ */
25
+
16
26
  export const SdJwt4VC = z.object({
17
27
  header: z.object({
18
28
  typ: z.literal("vc+sd-jwt"),
@@ -1 +1 @@
1
- {"version":3,"names":["JWK","z","UnixTime","number","min","max","ObfuscatedDisclosures","object","_sd","array","string","Disclosure","tuple","unknown","SdJwt4VC","header","typ","literal","alg","kid","optional","trust_chain","payload","iss","sub","jti","iat","exp","status","cnf","jwk","type","verified_claims","verification","intersection","trust_framework","assurance_level","claims","_sd_alg"],"sourceRoot":"../../../src","sources":["sd-jwt/types.ts"],"mappings":"AAAA,SAASA,GAAG,QAAQ,cAAc;AAClC,SAASC,CAAC,QAAQ,KAAK;AAEvB,OAAO,MAAMC,QAAQ,GAAGD,CAAC,CAACE,MAAM,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC,CAAC,CAACC,GAAG,CAAC,aAAa,CAAC;AAI5D,OAAO,MAAMC,qBAAqB,GAAGL,CAAC,CAACM,MAAM,CAAC;EAAEC,GAAG,EAAEP,CAAC,CAACQ,KAAK,CAACR,CAAC,CAACS,MAAM,CAAC,CAAC;AAAE,CAAC,CAAC;;AAE3E;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMC,UAAU,GA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AAM,CAAC;MAC5B,CAAC,CAAC,EACFJ,qBACF,CAAC;MACD+B,MAAM,EAAE/B;IACV,CAAC,CAAC;IACFgC,OAAO,EAAErC,CAAC,CAACgB,OAAO,CAAC,SAAS;EAC9B,CAAC;AACH,CAAC,CAAC"}
1
+ {"version":3,"names":["JWK","z","UnixTime","number","min","max","ObfuscatedDisclosures","object","_sd","array","string","Disclosure","tuple","unknown","SdJwt4VC","header","typ","literal","alg","kid","optional","trust_chain","payload","iss","sub","jti","iat","exp","status","cnf","jwk","type","verified_claims","verification","intersection","trust_framework","assurance_level","claims","_sd_alg"],"sourceRoot":"../../../src","sources":["sd-jwt/types.ts"],"mappings":"AAAA,SAASA,GAAG,QAAQ,cAAc;AAClC,SAASC,CAAC,QAAQ,KAAK;AAEvB,OAAO,MAAMC,QAAQ,GAAGD,CAAC,CAACE,MAAM,CAAC,CAAC,CAACC,GAAG,CAAC,CAAC,CAAC,CAACC,GAAG,CAAC,aAAa,CAAC;AAI5D,OAAO,MAAMC,qBAAqB,GAAGL,CAAC,CAACM,MAAM,CAAC;EAAEC,GAAG,EAAEP,CAAC,CAACQ,KAAK,CAACR,CAAC,CAACS,MAAM,CAAC,CAAC;AAAE,CAAC,CAAC;;AAE3E;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMC,UAAU,GAAGV,CAAC,CAACW,KAAK,CAAC,CAChC,UAAWX,CAAC,CAACS,MAAM,CAAC,CAAC,EACrB,gBAAiBT,CAAC,CAACS,MAAM,CAAC,CAAC,EAC3B,iBAAkBT,CAAC,CAACY,OAAO,CAAC,CAAC,CAC9B,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA,OAAO,MAAMC,QAAQ,GAAGb,CAAC,CAACM,MAAM,CAAC;EAC/BQ,MAAM,EAAEd,CAAC,CAACM,MAAM,CAAC;IACfS,GAAG,EAAEf,CAAC,CAACgB,OAAO,CAAC,WAAW,CAAC;IAC3BC,GAAG,EAAEjB,CAAC,CAACS,MAAM,CAAC,CAAC;IACfS,GAAG,EAAElB,CAAC,CAACS,MAAM,CAAC,CAAC,CAACU,QAAQ,CAAC,CAAC;IAC1BC,WAAW,EAAEpB,CAAC,CAACQ,KAAK,CAACR,CAAC,CAACS,MAAM,CAAC,CAAC;EACjC,CAAC,CAAC;EACFY,OAAO,EAAErB,CAAC,CAACM,MAAM,CAAC;IAChBgB,GAAG,EAAEtB,CAAC,CAACS,MAAM,CAAC,CAAC;IACfc,GAAG,EAAEvB,CAAC,CAACS,MAAM,CAAC,CAAC;IACfe,GAAG,EAAExB,CAAC,CAACS,MAAM,CAAC,CAAC;IACfgB,GAAG,EAAExB,QAAQ;IACbyB,GAAG,EAAEzB,QAAQ;IACb0B,MAAM,EAAE3B,CAAC,CAACS,MAAM,CAAC,CAAC;IAClBmB,GAAG,EAAE5B,CAAC,CAACM,MAAM,CAAC;MACZuB,GAAG,EAAE9B;IACP,CAAC,CAAC;IACF+B,IAAI,EAAE9B,CAAC,CAACgB,OAAO,CAAC,0BAA0B,CAAC;IAC3Ce,eAAe,EAAE/B,CAAC,CAACM,MAAM,CAAC;MACxB0B,YAAY,EAAEhC,CAAC,CAACiC,YAAY,CAC1BjC,CAAC,CAACM,MAAM,CAAC;QACP4B,eAAe,EAAElC,CAAC,CAACgB,OAAO,CAAC,OAAO,CAAC;QACnCmB,eAAe,EAAEnC,CAAC,CAACS,MAAM,CAAC;MAC5B,CAAC,CAAC,EACFJ,qBACF,CAAC;MACD+B,MAAM,EAAE/B;IACV,CAAC,CAAC;IACFgC,OAAO,EAAErC,CAAC,CAACgB,OAAO,CAAC,SAAS;EAC9B,CAAC;AACH,CAAC,CAAC"}
@@ -1,11 +1,13 @@
1
- import { encodeBase64, sha256ToBase64 } from "@pagopa/io-react-native-jwt";
1
+ import { sha256ToBase64 } from "@pagopa/io-react-native-jwt";
2
2
  import { ValidationFailed } from "../utils/errors";
3
- export const verifyDisclosure = async (disclosure, claims) => {
4
- let disclosureString = JSON.stringify(disclosure);
5
- let encodedDisclosure = encodeBase64(disclosureString);
6
- let hash = await sha256ToBase64(encodedDisclosure);
3
+ export const verifyDisclosure = async (_ref, claims) => {
4
+ let {
5
+ encoded,
6
+ decoded
7
+ } = _ref;
8
+ let hash = await sha256ToBase64(encoded);
7
9
  if (!claims.includes(hash)) {
8
- throw new ValidationFailed("Validation of disclosure failed", `${disclosure}`, "Disclosure hash not found in claims");
10
+ throw new ValidationFailed("Validation of disclosure failed", `${decoded}`, "Disclosure hash not found in claims");
9
11
  }
10
12
  };
11
13
  //# sourceMappingURL=verifier.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["encodeBase64","sha256ToBase64","ValidationFailed","verifyDisclosure","disclosure","claims","disclosureString","JSON","stringify","encodedDisclosure","hash","includes"],"sourceRoot":"../../../src","sources":["sd-jwt/verifier.ts"],"mappings":"AAAA,SAASA,YAAY,EAAEC,cAAc,QAAQ,6BAA6B;AAE1E,SAASC,gBAAgB,QAAQ,iBAAiB;AAGlD,OAAO,MAAMC,gBAAgB,GAAG,MAAAA,CAC9BC,UAAsB,EACtBC,MAAoC,KACjC;EACH,IAAIC,gBAAgB,GAAGC,IAAI,CAACC,SAAS,CAACJ,UAAU,CAAC;EACjD,IAAIK,iBAAiB,GAAGT,YAAY,CAACM,gBAAgB,CAAC;EACtD,IAAII,IAAI,GAAG,MAAMT,cAAc,CAACQ,iBAAiB,CAAC;EAClD,IAAI,CAACJ,MAAM,CAACM,QAAQ,CAACD,IAAI,CAAC,EAAE;IAC1B,MAAM,IAAIR,gBAAgB,CACxB,iCAAiC,EAChC,GAAEE,UAAW,EAAC,EACf,qCACF,CAAC;EACH;AACF,CAAC"}
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"}
@@ -116,4 +116,75 @@ export class PidIssuingError extends IoWalletError {
116
116
  this.reason = reason;
117
117
  }
118
118
  }
119
+
120
+ /**
121
+ * When claims are requested but not found in the credential
122
+ *
123
+ */
124
+ export class ClaimsNotFoundBetweenDislosures extends Error {
125
+ static get code() {
126
+ return "ERR_CLAIMS_NOT_FOUND";
127
+ }
128
+ code = "ERR_CLAIMS_NOT_FOUND";
129
+
130
+ /** The Claims not found */
131
+
132
+ constructor(claims) {
133
+ const c = Array.isArray(claims) ? claims : [claims];
134
+ const message = `Some requested claims are not present in the disclosurable values, claims: ${c.join(", ")}`;
135
+ super(message);
136
+ this.claims = c;
137
+ }
138
+ }
139
+
140
+ /**
141
+ * When the SD-JWT does not contain an hashed reference to a given set of claims
142
+ */
143
+ export class ClaimsNotFoundInToken extends Error {
144
+ static get code() {
145
+ return "ERR_CLAIMS_NOT_FOUND_IN_TOKEN";
146
+ }
147
+ code = "ERR_CLAIMS_NOT_FOUND_IN_TOKEN";
148
+
149
+ /** The Claims not found */
150
+
151
+ constructor(claims) {
152
+ const c = Array.isArray(claims) ? claims : [claims];
153
+ const message = `Some claims are not found in the given token, claims: ${c.join(", ")}`;
154
+ super(message);
155
+ this.claims = c;
156
+ }
157
+ }
158
+
159
+ /**
160
+ * When selecting a public key from an entity configuration, and no one meets the requirements for the scenario
161
+ *
162
+ */
163
+ export class NoSuitableKeysFoundInEntityConfiguration extends Error {
164
+ static get code() {
165
+ return "ERR_NO_SUITABLE_KEYS_NOT_FOUND";
166
+ }
167
+ code = "ERR_NO_SUITABLE_KEYS_NOT_FOUND";
168
+
169
+ /**
170
+ * @param scenario describe the scenario in which the error arise
171
+ */
172
+ constructor(scenario) {
173
+ const message = `Entity configuration do not provide any suitable keys (${scenario}).`;
174
+ super(message);
175
+ }
176
+ }
177
+
178
+ /**
179
+ * When selecting a public key from an entity configuration, and no one meets the requirements for the scenario
180
+ *
181
+ */
182
+ export class PidMetadataError extends Error {
183
+ static get code() {
184
+ return "PID_METADATA_ERROR";
185
+ }
186
+ constructor(message) {
187
+ super(message);
188
+ }
189
+ }
119
190
  //# sourceMappingURL=errors.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["IoWalletError","Error","code","constructor","message","_Error$captureStackTr","name","captureStackTrace","call","ValidationFailed","claim","arguments","length","undefined","reason","WalletInstanceAttestationIssuingError","AuthRequestDecodeError","PidIssuingError"],"sourceRoot":"../../../src","sources":["utils/errors.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,aAAa,SAASC,KAAK,CAAC;EACvC;EACA,WAAWC,IAAIA,CAAA,EAAW;IACxB,OAAO,uBAAuB;EAChC;;EAEA;EACAA,IAAI,GAAW,uBAAuB;EAEtCC,WAAWA,CAACC,OAAgB,EAAE;IAAA,IAAAC,qBAAA;IAC5B,KAAK,CAACD,OAAO,CAAC;IACd,IAAI,CAACE,IAAI,GAAG,IAAI,CAACH,WAAW,CAACG,IAAI;IACjC;IACA,CAAAD,qBAAA,GAAAJ,KAAK,CAACM,iBAAiB,cAAAF,qBAAA,uBAAvBA,qBAAA,CAAAG,IAAA,CAAAP,KAAK,EAAqB,IAAI,EAAE,IAAI,CAACE,WAAW,CAAC;EACnD;AACF;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMM,gBAAgB,SAAST,aAAa,CAAC;EAClD,WAAWE,IAAIA,CAAA,EAAsC;IAC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;IAAA,IAAEG,MAAM,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,aAAa;IACxE,KAAK,CAACP,OAAO,CAAC;IACd,IAAI,CAACM,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACI,MAAM,GAAGA,MAAM;EACtB;AACF;;AAEA;AACA;AACA;AACA;AACA,OAAO,MAAMG,eAAe,SAASjB,aAAa,CAAC;EACjD,WAAWE,IAAIA,CAAA,EAAuC;IACpD,OAAO,kCAAkC;EAC3C;EAEAA,IAAI,GAAG,kCAAkC;;EAEzC;;EAGA;;EAGAC,WAAWA,CAACC,OAAe,EAAiD;IAAA,IAA/CM,KAAK,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,aAAa;IAAA,IAAEG,MAAM,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,aAAa;IACxE,KAAK,CAACP,OAAO,CAAC;IACd,IAAI,CAACM,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACI,MAAM,GAAGA,MAAM;EACtB;AACF"}
1
+ {"version":3,"names":["IoWalletError","Error","code","constructor","message","_Error$captureStackTr","name","captureStackTrace","call","ValidationFailed","claim","arguments","length","undefined","reason","WalletInstanceAttestationIssuingError","AuthRequestDecodeError","PidIssuingError","ClaimsNotFoundBetweenDislosures","claims","c","Array","isArray","join","ClaimsNotFoundInToken","NoSuitableKeysFoundInEntityConfiguration","scenario","PidMetadataError"],"sourceRoot":"../../../src","sources":["utils/errors.ts"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,aAAa,SAASC,KAAK,CAAC;EACvC;EACA,WAAWC,IAAIA,CAAA,EAAW;IACxB,OAAO,uBAAuB;EAChC;;EAEA;EACAA,IAAI,GAAW,uBAAuB;EAEtCC,WAAWA,CAACC,OAAgB,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AACC,OAAe,EAAE;IAC3B,KAAK,CAACA,OAAO,CAAC;EAChB;AACF"}
@@ -1,7 +1,9 @@
1
+ import "react-native-url-polyfill/auto";
1
2
  import * as PID from "./pid";
2
3
  import * as RP from "./rp";
3
4
  import * as Errors from "./utils/errors";
4
5
  import * as WalletInstanceAttestation from "./wallet-instance-attestation";
5
6
  import { getUnsignedDPop } from "./utils/dpop";
6
- export { PID, RP, WalletInstanceAttestation, Errors, getUnsignedDPop };
7
+ import { RelyingPartySolution } from "./rp";
8
+ export { PID, RP, WalletInstanceAttestation, Errors, getUnsignedDPop, RelyingPartySolution, };
7
9
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,gCAAgC,CAAC;AAExC,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,MAAM,CAAC;AAC3B,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAC;AACzC,OAAO,KAAK,yBAAyB,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,MAAM,CAAC;AAE5C,OAAO,EACL,GAAG,EACH,EAAE,EACF,yBAAyB,EACzB,MAAM,EACN,eAAe,EACf,oBAAoB,GACrB,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/pid/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { JWK } from "../utils/jwk";
2
+ import { PidIssuerEntityConfiguration } from "./metadata";
2
3
  export type CieData = {
3
4
  birthDate: string;
4
5
  fiscalCode: string;
@@ -89,5 +90,13 @@ export declare class Issuing {
89
90
  *
90
91
  */
91
92
  getCredential(unsignedDPopForPid: string, dPopPidSignature: string, unsignedNonceProof: string, nonceProofSignature: string, accessToken: string, cieData: CieData): Promise<PidResponse>;
93
+ /**
94
+ * Obtain the PID issuer metadata
95
+ *
96
+ * @function
97
+ * @returns PID issuer metadata
98
+ *
99
+ */
100
+ getEntityConfiguration(): Promise<PidIssuerEntityConfiguration>;
92
101
  }
93
102
  //# sourceMappingURL=issuing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"issuing.d.ts","sourceRoot":"","sources":["../../../../src/pid/issuing.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAKnC,OAAO,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAC;AAG1D,MAAM,MAAM,OAAO,GAAG;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AACtE,MAAM,MAAM,WAAW,GAAG;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,qBAAa,OAAO;IAClB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,yBAAyB,EAAE,MAAM,CAAC;IAClC,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,WA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