@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
@@ -366,7 +366,6 @@ export declare const RpEntityConfiguration: z.ZodObject<{
366
366
  }>;
367
367
  contacts: z.ZodArray<z.ZodString, "many">;
368
368
  }, "strip", z.ZodTypeAny, {
369
- client_id: string;
370
369
  jwks: {
371
370
  keys: {
372
371
  kty: "RSA" | "EC";
@@ -393,11 +392,11 @@ export declare const RpEntityConfiguration: z.ZodObject<{
393
392
  x5u?: string | undefined;
394
393
  }[];
395
394
  };
395
+ client_id: string;
396
396
  application_type: string;
397
397
  client_name: string;
398
398
  contacts: string[];
399
399
  }, {
400
- client_id: string;
401
400
  jwks: {
402
401
  keys: {
403
402
  kty: "RSA" | "EC";
@@ -424,6 +423,7 @@ export declare const RpEntityConfiguration: z.ZodObject<{
424
423
  x5u?: string | undefined;
425
424
  }[];
426
425
  };
426
+ client_id: string;
427
427
  application_type: string;
428
428
  client_name: string;
429
429
  contacts: string[];
@@ -436,20 +436,26 @@ export declare const RpEntityConfiguration: z.ZodObject<{
436
436
  contacts: z.ZodArray<z.ZodString, "many">;
437
437
  }, "strip", z.ZodTypeAny, {
438
438
  organization_name: string;
439
- contacts: string[];
440
439
  homepage_uri: string;
441
440
  policy_uri: string;
442
441
  logo_uri: string;
442
+ contacts: string[];
443
443
  }, {
444
444
  organization_name: string;
445
- contacts: string[];
446
445
  homepage_uri: string;
447
446
  policy_uri: string;
448
447
  logo_uri: string;
448
+ contacts: string[];
449
449
  }>;
450
450
  }, "strip", z.ZodTypeAny, {
451
+ federation_entity: {
452
+ organization_name: string;
453
+ homepage_uri: string;
454
+ policy_uri: string;
455
+ logo_uri: string;
456
+ contacts: string[];
457
+ };
451
458
  wallet_relying_party: {
452
- client_id: string;
453
459
  jwks: {
454
460
  keys: {
455
461
  kty: "RSA" | "EC";
@@ -476,20 +482,20 @@ export declare const RpEntityConfiguration: z.ZodObject<{
476
482
  x5u?: string | undefined;
477
483
  }[];
478
484
  };
485
+ client_id: string;
479
486
  application_type: string;
480
487
  client_name: string;
481
488
  contacts: string[];
482
489
  };
490
+ }, {
483
491
  federation_entity: {
484
492
  organization_name: string;
485
- contacts: string[];
486
493
  homepage_uri: string;
487
494
  policy_uri: string;
488
495
  logo_uri: string;
496
+ contacts: string[];
489
497
  };
490
- }, {
491
498
  wallet_relying_party: {
492
- client_id: string;
493
499
  jwks: {
494
500
  keys: {
495
501
  kty: "RSA" | "EC";
@@ -516,17 +522,11 @@ export declare const RpEntityConfiguration: z.ZodObject<{
516
522
  x5u?: string | undefined;
517
523
  }[];
518
524
  };
525
+ client_id: string;
519
526
  application_type: string;
520
527
  client_name: string;
521
528
  contacts: string[];
522
529
  };
523
- federation_entity: {
524
- organization_name: string;
525
- contacts: string[];
526
- homepage_uri: string;
527
- policy_uri: string;
528
- logo_uri: string;
529
- };
530
530
  }>;
531
531
  authority_hints: z.ZodArray<z.ZodString, "many">;
532
532
  }, "strip", z.ZodTypeAny, {
@@ -561,8 +561,14 @@ export declare const RpEntityConfiguration: z.ZodObject<{
561
561
  }[];
562
562
  };
563
563
  metadata: {
564
+ federation_entity: {
565
+ organization_name: string;
566
+ homepage_uri: string;
567
+ policy_uri: string;
568
+ logo_uri: string;
569
+ contacts: string[];
570
+ };
564
571
  wallet_relying_party: {
565
- client_id: string;
566
572
  jwks: {
567
573
  keys: {
568
574
  kty: "RSA" | "EC";
@@ -589,17 +595,11 @@ export declare const RpEntityConfiguration: z.ZodObject<{
589
595
  x5u?: string | undefined;
590
596
  }[];
591
597
  };
598
+ client_id: string;
592
599
  application_type: string;
593
600
  client_name: string;
594
601
  contacts: string[];
595
602
  };
596
- federation_entity: {
597
- organization_name: string;
598
- contacts: string[];
599
- homepage_uri: string;
600
- policy_uri: string;
601
- logo_uri: string;
602
- };
603
603
  };
604
604
  authority_hints: string[];
605
605
  }, {
@@ -634,8 +634,14 @@ export declare const RpEntityConfiguration: z.ZodObject<{
634
634
  }[];
635
635
  };
636
636
  metadata: {
637
+ federation_entity: {
638
+ organization_name: string;
639
+ homepage_uri: string;
640
+ policy_uri: string;
641
+ logo_uri: string;
642
+ contacts: string[];
643
+ };
637
644
  wallet_relying_party: {
638
- client_id: string;
639
645
  jwks: {
640
646
  keys: {
641
647
  kty: "RSA" | "EC";
@@ -662,17 +668,11 @@ export declare const RpEntityConfiguration: z.ZodObject<{
662
668
  x5u?: string | undefined;
663
669
  }[];
664
670
  };
671
+ client_id: string;
665
672
  application_type: string;
666
673
  client_name: string;
667
674
  contacts: string[];
668
675
  };
669
- federation_entity: {
670
- organization_name: string;
671
- contacts: string[];
672
- homepage_uri: string;
673
- policy_uri: string;
674
- logo_uri: string;
675
- };
676
676
  };
677
677
  authority_hints: string[];
678
678
  }>;
@@ -714,8 +714,14 @@ export declare const RpEntityConfiguration: z.ZodObject<{
714
714
  }[];
715
715
  };
716
716
  metadata: {
717
+ federation_entity: {
718
+ organization_name: string;
719
+ homepage_uri: string;
720
+ policy_uri: string;
721
+ logo_uri: string;
722
+ contacts: string[];
723
+ };
717
724
  wallet_relying_party: {
718
- client_id: string;
719
725
  jwks: {
720
726
  keys: {
721
727
  kty: "RSA" | "EC";
@@ -742,17 +748,11 @@ export declare const RpEntityConfiguration: z.ZodObject<{
742
748
  x5u?: string | undefined;
743
749
  }[];
744
750
  };
751
+ client_id: string;
745
752
  application_type: string;
746
753
  client_name: string;
747
754
  contacts: string[];
748
755
  };
749
- federation_entity: {
750
- organization_name: string;
751
- contacts: string[];
752
- homepage_uri: string;
753
- policy_uri: string;
754
- logo_uri: string;
755
- };
756
756
  };
757
757
  authority_hints: string[];
758
758
  };
@@ -794,8 +794,14 @@ export declare const RpEntityConfiguration: z.ZodObject<{
794
794
  }[];
795
795
  };
796
796
  metadata: {
797
+ federation_entity: {
798
+ organization_name: string;
799
+ homepage_uri: string;
800
+ policy_uri: string;
801
+ logo_uri: string;
802
+ contacts: string[];
803
+ };
797
804
  wallet_relying_party: {
798
- client_id: string;
799
805
  jwks: {
800
806
  keys: {
801
807
  kty: "RSA" | "EC";
@@ -822,19 +828,37 @@ export declare const RpEntityConfiguration: z.ZodObject<{
822
828
  x5u?: string | undefined;
823
829
  }[];
824
830
  };
831
+ client_id: string;
825
832
  application_type: string;
826
833
  client_name: string;
827
834
  contacts: string[];
828
835
  };
829
- federation_entity: {
830
- organization_name: string;
831
- contacts: string[];
832
- homepage_uri: string;
833
- policy_uri: string;
834
- logo_uri: string;
835
- };
836
836
  };
837
837
  authority_hints: string[];
838
838
  };
839
839
  }>;
