@pagopa/io-react-native-wallet 0.2.8 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) 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/rp/index.d.ts +8 -8
  26. package/lib/typescript/rp/index.d.ts.map +1 -1
  27. package/lib/typescript/rp/types.d.ts +260 -389
  28. package/lib/typescript/rp/types.d.ts.map +1 -1
  29. package/lib/typescript/utils/jwk.d.ts +9 -0
  30. package/lib/typescript/utils/jwk.d.ts.map +1 -1
  31. package/lib/typescript/wallet-instance-attestation/issuing.d.ts.map +1 -1
  32. package/lib/typescript/wallet-instance-attestation/types.d.ts +40 -4
  33. package/lib/typescript/wallet-instance-attestation/types.d.ts.map +1 -1
  34. package/package.json +2 -2
  35. package/src/rp/__test__/index.test.ts +222 -0
  36. package/src/rp/index.ts +44 -54
  37. package/src/rp/types.ts +8 -7
  38. package/src/utils/jwk.ts +21 -0
  39. package/src/wallet-instance-attestation/issuing.ts +3 -2
  40. package/src/wallet-instance-attestation/types.ts +6 -2
@@ -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
  */
@@ -1 +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;AAGjB,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kDAAkD,CAAC;AAG5E,qBAAa,oBAAoB;IAC/B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,yBAAyB,EAAE,MAAM,CAAC;IAClC,QAAQ,EAA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