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

Sign up to get free protection for your applications and to get access to all the features.
@@ -22,7 +22,10 @@ var _verifier = require("./verifier");
22
22
  *
23
23
  */
24
24
  const decode = (token, schema) => {
25
- // token are expected in the form "sd-jwt~disclosure0~disclosure1~...~disclosureN"
25
+ // token are expected in the form "sd-jwt~disclosure0~disclosure1~...~disclosureN~"
26
+ if (token.slice(-1) === "~") {
27
+ token = token.slice(0, -1);
28
+ }
26
29
  const [rawSdJwt = "", ...rawDisclosures] = token.split("~");
27
30
 
28
31
  // get the sd-jwt as object
@@ -1 +1 @@
1
- {"version":3,"names":["_ioReactNativeJwt","require","_types","_verifier","decode","token","schema","rawSdJwt","rawDisclosures","split","decodedJwt","decodeJwt","sdJwt","parse","header","protectedHeader","payload","disclosures","map","decodeBase64","e","JSON","Disclosure","exports","verify","publicKey","decoded","verifyJwt","claims","verified_claims","verification","_sd","Promise","all","disclosure","verifyDisclosure"],"sourceRoot":"../../../src","sources":["sd-jwt/index.ts"],"mappings":";;;;;;AAEA,IAAAA,iBAAA,GAAAC,OAAA;AAIA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,MAAM,GAAGA,CACpBC,KAAa,EACbC,MAAS,KAC4C;EACrD;EACA,MAAM,CAACC,QAAQ,GAAG,EAAE,EAAE,GAAGC,cAAc,CAAC,GAAGH,KAAK,CAACI,KAAK,CAAC,GAAG,CAAC;;EAE3D;EACA;EACA,MAAMC,UAAU,GAAG,IAAAC,wBAAS,EAACJ,QAAQ,CAAC;EACtC,MAAMK,KAAK,GAAGN,MAAM,CAACO,KAAK,CAAC;IACzBC,MAAM,EAAEJ,UAAU,CAACK,eAAe;IAClCC,OAAO,EAAEN,UAAU,CAACM;EACtB,CAAC,CAAC;;EAEF;EACA;EACA;EACA,MAAMC,WAAW,GAAGT,cAAc,CAC/BU,GAAG,CAACC,8BAAY,CAAC,CACjBD,GAAG,CAAEE,CAAC,IAAKC,IAAI,CAACR,KAAK,CAACO,CAAC,CAAC,CAAC,CACzBF,GAAG,CAAEE,CAAC,IAAKE,iBAAU,CAACT,KAAK,CAACO,CAAC,CAAC,CAAC;EAElC,OAAO;IAAER,KAAK;IAAEK;EAAY,CAAC;AAC/B,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAfAM,OAAA,CAAAnB,MAAA,GAAAA,MAAA;AAgBO,MAAMoB,MAAM,GAAG,MAAAA,CACpBnB,KAAa,EACboB,SAAc,EACdnB,MAAS,KACqD;EAC9D;EACA,MAAM,CAACC,QAAQ,GAAG,EAAE,CAAC,GAAGF,KAAK,CAACI,KAAK,CAAC,GAAG,CAAC;EACxC,MAAMiB,OAAO,GAAGtB,MAAM,CAACC,KAAK,EAAEC,MAAM,CAAC;;EAErC;EACA,MAAM,IAAAqB,wBAAS,EAACpB,QAAQ,EAAEkB,SAAS,CAAC;;EAEpC;EACA,MAAMG,MAAM,GAAG,CACb,GAAGF,OAAO,CAACd,KAAK,CAACI,OAAO,CAACa,eAAe,CAACC,YAAY,CAACC,GAAG,EACzD,GAAGL,OAAO,CAACd,KAAK,CAACI,OAAO,CAACa,eAAe,CAACD,MAAM,CAACG,GAAG,CACpD;EAED,MAAMC,OAAO,CAACC,GAAG,CACfP,OAAO,CAACT,WAAW,CAACC,GAAG,CACrB,MAAOgB,UAAU,IAAK,MAAM,IAAAC,0BAAgB,EAACD,UAAU,EAAEN,MAAM,CACjE,CACF,CAAC;EAED,OAAOF,OAAO;AAChB,CAAC;AAACH,OAAA,CAAAC,MAAA,GAAAA,MAAA"}
1
+ {"version":3,"names":["_ioReactNativeJwt","require","_types","_verifier","decode","token","schema","slice","rawSdJwt","rawDisclosures","split","decodedJwt","decodeJwt","sdJwt","parse","header","protectedHeader","payload","disclosures","map","decodeBase64","e","JSON","Disclosure","exports","verify","publicKey","decoded","verifyJwt","claims","verified_claims","verification","_sd","Promise","all","disclosure","verifyDisclosure"],"sourceRoot":"../../../src","sources":["sd-jwt/index.ts"],"mappings":";;;;;;AAEA,IAAAA,iBAAA,GAAAC,OAAA;AAIA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,MAAM,GAAGA,CACpBC,KAAa,EACbC,MAAS,KAC4C;EACrD;EACA,IAAID,KAAK,CAACE,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;IAC3BF,KAAK,GAAGA,KAAK,CAACE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;EAC5B;EACA,MAAM,CAACC,QAAQ,GAAG,EAAE,EAAE,GAAGC,cAAc,CAAC,GAAGJ,KAAK,CAACK,KAAK,CAAC,GAAG,CAAC;;EAE3D;EACA;EACA,MAAMC,UAAU,GAAG,IAAAC,wBAAS,EAACJ,QAAQ,CAAC;EACtC,MAAMK,KAAK,GAAGP,MAAM,CAACQ,KAAK,CAAC;IACzBC,MAAM,EAAEJ,UAAU,CAACK,eAAe;IAClCC,OAAO,EAAEN,UAAU,CAACM;EACtB,CAAC,CAAC;;EAEF;EACA;EACA;EACA,MAAMC,WAAW,GAAGT,cAAc,CAC/BU,GAAG,CAACC,8BAAY,CAAC,CACjBD,GAAG,CAAEE,CAAC,IAAKC,IAAI,CAACR,KAAK,CAACO,CAAC,CAAC,CAAC,CACzBF,GAAG,CAAEE,CAAC,IAAKE,iBAAU,CAACT,KAAK,CAACO,CAAC,CAAC,CAAC;EAElC,OAAO;IAAER,KAAK;IAAEK;EAAY,CAAC;AAC/B,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAfAM,OAAA,CAAApB,MAAA,GAAAA,MAAA;AAgBO,MAAMqB,MAAM,GAAG,MAAAA,CACpBpB,KAAa,EACbqB,SAAc,EACdpB,MAAS,KACqD;EAC9D;EACA,MAAM,CAACE,QAAQ,GAAG,EAAE,CAAC,GAAGH,KAAK,CAACK,KAAK,CAAC,GAAG,CAAC;EACxC,MAAMiB,OAAO,GAAGvB,MAAM,CAACC,KAAK,EAAEC,MAAM,CAAC;;EAErC;EACA,MAAM,IAAAsB,wBAAS,EAACpB,QAAQ,EAAEkB,SAAS,CAAC;;EAEpC;EACA,MAAMG,MAAM,GAAG,CACb,GAAGF,OAAO,CAACd,KAAK,CAACI,OAAO,CAACa,eAAe,CAACC,YAAY,CAACC,GAAG,EACzD,GAAGL,OAAO,CAACd,KAAK,CAACI,OAAO,CAACa,eAAe,CAACD,MAAM,CAACG,GAAG,CACpD;EAED,MAAMC,OAAO,CAACC,GAAG,CACfP,OAAO,CAACT,WAAW,CAACC,GAAG,CACrB,MAAOgB,UAAU,IAAK,MAAM,IAAAC,0BAAgB,EAACD,UAAU,EAAEN,MAAM,CACjE,CACF,CAAC;EAED,OAAOF,OAAO;AAChB,CAAC;AAACH,OAAA,CAAAC,MAAA,GAAAA,MAAA"}
@@ -18,7 +18,10 @@ import { verifyDisclosure } from "./verifier";
18
18
  *
19
19
  */
20
20
  export const decode = (token, schema) => {
21
- // token are expected in the form "sd-jwt~disclosure0~disclosure1~...~disclosureN"
21
+ // token are expected in the form "sd-jwt~disclosure0~disclosure1~...~disclosureN~"
22
+ if (token.slice(-1) === "~") {
23
+ token = token.slice(0, -1);
24
+ }
22
25
  const [rawSdJwt = "", ...rawDisclosures] = token.split("~");
23
26
 
24
27
  // get the sd-jwt as object
@@ -1 +1 @@
1
- {"version":3,"names":["decode","decodeJwt","verify","verifyJwt","decodeBase64","Disclosure","verifyDisclosure","token","schema","rawSdJwt","rawDisclosures","split","decodedJwt","sdJwt","parse","header","protectedHeader","payload","disclosures","map","e","JSON","publicKey","decoded","claims","verified_claims","verification","_sd","Promise","all","disclosure"],"sourceRoot":"../../../src","sources":["sd-jwt/index.ts"],"mappings":"AAEA,SAASA,MAAM,IAAIC,SAAS,QAAQ,6BAA6B;AACjE,SAASC,MAAM,IAAIC,SAAS,QAAQ,6BAA6B;AAEjE,SAASC,YAAY,QAAQ,6BAA6B;AAC1D,SAASC,UAAU,QAAQ,SAAS;AACpC,SAASC,gBAAgB,QAAQ,YAAY;AAG7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMN,MAAM,GAAGA,CACpBO,KAAa,EACbC,MAAS,KAC4C;EACrD;EACA,MAAM,CAACC,QAAQ,GAAG,EAAE,EAAE,GAAGC,cAAc,CAAC,GAAGH,KAAK,CAACI,KAAK,CAAC,GAAG,CAAC;;EAE3D;EACA;EACA,MAAMC,UAAU,GAAGX,SAAS,CAACQ,QAAQ,CAAC;EACtC,MAAMI,KAAK,GAAGL,MAAM,CAACM,KAAK,CAAC;IACzBC,MAAM,EAAEH,UAAU,CAACI,eAAe;IAClCC,OAAO,EAAEL,UAAU,CAACK;EACtB,CAAC,CAAC;;EAEF;EACA;EACA;EACA,MAAMC,WAAW,GAAGR,cAAc,CAC/BS,GAAG,CAACf,YAAY,CAAC,CACjBe,GAAG,CAAEC,CAAC,IAAKC,IAAI,CAACP,KAAK,CAACM,CAAC,CAAC,CAAC,CACzBD,GAAG,CAAEC,CAAC,IAAKf,UAAU,CAACS,KAAK,CAACM,CAAC,CAAC,CAAC;EAElC,OAAO;IAAEP,KAAK;IAAEK;EAAY,CAAC;AAC/B,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMhB,MAAM,GAAG,MAAAA,CACpBK,KAAa,EACbe,SAAc,EACdd,MAAS,KACqD;EAC9D;EACA,MAAM,CAACC,QAAQ,GAAG,EAAE,CAAC,GAAGF,KAAK,CAACI,KAAK,CAAC,GAAG,CAAC;EACxC,MAAMY,OAAO,GAAGvB,MAAM,CAACO,KAAK,EAAEC,MAAM,CAAC;;EAErC;EACA,MAAML,SAAS,CAACM,QAAQ,EAAEa,SAAS,CAAC;;EAEpC;EACA,MAAME,MAAM,GAAG,CACb,GAAGD,OAAO,CAACV,KAAK,CAACI,OAAO,CAACQ,eAAe,CAACC,YAAY,CAACC,GAAG,EACzD,GAAGJ,OAAO,CAACV,KAAK,CAACI,OAAO,CAACQ,eAAe,CAACD,MAAM,CAACG,GAAG,CACpD;EAED,MAAMC,OAAO,CAACC,GAAG,CACfN,OAAO,CAACL,WAAW,CAACC,GAAG,CACrB,MAAOW,UAAU,IAAK,MAAMxB,gBAAgB,CAACwB,UAAU,EAAEN,MAAM,CACjE,CACF,CAAC;EAED,OAAOD,OAAO;AAChB,CAAC"}
1
+ {"version":3,"names":["decode","decodeJwt","verify","verifyJwt","decodeBase64","Disclosure","verifyDisclosure","token","schema","slice","rawSdJwt","rawDisclosures","split","decodedJwt","sdJwt","parse","header","protectedHeader","payload","disclosures","map","e","JSON","publicKey","decoded","claims","verified_claims","verification","_sd","Promise","all","disclosure"],"sourceRoot":"../../../src","sources":["sd-jwt/index.ts"],"mappings":"AAEA,SAASA,MAAM,IAAIC,SAAS,QAAQ,6BAA6B;AACjE,SAASC,MAAM,IAAIC,SAAS,QAAQ,6BAA6B;AAEjE,SAASC,YAAY,QAAQ,6BAA6B;AAC1D,SAASC,UAAU,QAAQ,SAAS;AACpC,SAASC,gBAAgB,QAAQ,YAAY;AAG7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMN,MAAM,GAAGA,CACpBO,KAAa,EACbC,MAAS,KAC4C;EACrD;EACA,IAAID,KAAK,CAACE,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;IAC3BF,KAAK,GAAGA,KAAK,CAACE,KAAK,CAAC,CAAC,EAAE,CAA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fN,OAAO,CAACL,WAAW,CAACC,GAAG,CACrB,MAAOW,UAAU,IAAK,MAAMzB,gBAAgB,CAACyB,UAAU,EAAEN,MAAM,CACjE,CACF,CAAC;EAED,OAAOD,OAAO;AAChB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/sd-jwt/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEzC;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,MAAM,oCACV,MAAM;;iBAEsB,UAAU,EAAE;CAqBhD,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,MAAM,oCACV,MAAM,aACF,GAAG;;iBAE6B,UAAU,EAAE;EAqBxD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/sd-jwt/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEzC;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,MAAM,oCACV,MAAM;;iBAEsB,UAAU,EAAE;CAwBhD,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,MAAM,oCACV,MAAM,aACF,GAAG;;iBAE6B,UAAU,EAAE;EAqBxD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pagopa/io-react-native-wallet",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Provide data structures, helpers and API for IO Wallet",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -26,7 +26,10 @@ export const decode = <S extends z.AnyZodObject>(
26
26
  token: string,
27
27
  schema: S
28
28
  ): { sdJwt: z.infer<S>; disclosures: Disclosure[] } => {
29
- // token are expected in the form "sd-jwt~disclosure0~disclosure1~...~disclosureN"
29
+ // token are expected in the form "sd-jwt~disclosure0~disclosure1~...~disclosureN~"
30
+ if (token.slice(-1) === "~") {
31
+ token = token.slice(0, -1);
32
+ }
30
33
  const [rawSdJwt = "", ...rawDisclosures] = token.split("~");
31
34
 
32
35
  // get the sd-jwt as object