@pagopa/io-react-native-wallet 0.4.3 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +98 -22
- package/lib/commonjs/index.js +12 -8
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/pid/index.js +3 -8
- package/lib/commonjs/pid/index.js.map +1 -1
- package/lib/commonjs/pid/issuing.js +152 -169
- package/lib/commonjs/pid/issuing.js.map +1 -1
- package/lib/commonjs/pid/metadata.js +28 -25
- package/lib/commonjs/pid/metadata.js.map +1 -1
- package/lib/commonjs/rp/__test__/index.test.js +5 -3
- package/lib/commonjs/rp/__test__/index.test.js.map +1 -1
- package/lib/commonjs/rp/index.js +158 -154
- package/lib/commonjs/rp/index.js.map +1 -1
- package/lib/commonjs/trust/types.js +9 -7
- package/lib/commonjs/trust/types.js.map +1 -1
- package/lib/commonjs/utils/crypto.js +46 -0
- package/lib/commonjs/utils/crypto.js.map +1 -0
- package/lib/commonjs/utils/dpop.js +14 -7
- package/lib/commonjs/utils/dpop.js.map +1 -1
- package/lib/commonjs/wallet-instance-attestation/index.js +3 -3
- package/lib/commonjs/wallet-instance-attestation/issuing.js +50 -60
- package/lib/commonjs/wallet-instance-attestation/issuing.js.map +1 -1
- package/lib/module/index.js +4 -3
- package/lib/module/index.js.map +1 -1
- package/lib/module/pid/index.js +1 -1
- package/lib/module/pid/index.js.map +1 -1
- package/lib/module/pid/issuing.js +151 -172
- package/lib/module/pid/issuing.js.map +1 -1
- package/lib/module/pid/metadata.js +28 -25
- package/lib/module/pid/metadata.js.map +1 -1
- package/lib/module/rp/__test__/index.test.js +1 -1
- package/lib/module/rp/__test__/index.test.js.map +1 -1
- package/lib/module/rp/index.js +155 -153
- package/lib/module/rp/index.js.map +1 -1
- package/lib/module/trust/types.js +7 -6
- package/lib/module/trust/types.js.map +1 -1
- package/lib/module/utils/crypto.js +40 -0
- package/lib/module/utils/crypto.js.map +1 -0
- package/lib/module/utils/dpop.js +13 -5
- package/lib/module/utils/dpop.js.map +1 -1
- package/lib/module/wallet-instance-attestation/index.js +2 -2
- package/lib/module/wallet-instance-attestation/index.js.map +1 -1
- package/lib/module/wallet-instance-attestation/issuing.js +48 -58
- package/lib/module/wallet-instance-attestation/issuing.js.map +1 -1
- package/lib/typescript/index.d.ts +4 -3
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/pid/index.d.ts +1 -1
- package/lib/typescript/pid/index.d.ts.map +1 -1
- package/lib/typescript/pid/issuing.d.ts +51 -87
- package/lib/typescript/pid/issuing.d.ts.map +1 -1
- package/lib/typescript/pid/metadata.d.ts +1338 -408
- package/lib/typescript/pid/metadata.d.ts.map +1 -1
- package/lib/typescript/rp/index.d.ts +48 -86
- package/lib/typescript/rp/index.d.ts.map +1 -1
- package/lib/typescript/rp/types.d.ts +413 -57
- package/lib/typescript/rp/types.d.ts.map +1 -1
- package/lib/typescript/sd-jwt/index.d.ts +1 -1
- package/lib/typescript/sd-jwt/index.d.ts.map +1 -1
- package/lib/typescript/trust/types.d.ts +1000 -274
- package/lib/typescript/trust/types.d.ts.map +1 -1
- package/lib/typescript/utils/crypto.d.ts +10 -0
- package/lib/typescript/utils/crypto.d.ts.map +1 -0
- package/lib/typescript/utils/dpop.d.ts +10 -2
- package/lib/typescript/utils/dpop.d.ts.map +1 -1
- package/lib/typescript/wallet-instance-attestation/index.d.ts +2 -2
- package/lib/typescript/wallet-instance-attestation/index.d.ts.map +1 -1
- package/lib/typescript/wallet-instance-attestation/issuing.d.ts +17 -31
- package/lib/typescript/wallet-instance-attestation/issuing.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +5 -3
- package/src/pid/index.ts +1 -1
- package/src/pid/issuing.ts +233 -226
- package/src/pid/metadata.ts +32 -27
- package/src/rp/__test__/index.test.ts +1 -1
- package/src/rp/index.ts +180 -188
- package/src/sd-jwt/index.ts +1 -1
- package/src/trust/types.ts +39 -32
- package/src/utils/crypto.ts +41 -0
- package/src/utils/dpop.ts +17 -7
- package/src/wallet-instance-attestation/index.ts +2 -2
- package/src/wallet-instance-attestation/issuing.ts +55 -62
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../../src/pid/metadata.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../../src/pid/metadata.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AACpE,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAS7B,CAAC;AAEH,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAChD,OAAO,4BAA4B,CACpC,CAAC;AACF,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BxC,CAAC"}
|
@@ -1,89 +1,51 @@
|
|
1
|
+
/// <reference types="react-native" />
|
2
|
+
import { type CryptoContext } from "@pagopa/io-react-native-jwt";
|
1
3
|
import { QRCodePayload, RequestObject, RpEntityConfiguration, type Presentation } from "./types";
|
2
|
-
|
3
|
-
|
4
|
+
/**
|
5
|
+
* Obtain the relying party entity configuration.
|
6
|
+
*/
|
7
|
+
export declare const getEntityConfiguration: ({ appFetch }?: {
|
8
|
+
appFetch?: {
|
9
|
+
(input: RequestInfo, init?: RequestInit | undefined): Promise<Response>;
|
10
|
+
(input: RequestInfo, init?: RequestInit | undefined): Promise<Response>;
|
11
|
+
} | undefined;
|
12
|
+
}) => (relyingPartyBaseUrl: string) => Promise<RpEntityConfiguration>;
|
13
|
+
/**
|
14
|
+
* Decode a QR code content to an authentication request url.
|
15
|
+
* @function
|
16
|
+
* @param qrcode QR code content
|
17
|
+
*
|
18
|
+
* @returns The authentication request url
|
19
|
+
*
|
20
|
+
*/
|
21
|
+
export declare const decodeAuthRequestQR: (qrcode: string) => QRCodePayload;
|
22
|
+
export type RequestObjectConf = {
|
23
|
+
requestObject: RequestObject;
|
24
|
+
rpEntityConfiguration: RpEntityConfiguration;
|
4
25
|
walletInstanceAttestation: string;
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
*
|
31
|
-
* @async @function
|
32
|
-
* @param signedWalletInstanceDPoP JWT of the Wallet Instance Attestation DPoP
|
33
|
-
*
|
34
|
-
* @returns The Request Object JWT
|
35
|
-
* @throws {NoSuitableKeysFoundInEntityConfiguration} When the Request Object is signed with a key not listed in RP's entity configuration
|
36
|
-
*
|
37
|
-
*/
|
38
|
-
getRequestObject(signedWalletInstanceDPoP: string, requestUri: string, entity: RpEntityConfiguration): Promise<RequestObject>;
|
39
|
-
/**
|
40
|
-
* Prepare the Verified Presentation token for a received request object in the context of an authorization request flow.
|
41
|
-
* The presentation is prepared by disclosing data from provided credentials, according to requested claims
|
42
|
-
* Each Verified Credential come along with the claims the user accepts to disclose from it.
|
43
|
-
*
|
44
|
-
* The returned token is unsigned (sign should be apply by the caller).
|
45
|
-
*
|
46
|
-
* @todo accept more than a Verified Credential
|
47
|
-
*
|
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
|
-
* @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
|
52
|
-
* @returns The unsigned Verified Presentation token
|
53
|
-
* @throws {ClaimsNotFoundBetweenDislosures} If the Verified Credential does not contain one or more requested claims.
|
54
|
-
*
|
55
|
-
*/
|
56
|
-
prepareVpToken(requestObj: RequestObject, walletInstanceIdentifier: string, [vc, claims]: Presentation, // TODO: [SIW-353] support multiple presentations,
|
57
|
-
signKeyId: string): Promise<{
|
58
|
-
vp_token: string;
|
59
|
-
presentation_submission: Record<string, unknown>;
|
60
|
-
}>;
|
61
|
-
/**
|
62
|
-
* Compose and send an Authorization Response in the context of an authorization request flow.
|
63
|
-
*
|
64
|
-
* @todo MUST add presentation_submission
|
65
|
-
*
|
66
|
-
* @param requestObj The incoming request object, which the requirements for the requested authorization
|
67
|
-
* @param vp_token The signed Verified Presentation token with data to send.
|
68
|
-
* @param presentation_submission
|
69
|
-
* @param entity The RP entity configuration
|
70
|
-
* @returns The response from the RP
|
71
|
-
* @throws {IoWalletError} if the submission fails.
|
72
|
-
* @throws {NoSuitableKeysFoundInEntityConfiguration} If entity do not contain any public key
|
73
|
-
*
|
74
|
-
*/
|
75
|
-
sendAuthorizationResponse(requestObj: RequestObject, vp_token: string, presentation_submission: Record<string, unknown>, entity: RpEntityConfiguration): Promise<string>;
|
76
|
-
/**
|
77
|
-
* Select a RSA public key from those provided by the RP to encrypt.
|
78
|
-
*
|
79
|
-
* @param entity The RP entity configuration
|
80
|
-
* @returns A suitable public key with its compatible encryption algorithm
|
81
|
-
* @throws {NoSuitableKeysFoundInEntityConfiguration} If entity do not contain any public key suitable for encrypting
|
82
|
-
*/
|
83
|
-
private chooseRSAPublicKeyToEncrypt;
|
84
|
-
/**
|
85
|
-
* Obtain the relying party entity configuration.
|
86
|
-
*/
|
87
|
-
getEntityConfiguration(): Promise<RpEntityConfiguration>;
|
88
|
-
}
|
26
|
+
};
|
27
|
+
/**
|
28
|
+
* Obtain the Request Object for RP authentication
|
29
|
+
* @see https://italia.github.io/eudi-wallet-it-docs/versione-corrente/en/relying-party-solution.html
|
30
|
+
*/
|
31
|
+
export declare const getRequestObject: ({ wiaCryptoContext, appFetch, }: {
|
32
|
+
wiaCryptoContext: CryptoContext;
|
33
|
+
appFetch?: {
|
34
|
+
(input: RequestInfo, init?: RequestInit | undefined): Promise<Response>;
|
35
|
+
(input: RequestInfo, init?: RequestInit | undefined): Promise<Response>;
|
36
|
+
} | undefined;
|
37
|
+
}) => (walletInstanceAttestation: string, requestUri: string, rpEntityConfiguration: RpEntityConfiguration) => Promise<RequestObjectConf>;
|
38
|
+
/**
|
39
|
+
* Compose and send an Authorization Response in the context of an authorization request flow.
|
40
|
+
*
|
41
|
+
* @todo MUST add presentation_submission
|
42
|
+
*
|
43
|
+
*/
|
44
|
+
export declare const sendAuthorizationResponse: ({ pidCryptoContext, appFetch, }: {
|
45
|
+
pidCryptoContext: CryptoContext;
|
46
|
+
appFetch?: {
|
47
|
+
(input: RequestInfo, init?: RequestInit | undefined): Promise<Response>;
|
48
|
+
(input: RequestInfo, init?: RequestInit | undefined): Promise<Response>;
|
49
|
+
} | undefined;
|
50
|
+
}) => ({ requestObject, rpEntityConfiguration, walletInstanceAttestation, }: RequestObjectConf, presentation: Presentation) => Promise<string>;
|
89
51
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/rp/index.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/rp/index.ts"],"names":[],"mappings":";AAKA,OAAO,EAOL,KAAK,aAAa,EACnB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,aAAa,EACb,aAAa,EACb,qBAAqB,EACrB,KAAK,YAAY,EAClB,MAAM,SAAS,CAAC;AAgCjB;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;;4BAEL,MAAM,KAAG,QAAQ,qBAAqB,CAIjE,CAAC;AAEJ;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,WAAY,MAAM,KAAG,aAoBpD,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,aAAa,EAAE,aAAa,CAAC;IAC7B,qBAAqB,EAAE,qBAAqB,CAAC;IAC7C,yBAAyB,EAAE,MAAM,CAAC;CACnC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB;sBAKP,aAAa;;;;;kCAIJ,MAAM,cACrB,MAAM,yBACK,qBAAqB,KAC3C,QAAQ,iBAAiB,CAyD3B,CAAC;AA2DJ;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB;sBAKhB,aAAa;;;;;6EAQ5B,iBAAiB,iCAEnB,QAAQ,MAAM,CAiDhB,CAAC"}
|