@pagopa/io-react-native-wallet 0.2.7 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. package/lib/commonjs/rp/__test__/index.test.js +145 -0
  2. package/lib/commonjs/rp/__test__/index.test.js.map +1 -1
  3. package/lib/commonjs/rp/index.js +33 -41
  4. package/lib/commonjs/rp/index.js.map +1 -1
  5. package/lib/commonjs/rp/types.js +11 -9
  6. package/lib/commonjs/rp/types.js.map +1 -1
  7. package/lib/commonjs/utils/jwk.js +35 -0
  8. package/lib/commonjs/utils/jwk.js.map +1 -1
  9. package/lib/commonjs/wallet-instance-attestation/issuing.js +1 -1
  10. package/lib/commonjs/wallet-instance-attestation/issuing.js.map +1 -1
  11. package/lib/commonjs/wallet-instance-attestation/types.js +6 -2
  12. package/lib/commonjs/wallet-instance-attestation/types.js.map +1 -1
  13. package/lib/module/rp/__test__/index.test.js +145 -0
  14. package/lib/module/rp/__test__/index.test.js.map +1 -1
  15. package/lib/module/rp/index.js +33 -41
  16. package/lib/module/rp/index.js.map +1 -1
  17. package/lib/module/rp/types.js +11 -9
  18. package/lib/module/rp/types.js.map +1 -1
  19. package/lib/module/utils/jwk.js +34 -0
  20. package/lib/module/utils/jwk.js.map +1 -1
  21. package/lib/module/wallet-instance-attestation/issuing.js +2 -2
  22. package/lib/module/wallet-instance-attestation/issuing.js.map +1 -1
  23. package/lib/module/wallet-instance-attestation/types.js +6 -2
  24. package/lib/module/wallet-instance-attestation/types.js.map +1 -1
  25. package/lib/typescript/index.d.ts.map +1 -0
  26. package/lib/typescript/pid/index.d.ts.map +1 -0
  27. package/lib/typescript/pid/issuing.d.ts.map +1 -0
  28. package/lib/typescript/{src/pid → pid}/metadata.d.ts.map +1 -1
  29. package/lib/typescript/pid/sd-jwt/converters.d.ts.map +1 -0
  30. package/lib/typescript/pid/sd-jwt/index.d.ts.map +1 -0
  31. package/lib/typescript/pid/sd-jwt/types.d.ts.map +1 -0
  32. package/lib/typescript/rp/__test__/index.test.d.ts.map +1 -0
  33. package/lib/typescript/{src/rp → rp}/index.d.ts +8 -8
  34. package/lib/typescript/rp/index.d.ts.map +1 -0
  35. package/lib/typescript/rp/types.d.ts +735 -0
  36. package/lib/typescript/{src/rp → rp}/types.d.ts.map +1 -1
  37. package/lib/typescript/sd-jwt/__test__/converters.test.d.ts.map +1 -0
  38. package/lib/typescript/sd-jwt/__test__/index.test.d.ts.map +1 -0
  39. package/lib/typescript/sd-jwt/__test__/types.test.d.ts.map +1 -0
  40. package/lib/typescript/sd-jwt/converters.d.ts.map +1 -0
  41. package/lib/typescript/sd-jwt/index.d.ts.map +1 -0
  42. package/lib/typescript/sd-jwt/types.d.ts.map +1 -0
  43. package/lib/typescript/sd-jwt/verifier.d.ts.map +1 -0
  44. package/lib/typescript/utils/dpop.d.ts.map +1 -0
  45. package/lib/typescript/utils/errors.d.ts.map +1 -0
  46. package/lib/typescript/{src/utils → utils}/jwk.d.ts +9 -0
  47. package/lib/typescript/utils/jwk.d.ts.map +1 -0
  48. package/lib/typescript/wallet-instance-attestation/index.d.ts.map +1 -0
  49. package/lib/typescript/wallet-instance-attestation/issuing.d.ts.map +1 -0
  50. package/lib/typescript/{src/wallet-instance-attestation → wallet-instance-attestation}/types.d.ts +40 -4
  51. package/lib/typescript/{src/wallet-instance-attestation → wallet-instance-attestation}/types.d.ts.map +1 -1
  52. package/package.json +2 -2
  53. package/src/rp/__test__/index.test.ts +222 -0
  54. package/src/rp/index.ts +44 -54
  55. package/src/rp/types.ts +8 -7
  56. package/src/utils/jwk.ts +21 -0
  57. package/src/wallet-instance-attestation/issuing.ts +3 -2
  58. package/src/wallet-instance-attestation/types.ts +6 -2
  59. package/lib/typescript/src/index.d.ts.map +0 -1
  60. package/lib/typescript/src/pid/index.d.ts.map +0 -1
  61. package/lib/typescript/src/pid/issuing.d.ts.map +0 -1
  62. package/lib/typescript/src/pid/sd-jwt/converters.d.ts.map +0 -1
  63. package/lib/typescript/src/pid/sd-jwt/index.d.ts.map +0 -1
  64. package/lib/typescript/src/pid/sd-jwt/types.d.ts.map +0 -1
  65. package/lib/typescript/src/rp/__test__/index.test.d.ts.map +0 -1
  66. package/lib/typescript/src/rp/index.d.ts.map +0 -1
  67. package/lib/typescript/src/rp/types.d.ts +0 -864
  68. package/lib/typescript/src/sd-jwt/__test__/converters.test.d.ts.map +0 -1
  69. package/lib/typescript/src/sd-jwt/__test__/index.test.d.ts.map +0 -1
  70. package/lib/typescript/src/sd-jwt/__test__/types.test.d.ts.map +0 -1
  71. package/lib/typescript/src/sd-jwt/converters.d.ts.map +0 -1
  72. package/lib/typescript/src/sd-jwt/index.d.ts.map +0 -1
  73. package/lib/typescript/src/sd-jwt/types.d.ts.map +0 -1
  74. package/lib/typescript/src/sd-jwt/verifier.d.ts.map +0 -1
  75. package/lib/typescript/src/utils/dpop.d.ts.map +0 -1
  76. package/lib/typescript/src/utils/errors.d.ts.map +0 -1
  77. package/lib/typescript/src/utils/jwk.d.ts.map +0 -1
  78. package/lib/typescript/src/wallet-instance-attestation/index.d.ts.map +0 -1
  79. package/lib/typescript/src/wallet-instance-attestation/issuing.d.ts.map +0 -1
  80. /package/lib/typescript/{src/index.d.ts → index.d.ts} +0 -0
  81. /package/lib/typescript/{src/pid → pid}/index.d.ts +0 -0
  82. /package/lib/typescript/{src/pid → pid}/issuing.d.ts +0 -0
  83. /package/lib/typescript/{src/pid → pid}/metadata.d.ts +0 -0
  84. /package/lib/typescript/{src/pid → pid}/sd-jwt/converters.d.ts +0 -0
  85. /package/lib/typescript/{src/pid → pid}/sd-jwt/index.d.ts +0 -0
  86. /package/lib/typescript/{src/pid → pid}/sd-jwt/types.d.ts +0 -0
  87. /package/lib/typescript/{src/rp → rp}/__test__/index.test.d.ts +0 -0
  88. /package/lib/typescript/{src/sd-jwt → sd-jwt}/__test__/converters.test.d.ts +0 -0
  89. /package/lib/typescript/{src/sd-jwt → sd-jwt}/__test__/index.test.d.ts +0 -0
  90. /package/lib/typescript/{src/sd-jwt → sd-jwt}/__test__/types.test.d.ts +0 -0
  91. /package/lib/typescript/{src/sd-jwt → sd-jwt}/converters.d.ts +0 -0
  92. /package/lib/typescript/{src/sd-jwt → sd-jwt}/index.d.ts +0 -0
  93. /package/lib/typescript/{src/sd-jwt → sd-jwt}/types.d.ts +0 -0
  94. /package/lib/typescript/{src/sd-jwt → sd-jwt}/verifier.d.ts +0 -0
  95. /package/lib/typescript/{src/utils → utils}/dpop.d.ts +0 -0
  96. /package/lib/typescript/{src/utils → utils}/errors.d.ts +0 -0
  97. /package/lib/typescript/{src/wallet-instance-attestation → wallet-instance-attestation}/index.d.ts +0 -0
  98. /package/lib/typescript/{src/wallet-instance-attestation → wallet-instance-attestation}/issuing.d.ts +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/pid/sd-jwt/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAoBxB;;;;;GAKG;AACH,MAAM,MAAM,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,GAAG,CAAC,CAAC;AACtC,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBd,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../../../src/rp/__test__/index.test.ts"],"names":[],"mappings":""}