840
+ export type QRCodePayload = z.infer<typeof QRCodePayload>;
841
+ export declare const QRCodePayload: z.ZodObject<{
842
+ protocol: z.ZodLiteral<"eudiw:">;
843
+ resource: z.ZodString;
844
+ clientId: z.ZodString;
845
+ requestURI: z.ZodString;
846
+ }, "strip", z.ZodTypeAny, {
847
+ protocol: "eudiw:";
848
+ resource: string;
849
+ clientId: string;
850
+ requestURI: string;
851
+ }, {
852
+ protocol: "eudiw:";
853
+ resource: string;
854
+ clientId: string;
855
+ requestURI: string;
856
+ }>;
857
+ /**
858
+ * A pair that associate a tokenized Verified Credential with the claims presented or requested to present.
859
+ */
860
+ export type Presentation = [
861
+ string,
862
+ string[]
863
+ ];
840
864
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/rp/types.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAC1D,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoBxB,CAAC;AAGH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AA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IACO,MAAM;IACzB,MAAM,EAAE;CACtB,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"converters.test.d.ts","sourceRoot":"","sources":["../../../../../src/sd-jwt/__test__/converters.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../../../src/sd-jwt/__test__/index.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.test.d.ts","sourceRoot":"","sources":["../../../../../src/sd-jwt/__test__/types.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"converters.d.ts","sourceRoot":"","sources":["../../../../src/sd-jwt/converters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,UAAU,EAAE,EACzB,SAAS,EAAE,MAAM,OAmBlB"}
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { Disclosure } from "./types";
2
+ import { Disclosure, type DisclosureWithEncoded } from "./types";
3
3
  import type { JWK } from "src/utils/jwk";
4
4
  /**
5
5
  * Decode a given SD-JWT with Disclosures to get the parsed SD-JWT object they define.
@@ -17,8 +17,28 @@ import type { JWK } from "src/utils/jwk";
17
17
  */
18
18
  export declare const decode: <S extends z.AnyZodObject>(token: string, schema: S) => {
19
19
  sdJwt: z.TypeOf<S>;
20
- disclosures: Disclosure[];
20
+ disclosures: DisclosureWithEncoded[];
21
21
  };
22
+ /**
23
+ * Select disclosures from a given SD-JWT with Disclosures.
24
+ * Claims relate with disclosures by their name.
25
+ *
26
+ * @function
27
+ * @param token The encoded token that represents a valid sd-jwt for verifiable credentials
28
+ * @param claims The list of claims to be disclosed
29
+ *
30
+ * @throws {ClaimsNotFoundBetweenDislosures} When one or more claims does not relate to any discloure.
31
+ * @throws {ClaimsNotFoundInToken} When one or more claims are not contained in the SD-JWT token.
32
+ * @returns The encoded token with only the requested disclosures, along with the path each claim can be found on the SD-JWT token
33
+ *
34
+ */
35
+ export declare const disclose: (token: string, claims: string[]) => Promise<{
36
+ token: string;
37
+ paths: {
38
+ claim: string;
39
+ path: string;
40
+ }[];
41
+ }>;
22
42
  /**
23
43
  * Verify a given SD-JWT with Disclosures
24
44
  * Same as {@link decode} plus:
@@ -0,0 +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;AAOxB,OAAO,EAAE,UAAU,EAAY,KAAK,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAE3E,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAWzC;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,MAAM,oCACV,MAAM;;iBAIA,qBAAqB,EAAE;CAsBrC,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,QAAQ,UACZ,MAAM,UACL,MAAM,EAAE;WACE,MAAM;WAAS;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE;EA8CnE,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,MAAM,oCACV,MAAM,aACF,GAAG;;iBAE6B,UAAU,EAAE;EAwBxD,CAAC"}
@@ -17,6 +17,18 @@ export declare const ObfuscatedDisclosures: z.ZodObject<{
17
17
  */
18
18
  export type Disclosure = z.infer<typeof Disclosure>;
19
19
  export declare const Disclosure: z.ZodTuple<[z.ZodString, z.ZodString, z.ZodUnknown], null>;
20
+ /**
21
+ * Encoding depends on the serialization algorithm used when generating the disclosure tokens.
22
+ * The SD-JWT reference itself take no decision about how to handle whitespaces in serialized objects.
23
+ * For such reason, we may find conveninent to have encoded and decode values stored explicitly in the same structure.
24
+ * Please note that `encoded` can always decode into `decode`, but `decode` may or may not be encoded with the same value of `encoded`
25
+ *
26
+ * @see https://www.ietf.org/id/draft-ietf-oauth-selective-disclosure-jwt-05.html#name-disclosures-for-object-prop
27
+ */
28
+ export type DisclosureWithEncoded = {
29
+ decoded: Disclosure;
30
+ encoded: string;
31
+ };
20
32
  export type SdJwt4VC = z.infer<typeof SdJwt4VC>;
21
33
  export declare const SdJwt4VC: z.ZodObject<{
22
34
  header: z.ZodObject<{
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/sd-jwt/types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,QAAQ,aAAuC,CAAC;AAC7D,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEhD,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAC1E,eAAO,MAAM,qBAAqB;;;;;;EAAyC,CAAC;AAE5E;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AACpD,eAAO,MAAM,UAAU,4DAIrB,CAAC;AAEH;;;;;;;GAOG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,UAAU,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC;AAChD,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8BnB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { DisclosureWithEncoded, ObfuscatedDisclosures } from "./types";
2
+ export declare const verifyDisclosure: ({ encoded, decoded }: DisclosureWithEncoded, claims: ObfuscatedDisclosures["_sd"]) => Promise<void>;
3
+ //# sourceMappingURL=verifier.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verifier.d.ts","sourceRoot":"","sources":["../../../../src/sd-jwt/verifier.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAE5E,eAAO,MAAM,gBAAgB,yBACL,qBAAqB,UACnC,qBAAqB,CAAC,KAAK,CAAC,kBAUrC,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dpop.d.ts","sourceRoot":"","sources":["../../../../src/utils/dpop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAGzB,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAEjC,eAAO,MAAM,eAAe,QAAS,GAAG,WAAW,WAAW,KAAG,MAWhE,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AACtD,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;EAKtB,CAAC"}
@@ -68,4 +68,45 @@ export declare class PidIssuingError extends IoWalletError {
68
68
  reason: string;
69
69
  constructor(message: string, claim?: string, reason?: string);
70
70
  }
71
+ /**
72
+ * When claims are requested but not found in the credential
73
+ *
74
+ */
75
+ export declare class ClaimsNotFoundBetweenDislosures extends Error {
76
+ static get code(): "ERR_CLAIMS_NOT_FOUND";
77
+ code: string;
78
+ /** The Claims not found */
79
+ claims: string[];
80
+ constructor(claims: string | string[]);
81
+ }
82
+ /**
83
+ * When the SD-JWT does not contain an hashed reference to a given set of claims
84
+ */
85
+ export declare class ClaimsNotFoundInToken extends Error {
86
+ static get code(): "ERR_CLAIMS_NOT_FOUND_IN_TOKEN";
87
+ code: string;
88
+ /** The Claims not found */
89
+ claims: string[];
90
+ constructor(claims: string | string[]);
91
+ }
92
+ /**
93
+ * When selecting a public key from an entity configuration, and no one meets the requirements for the scenario
94
+ *
95
+ */
96
+ export declare class NoSuitableKeysFoundInEntityConfiguration extends Error {
97
+ static get code(): "ERR_NO_SUITABLE_KEYS_NOT_FOUND";
98
+ code: string;
99
+ /**
100
+ * @param scenario describe the scenario in which the error arise
101
+ */
102
+ constructor(scenario: string);
103
+ }
104
+ /**
105
+ * When selecting a public key from an entity configuration, and no one meets the requirements for the scenario
106
+ *
107
+ */
108
+ export declare class PidMetadataError extends Error {
109
+ static get code(): "PID_METADATA_ERROR";
110
+ constructor(message: string);
111
+ }
71
112
  //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../src/utils/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,qBAAa,aAAc,SAAQ,KAAK;IACtC,6DAA6D;IAC7D,MAAM,KAAK,IAAI,IAAI,MAAM,CAExB;IAED,6DAA6D;IAC7D,IAAI,EAAE,MAAM,CAA2B;gBAE3B,OAAO,CAAC,EAAE,MAAM;CAM7B;AACD;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,aAAa;IACjD,MAAM,KAAK,IAAI,IAAI,iCAAiC,CAEnD;IAED,IAAI,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SAAQ,KAAK;IAC9C,MAAM,KAAK,IAAI,IAAI,+BAA+B,CAEjD;IAED,IAAI,SAAmC;IAEvC,2BAA2B;IAC3B,MAAM,EAAE,MAAM,EAAE,CAAC;gBAEL,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE;CAQtC;AAED;;;GAGG;AACH,qBAAa,wCAAyC,SAAQ,KAAK;IACjE,MAAM,KAAK,IAAI,IAAI,gCAAgC,CAElD;IAED,IAAI,SAAoC;IAExC;;OAEG;gBACS,QAAQ,EAAE,MAAM;CAI7B;AAED;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,MAAM,KAAK,IAAI,IAAI,oBAAoB,CAEtC;gBAEW,OAAO,EAAE,MAAM;CAG5B"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jwk.d.ts","sourceRoot":"","sources":["../../../../src/utils/jwk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,MAAM,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,GAAG,CAAC,CAAC;AACtC,eAAO,MAAM,GAAG;IACd,uCAAuC;;;;;;;IAOvC,yCAAyC;;;IAGzC,gDAAgD;;IAEhD,oCAAoC;;IAEpC;;kCAE8B;;;;;;IAM9B,4CAA4C;;;;IAI5C,qDAAqD;;IAErD,gEAAgE;;IAEhE,mEAAmE;;IAEnE,uCAAuC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEvC,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/wallet-instance-attestation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,SAAS,CAAC;AAIvD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,CAAC;AACnB;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,4BAA4B,CAQlE;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,MAAM,CAC1B,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,4BAA4B,CAAC,CAOvC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"issuing.d.ts","sourceRoot":"","sources":["../../../../src/wallet-instance-attestation/issuing.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAKnC,qBAAa,OAAO;IAClB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,QAAQ,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;gBAE7B,qBAAqB,EAAE,MAAM,EAC7B,QAAQ,GAAE,WAAW,CAAC,OAAO,CAAS;IAMxC;;;;;;;;;OASG;IACG,2BAA2B,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC;IA0B5D;;;;;;;;;;;;OAYG;IACG,cAAc,CAClB,kBAAkB,EAAE,MAAM,EAC1B,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC;CAqCnB"}
@@ -574,11 +574,11 @@ export declare const WalletInstanceAttestationJwt: z.ZodObject<{
574
574
  presentation_definition_uri_supported: z.ZodBoolean;
575
575
  }, "strip", z.ZodTypeAny, {
576
576
  type: "WalletInstanceAttestation";
577
+ authorization_endpoint: string;
577
578
  policy_uri: string;
578
- logo_uri: string;
579
579
  tos_uri: string;
580
+ logo_uri: string;
580
581
  asc: string;
581
- authorization_endpoint: string;
582
582
  response_types_supported: string[];
583
583
  vp_formats_supported: {
584
584
  jwt_vp_json: {
@@ -592,11 +592,11 @@ export declare const WalletInstanceAttestationJwt: z.ZodObject<{
592
592
  presentation_definition_uri_supported: boolean;
593
593
  }, {
594
594
  type: "WalletInstanceAttestation";
595
+ authorization_endpoint: string;
595
596
  policy_uri: string;
596
- logo_uri: string;
597
597
  tos_uri: string;
598
+ logo_uri: string;
598
599
  asc: string;
599
- authorization_endpoint: string;
600
600
  response_types_supported: string[];
601
601
  vp_formats_supported: {
602
602
  jwt_vp_json: {
@@ -652,11 +652,11 @@ export declare const WalletInstanceAttestationJwt: z.ZodObject<{
652
652
  };
653
653
  } & {
654
654
  type: "WalletInstanceAttestation";
655
+ authorization_endpoint: string;
655
656
  policy_uri: string;
656
- logo_uri: string;
657
657
  tos_uri: string;
658
+ logo_uri: string;
658
659
  asc: string;
659
- authorization_endpoint: string;
660
660
  response_types_supported: string[];
661
661
  vp_formats_supported: {
662
662
  jwt_vp_json: {
@@ -712,11 +712,11 @@ export declare const WalletInstanceAttestationJwt: z.ZodObject<{
712
712
  };
713
713
  } & {
714
714
  type: "WalletInstanceAttestation";
715
+ authorization_endpoint: string;
715
716
  policy_uri: string;
716
- logo_uri: string;
717
717
  tos_uri: string;
718
+ logo_uri: string;
718
719
  asc: string;
719
- authorization_endpoint: string;
720
720
  response_types_supported: string[];
721
721
  vp_formats_supported: {
722
722
  jwt_vp_json: {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/wallet-instance-attestation/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAwBzB,MAAM,MAAM,mCAAmC,GAAG,CAAC,CAAC,KAAK,CACvD,OAAO,mCAAmC,CAC3C,CAAC;AACF,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAc9C,CAAC;AAEH,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAChD,OAAO,4BAA4B,CACpC,CAAC;AACF,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6BvC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pagopa/io-react-native-wallet",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Provide data structures, helpers and API for IO Wallet",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -52,7 +52,8 @@
52
52
  },
53
53
  "devDependencies": {
54
54
  "@pagopa/eslint-config": "^3.0.0",
55
- "@pagopa/io-react-native-jwt": "^0.4.0",
55
+ "@pagopa/io-react-native-crypto": "^0.2.3",
56
+ "@pagopa/io-react-native-jwt": "^0.6.0",
56
57
  "@react-native-community/eslint-config": "^3.2.0",
57
58
  "@rushstack/eslint-patch": "^1.3.2",
58
59
  "@types/jest": "^28.1.2",
@@ -61,20 +62,20 @@
61
62
  "del-cli": "^5.0.0",
62
63
  "eslint": "^8.4.1",
63
64
  "jest": "^28.1.1",
65
+ "js-sha256": "^0.9.0",
64
66
  "pod-install": "^0.1.0",
65
67
  "prettier": "^2.0.5",
66
68
  "react": "18.2.0",
67
69
  "react-native": "0.71.8",
68
70
  "react-native-builder-bob": "^0.20.0",
69
- "typescript": "^5.0.2",
70
- "@pagopa/io-react-native-crypto": "^0.2.3"
71
+ "typescript": "^5.0.2"
71
72
  },
72
73
  "resolutions": {
73
74
  "@types/react": "17.0.21"
74
75
  },
75
76
  "peerDependencies": {
76
- "@pagopa/io-react-native-jwt": "*",
77
77
  "@pagopa/io-react-native-crypto": "*",
78
+ "@pagopa/io-react-native-jwt": "^0.5.0",
78
79
  "react": "*",
79
80
  "react-native": "*"
80
81
  },
@@ -104,6 +105,7 @@
104
105
  ]
105
106
  },
106
107
  "dependencies": {
108
+ "react-native-url-polyfill": "^2.0.0",
107
109
  "react-native-uuid": "^2.0.1",
108
110
  "zod": "^3.21.4"
109
111
  }
package/src/index.ts CHANGED
@@ -1,7 +1,19 @@
1
+ // polyfill due to known bugs on URL implementation for react native
2
+ // https://github.com/facebook/react-native/issues/24428
3
+ import "react-native-url-polyfill/auto";
4
+
1
5
  import * as PID from "./pid";
2
6
  import * as RP from "./rp";
3
7
  import * as Errors from "./utils/errors";
4
8
  import * as WalletInstanceAttestation from "./wallet-instance-attestation";
5
9
  import { getUnsignedDPop } from "./utils/dpop";
10
+ import { RelyingPartySolution } from "./rp";
6
11
 
7
- export { PID, RP, WalletInstanceAttestation, Errors, getUnsignedDPop };
12
+ export {
13
+ PID,
14
+ RP,
15
+ WalletInstanceAttestation,
16
+ Errors,
17
+ getUnsignedDPop,
18
+ RelyingPartySolution,
19
+ };
@@ -1,14 +1,16 @@
1
1
  import {
2
2
  decode as decodeJwt,
3
+ verify as verifyJwt,
3
4
  sha256ToBase64,
4
5
  } from "@pagopa/io-react-native-jwt";
5
6
 
6
7
  import { SignJWT, thumbprint } from "@pagopa/io-react-native-jwt";
7
8
  import { JWK } from "../utils/jwk";
8
9
  import uuid from "react-native-uuid";
9
- import { PidIssuingError } from "../utils/errors";
10
+ import { PidIssuingError, PidMetadataError } from "../utils/errors";
10
11
  import { getUnsignedDPop } from "../utils/dpop";
11
12
  import { sign, generate, deleteKey } from "@pagopa/io-react-native-crypto";
13
+ import { PidIssuerEntityConfiguration } from "./metadata";
12
14
 
13
15
  // This is a temporary type that will be used for demo purposes only
14
16
  export type CieData = {
@@ -302,4 +304,39 @@ export class Issuing {
302
304
 
303
305
  throw new PidIssuingError(`Unable to obtain credential!`);
304
306
  }
307
+
308
+ /**
309
+ * Obtain the PID issuer metadata
310
+ *
311
+ * @function
312
+ * @returns PID issuer metadata
313
+ *
314
+ */
315
+ async getEntityConfiguration(): Promise<PidIssuerEntityConfiguration> {
316
+ const metadataUrl = new URL(
317
+ ".well-known/openid-federation",
318
+ this.pidProviderBaseUrl
319
+ ).href;
320
+
321
+ const response = await this.appFetch(metadataUrl);
322
+
323
+ if (response.status === 200) {
324
+ const jwtMetadata = await response.text();
325
+ const { payload } = decodeJwt(jwtMetadata);
326
+ const result = PidIssuerEntityConfiguration.safeParse(payload);
327
+ if (result.success) {
328
+ const parsedMetadata = result.data;
329
+ await verifyJwt(jwtMetadata, parsedMetadata.jwks.keys);
330
+ return parsedMetadata;
331
+ } else {
332
+ throw new PidMetadataError(result.error.message);
333
+ }
334
+ }
335
+
336
+ throw new PidMetadataError(
337
+ `Unable to obtain PID metadata. Response: ${await response.text()} with status: ${
338
+ response.status
339
+ }`
340
+ );
341
+ }
305
342
  }