@pagopa/io-react-native-wallet 0.4.2 → 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 -168
- 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 -171
- 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 -225
- 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":"types.d.ts","sourceRoot":"","sources":["../../../src/trust/types.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,eAAO,MAAM,SAAS;;;;;;;;;EAAuD,CAAC;AAC9E,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAElD,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAC9D,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAc1B,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AACtE,eAAO,MAAM,mBAAmB
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/trust/types.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,eAAO,MAAM,SAAS;;;;;;;;;EAAuD,CAAC;AAC9E,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AAElD,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAC9D,eAAO,MA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAsB,CAAC"}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { type CryptoContext } from "@pagopa/io-react-native-jwt";
|
2
|
+
/**
|
3
|
+
* Create a CryptoContext bound to a key pair.
|
4
|
+
* Key pair is supposed to exist already in the device's keychain.
|
5
|
+
* It's identified by its unique keytag.
|
6
|
+
*
|
7
|
+
* @returns the crypto context
|
8
|
+
*/
|
9
|
+
export declare const createCryptoContextFor: (keytag: string) => CryptoContext;
|
10
|
+
//# sourceMappingURL=crypto.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../../src/utils/crypto.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAG7E;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,WAAY,MAAM,KAAG,aA6BvD,CAAC"}
|
@@ -1,6 +1,14 @@
|
|
1
1
|
import * as z from "zod";
|
2
|
-
import type
|
3
|
-
|
2
|
+
import { type CryptoContext } from "@pagopa/io-react-native-jwt";
|
3
|
+
/**
|
4
|
+
* Create a signed DPoP token
|
5
|
+
*
|
6
|
+
* @param payload The payload to be included in the token.
|
7
|
+
* @param crypto The crypto context that handles the key bound to the DPoP.
|
8
|
+
*
|
9
|
+
* @returns The signed crypto token.
|
10
|
+
*/
|
11
|
+
export declare const createDPopToken: (payload: DPoPPayload, crypto: CryptoContext) => Promise<string>;
|
4
12
|
export type DPoPPayload = z.infer<typeof DPoPPayload>;
|
5
13
|
export declare const DPoPPayload: z.ZodObject<{
|
6
14
|
jti: z.ZodString;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"dpop.d.ts","sourceRoot":"","sources":["../../../src/utils/dpop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;
|
1
|
+
{"version":3,"file":"dpop.d.ts","sourceRoot":"","sources":["../../../src/utils/dpop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAEzB,OAAO,EAAW,KAAK,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE1E;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,YACjB,WAAW,UACZ,aAAa,KACpB,QAAQ,MAAM,CAWhB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AACtD,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;EAKtB,CAAC"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { WalletInstanceAttestationJwt } from "./types";
|
2
|
-
import {
|
3
|
-
export {
|
2
|
+
import { getAttestation } from "./issuing";
|
3
|
+
export { getAttestation };
|
4
4
|
/**
|
5
5
|
* Decode a given JWT to get the parsed Wallet Instance Attestation object they define.
|
6
6
|
* It ensures provided data is in a valid shape.
|
@@ -1 +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,
|
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,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,CAAC;AAC1B;;;;;;;;;;;;;;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"}
|
@@ -1,32 +1,18 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
* Get the Wallet Instance Attestation given a
|
19
|
-
* Wallet Instance Attestation Request and signature
|
20
|
-
*
|
21
|
-
* @async @function
|
22
|
-
*
|
23
|
-
* @param attestationRequest Wallet Instance Attestaion Request
|
24
|
-
* obtained with {@link getAttestationRequestToSign}
|
25
|
-
* @param signature Signature of the Wallet Instance Attestaion Request
|
26
|
-
*
|
27
|
-
* @returns {string} Wallet Instance Attestation
|
28
|
-
*
|
29
|
-
*/
|
30
|
-
getAttestation(attestationRequest: string, signature: string): Promise<string>;
|
31
|
-
}
|
1
|
+
/// <reference types="react-native" />
|
2
|
+
import { type CryptoContext } from "@pagopa/io-react-native-jwt";
|
3
|
+
/**
|
4
|
+
* Request a Wallet Instance Attestation (WIA) to the Wallet provider
|
5
|
+
*
|
6
|
+
* @param params.wiaCryptoContext The key pair associated with the WIA. Will be use to prove the ownership of the attestation.
|
7
|
+
* @param params.appFetch (optional) Http client
|
8
|
+
* @param walletProviderBaseUrl Base url for the Wallet Provider
|
9
|
+
* @returns The retrieved Wallet Instance Attestation token
|
10
|
+
*/
|
11
|
+
export declare const getAttestation: ({ wiaCryptoContext, appFetch, }: {
|
12
|
+
wiaCryptoContext: CryptoContext;
|
13
|
+
appFetch?: {
|
14
|
+
(input: RequestInfo, init?: RequestInit | undefined): Promise<Response>;
|
15
|
+
(input: RequestInfo, init?: RequestInit | undefined): Promise<Response>;
|
16
|
+
} | undefined;
|
17
|
+
}) => (walletProviderBaseUrl: string) => Promise<string>;
|
32
18
|
//# sourceMappingURL=issuing.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"issuing.d.ts","sourceRoot":"","sources":["../../../src/wallet-instance-attestation/issuing.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"issuing.d.ts","sourceRoot":"","sources":["../../../src/wallet-instance-attestation/issuing.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,6BAA6B,CAAC;AA8CrC;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc;sBAKL,aAAa;;;;;8BAGH,MAAM,KAAG,QAAQ,MAAM,CAqCpD,CAAC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@pagopa/io-react-native-wallet",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.5.0",
|
4
4
|
"description": "Provide data structures, helpers and API for IO Wallet",
|
5
5
|
"main": "lib/commonjs/index",
|
6
6
|
"module": "lib/module/index",
|
@@ -53,7 +53,7 @@
|
|
53
53
|
"devDependencies": {
|
54
54
|
"@pagopa/eslint-config": "^3.0.0",
|
55
55
|
"@pagopa/io-react-native-crypto": "^0.2.3",
|
56
|
-
"@pagopa/io-react-native-jwt": "^0.
|
56
|
+
"@pagopa/io-react-native-jwt": "^1.0.0",
|
57
57
|
"@react-native-community/eslint-config": "^3.2.0",
|
58
58
|
"@rushstack/eslint-patch": "^1.3.2",
|
59
59
|
"@types/jest": "^28.1.2",
|
package/src/index.ts
CHANGED
@@ -6,8 +6,7 @@ import * as PID from "./pid";
|
|
6
6
|
import * as RP from "./rp";
|
7
7
|
import * as Errors from "./utils/errors";
|
8
8
|
import * as WalletInstanceAttestation from "./wallet-instance-attestation";
|
9
|
-
import
|
10
|
-
import { RelyingPartySolution } from "./rp";
|
9
|
+
import * as RelyingPartySolution from "./rp";
|
11
10
|
import { RpEntityConfiguration } from "./rp/types";
|
12
11
|
import { verifyTrustChain, getEntityConfiguration } from "./trust";
|
13
12
|
import {
|
@@ -15,18 +14,21 @@ import {
|
|
15
14
|
EntityStatement,
|
16
15
|
TrustAnchorEntityConfiguration,
|
17
16
|
} from "./trust/types";
|
17
|
+
import { createCryptoContextFor } from "./utils/crypto";
|
18
|
+
import { PidIssuerEntityConfiguration } from "./pid/metadata";
|
18
19
|
|
19
20
|
export {
|
20
21
|
PID,
|
21
22
|
RP,
|
22
23
|
WalletInstanceAttestation,
|
23
24
|
Errors,
|
24
|
-
getUnsignedDPop,
|
25
25
|
RelyingPartySolution,
|
26
26
|
verifyTrustChain,
|
27
27
|
getEntityConfiguration,
|
28
28
|
EntityConfiguration,
|
29
29
|
EntityStatement,
|
30
30
|
RpEntityConfiguration,
|
31
|
+
PidIssuerEntityConfiguration,
|
31
32
|
TrustAnchorEntityConfiguration,
|
33
|
+
createCryptoContextFor,
|
32
34
|
};
|
package/src/pid/index.ts
CHANGED