@@ -1,5 +1,4 @@
1
1
  import { QRCodePayload, RequestObject, RpEntityConfiguration, type Presentation } from "./types";
2
- import type { JWK } from "@pagopa/io-react-native-jwt/lib/typescript/types";
3
2
  export declare class RelyingPartySolution {
4
3
  relyingPartyBaseUrl: string;
5
4
  walletInstanceAttestation: string;
@@ -24,7 +23,7 @@ export declare class RelyingPartySolution {
24
23
  * @returns The unsigned wallet instance DPoP
25
24
  *
26
25
  */
27
- getUnsignedWalletInstanceDPoP(walletInstanceAttestationJwk: JWK, authRequestUrl: string): Promise<string>;
26
+ getUnsignedWalletInstanceDPoP(walletInstanceAttestationJwk: any, authRequestUrl: string): Promise<string>;
28
27
  /**
29
28
  * Obtain the Request Object for RP authentication
30
29
  * @see https://italia.github.io/eudi-wallet-it-docs/versione-corrente/en/relying-party-solution.html
@@ -36,7 +35,7 @@ export declare class RelyingPartySolution {
36
35
  * @throws {NoSuitableKeysFoundInEntityConfiguration} When the Request Object is signed with a key not listed in RP's entity configuration
37
36
  *
38
37
  */
39
- getRequestObject(signedWalletInstanceDPoP: string, entity: RpEntityConfiguration): Promise<RequestObject>;
38
+ getRequestObject(signedWalletInstanceDPoP: string, requestUri: string, entity: RpEntityConfiguration): Promise<RequestObject>;
40
39
  /**
41
40
  * Prepare the Verified Presentation token for a received request object in the context of an authorization request flow.
42
41
  * The presentation is prepared by disclosing data from provided credentials, according to requested claims
@@ -47,12 +46,15 @@ export declare class RelyingPartySolution {
47
46
  * @todo accept more than a Verified Credential
48
47
  *
49
48
  * @param requestObj The incoming request object, which the requirements for the requested authorization
49
+ * @param walletInstanceIdentifier The identifies of the wallt instance that is presenting
50
50
  * @param presentation The Verified Credential containing user data along with the list of claims to be disclosed.
51
+ * @param signKeyId The kid of the key that will be used to sign
51
52
  * @returns The unsigned Verified Presentation token
52
53
  * @throws {ClaimsNotFoundBetweenDislosures} If the Verified Credential does not contain one or more requested claims.
53
54
  *
54
55
  */
55
- prepareVpToken(requestObj: RequestObject, [vc, claims]: Presentation): Promise<{
56
+ prepareVpToken(requestObj: RequestObject, walletInstanceIdentifier: string, [vc, claims]: Presentation, // TODO: [SIW-353] support multiple presentations,
57
+ signKeyId: string): Promise<{
56
58
  vp_token: string;
57
59
  presentation_submission: Record<string, unknown>;
58
60
  }>;
@@ -72,15 +74,13 @@ export declare class RelyingPartySolution {
72
74
  */
73
75
  sendAuthorizationResponse(requestObj: RequestObject, vp_token: string, presentation_submission: Record<string, unknown>, entity: RpEntityConfiguration): Promise<string>;
74
76
  /**
75
- * Select a public key from those provided by the RP.
76
- * Keys with algorithm "RSA-OAEP-256" or "RSA-OAEP" are expected, the firsts to be preferred.
77
+ * Select a RSA public key from those provided by the RP to encrypt.
77
78
  *
78
79
  * @param entity The RP entity configuration
79
80
  * @returns A suitable public key with its compatible encryption algorithm
80
81
  * @throws {NoSuitableKeysFoundInEntityConfiguration} If entity do not contain any public key suitable for encrypting
81
82
  */
82
- private choosePublicKeyToEncrypt;
83
- private getEncryptionAlgByJwk;
83
+ private chooseRSAPublicKeyToEncrypt;
84
84
  /**
85
85
  * Obtain the relying party entity configuration.
86
86
  */
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/rp/index.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,aAAa,EACb,aAAa,EACb,qBAAqB,EACrB,KAAK,YAAY,EAClB,MAAM,SAAS,CAAC;AAMjB,qBAAa,oBAAoB;IAC/B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,yBAAyB,EAAE,MAAM,CAAC;IAClC,QAAQ,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;gBAG7B,mBAAmB,EAAE,MAAM,EAC3B,yBAAyB,EAAE,MAAM,EACjC,QAAQ,GAAE,WAAW,CAAC,OAAO,CAAS;IAOxC;;;;;;;OAOG;IACH,MAAM,CAAC,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa;IAqBzD;;;;;;;;;OASG;IACG,6BAA6B,CACjC,4BAA4B,EAAE,GAAG,EACjC,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,MAAM,CAAC;IAiBlB;;;;;;;;;;OAUG;IACG,gBAAgB,CACpB,wBAAwB,EAAE,MAAM,EAChC,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,aAAa,CAAC;IA2CzB;;;;;;;;;;;;;;;;OAgBG;IACG,cAAc,CAClB,UAAU,EAAE,aAAa,EACzB,wBAAwB,EAAE,MAAM,EAChC,CAAC,EAAE,EAAE,MAAM,CAAC,EAAE,YAAY,EAAE,kDAAkD;IAC9E,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC;QACT,QAAQ,EAAE,MAAM,CAAC;QACjB,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAClD,CAAC;IAoCF;;;;;;;;;;;;;OAaG;IACG,yBAAyB,CAC7B,UAAU,EAAE,aAAa,EACzB,QAAQ,EAAE,MAAM,EAChB,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChD,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,MAAM,CAAC;IAwClB;;;;;;OAMG;IACH,OAAO,CAAC,2BAA2B;IAgBnC;;OAEG;IACG,sBAAsB,IAAI,OAAO,CAAC,qBAAqB,CAAC;CAqB/D"}