@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
@@ -5,61 +5,51 @@ import { JWK, fixBase64EncodingOnKey } from "../utils/jwk";
|
|
5
5
|
import { WalletInstanceAttestationRequestJwt } from "./types";
|
6
6
|
import uuid from "react-native-uuid";
|
7
7
|
import { WalletInstanceAttestationIssuingError } from "../utils/errors";
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
cnf: {
|
38
|
-
jwk: fixBase64EncodingOnKey(publicKey)
|
39
|
-
}
|
40
|
-
}).setProtectedHeader({
|
41
|
-
alg: "ES256",
|
42
|
-
kid: publicKey.kid,
|
43
|
-
typ: "wiar+jwt"
|
44
|
-
}).setIssuedAt().setExpirationTime("1h").toSign();
|
45
|
-
return walletInstanceAttestationRequest;
|
46
|
-
}
|
8
|
+
async function getAttestationRequest(wiaCryptoContext, walletProviderBaseUrl) {
|
9
|
+
const jwk = await wiaCryptoContext.getPublicKey();
|
10
|
+
const parsedJwk = JWK.parse(jwk);
|
11
|
+
const keyThumbprint = await thumbprint(parsedJwk);
|
12
|
+
const publicKey = {
|
13
|
+
...parsedJwk,
|
14
|
+
kid: keyThumbprint
|
15
|
+
};
|
16
|
+
return new SignJWT(wiaCryptoContext).setPayload({
|
17
|
+
iss: keyThumbprint,
|
18
|
+
aud: walletProviderBaseUrl,
|
19
|
+
jti: `${uuid.v4()}`,
|
20
|
+
nonce: `${uuid.v4()}`,
|
21
|
+
cnf: {
|
22
|
+
jwk: fixBase64EncodingOnKey(publicKey)
|
23
|
+
}
|
24
|
+
}).setProtectedHeader({
|
25
|
+
kid: publicKey.kid,
|
26
|
+
typ: "wiar+jwt"
|
27
|
+
}).setPayload({
|
28
|
+
iss: keyThumbprint,
|
29
|
+
sub: walletProviderBaseUrl,
|
30
|
+
jti: `${uuid.v4()}`,
|
31
|
+
type: "WalletInstanceAttestationRequest",
|
32
|
+
cnf: {
|
33
|
+
jwk: fixBase64EncodingOnKey(publicKey)
|
34
|
+
}
|
35
|
+
}).setIssuedAt().setExpirationTime("1h").sign();
|
36
|
+
}
|
47
37
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
async
|
62
|
-
const signedAttestationRequest = await
|
38
|
+
/**
|
39
|
+
* Request a Wallet Instance Attestation (WIA) to the Wallet provider
|
40
|
+
*
|
41
|
+
* @param params.wiaCryptoContext The key pair associated with the WIA. Will be use to prove the ownership of the attestation.
|
42
|
+
* @param params.appFetch (optional) Http client
|
43
|
+
* @param walletProviderBaseUrl Base url for the Wallet Provider
|
44
|
+
* @returns The retrieved Wallet Instance Attestation token
|
45
|
+
*/
|
46
|
+
export const getAttestation = _ref => {
|
47
|
+
let {
|
48
|
+
wiaCryptoContext,
|
49
|
+
appFetch = fetch
|
50
|
+
} = _ref;
|
51
|
+
return async walletProviderBaseUrl => {
|
52
|
+
const signedAttestationRequest = await getAttestationRequest(wiaCryptoContext, walletProviderBaseUrl);
|
63
53
|
const decodedRequest = decodeJwt(signedAttestationRequest);
|
64
54
|
const parsedRequest = WalletInstanceAttestationRequestJwt.parse({
|
65
55
|
payload: decodedRequest.payload,
|
@@ -67,12 +57,12 @@ export class Issuing {
|
|
67
57
|
});
|
68
58
|
const publicKey = parsedRequest.payload.cnf.jwk;
|
69
59
|
await verifyJwt(signedAttestationRequest, publicKey);
|
70
|
-
const tokenUrl = new URL("token",
|
60
|
+
const tokenUrl = new URL("token", walletProviderBaseUrl).href;
|
71
61
|
const requestBody = {
|
72
62
|
grant_type: "urn:ietf:params:oauth:client-assertion-type:jwt-client-attestation",
|
73
63
|
assertion: signedAttestationRequest
|
74
64
|
};
|
75
|
-
const response = await
|
65
|
+
const response = await appFetch(tokenUrl, {
|
76
66
|
method: "POST",
|
77
67
|
headers: {
|
78
68
|
"Content-Type": "application/json"
|
@@ -83,6 +73,6 @@ export class Issuing {
|
|
83
73
|
return await response.text();
|
84
74
|
}
|
85
75
|
throw new WalletInstanceAttestationIssuingError("Unable to obtain wallet instance attestation from wallet provider", `Response code: ${response.status}`);
|
86
|
-
}
|
87
|
-
}
|
76
|
+
};
|
77
|
+
};
|
88
78
|
//# sourceMappingURL=issuing.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["decode","decodeJwt","verify","verifyJwt","SignJWT","thumbprint","JWK","fixBase64EncodingOnKey","WalletInstanceAttestationRequestJwt","uuid","WalletInstanceAttestationIssuingError","
|
1
|
+
{"version":3,"names":["decode","decodeJwt","verify","verifyJwt","SignJWT","thumbprint","JWK","fixBase64EncodingOnKey","WalletInstanceAttestationRequestJwt","uuid","WalletInstanceAttestationIssuingError","getAttestationRequest","wiaCryptoContext","walletProviderBaseUrl","jwk","getPublicKey","parsedJwk","parse","keyThumbprint","publicKey","kid","setPayload","iss","aud","jti","v4","nonce","cnf","setProtectedHeader","typ","sub","type","setIssuedAt","setExpirationTime","sign","getAttestation","_ref","appFetch","fetch","signedAttestationRequest","decodedRequest","parsedRequest","payload","header","protectedHeader","tokenUrl","URL","href","requestBody","grant_type","assertion","response","method","headers","body","JSON","stringify","status","text"],"sourceRoot":"../../../src","sources":["wallet-instance-attestation/issuing.ts"],"mappings":"AAAA,SAEEA,MAAM,IAAIC,SAAS,QACd,6BAA6B;AACpC,SAASC,MAAM,IAAIC,SAAS,QAAQ,6BAA6B;AACjE,SAASC,OAAO,EAAEC,UAAU,QAAQ,6BAA6B;AACjE,SAASC,GAAG,EAAEC,sBAAsB,QAAQ,cAAc;AAC1D,SAASC,mCAAmC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
|
import * as WalletInstanceAttestation from "./wallet-instance-attestation";
|
6
|
-
import
|
7
|
-
import { RelyingPartySolution } from "./rp";
|
6
|
+
import * as RelyingPartySolution from "./rp";
|
8
7
|
import { RpEntityConfiguration } from "./rp/types";
|
9
8
|
import { verifyTrustChain, getEntityConfiguration } from "./trust";
|
10
9
|
import { EntityConfiguration, EntityStatement, TrustAnchorEntityConfiguration } from "./trust/types";
|
11
|
-
|
10
|
+
import { createCryptoContextFor } from "./utils/crypto";
|
11
|
+
import { PidIssuerEntityConfiguration } from "./pid/metadata";
|
12
|
+
export { PID, RP, WalletInstanceAttestation, Errors, RelyingPartySolution, verifyTrustChain, getEntityConfiguration, EntityConfiguration, EntityStatement, RpEntityConfiguration, PidIssuerEntityConfiguration, TrustAnchorEntityConfiguration, createCryptoContextFor, };
|
12
13
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,gCAAgC,CAAC;AAExC,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,MAAM,CAAC;AAC3B,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAC;AACzC,OAAO,KAAK,yBAAyB,MAAM,+BAA+B,CAAC;AAC3E,OAAO,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,gCAAgC,CAAC;AAExC,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,MAAM,CAAC;AAC3B,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAC;AACzC,OAAO,KAAK,yBAAyB,MAAM,+BAA+B,CAAC;AAC3E,OAAO,KAAK,oBAAoB,MAAM,MAAM,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AACnE,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,8BAA8B,EAC/B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAC;AAE9D,OAAO,EACL,GAAG,EACH,EAAE,EACF,yBAAyB,EACzB,MAAM,EACN,oBAAoB,EACpB,gBAAgB,EAChB,sBAAsB,EACtB,mBAAmB,EACnB,eAAe,EACf,qBAAqB,EACrB,4BAA4B,EAC5B,8BAA8B,EAC9B,sBAAsB,GACvB,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/pid/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,UAAU,CAAC;AAClC,OAAO,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/pid/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,UAAU,CAAC;AAClC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC"}
|
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
/// <reference types="react-native" />
|
2
|
+
import { type CryptoContext } from "@pagopa/io-react-native-jwt";
|
2
3
|
import { PidIssuerEntityConfiguration } from "./metadata";
|
3
4
|
export type CieData = {
|
4
5
|
birthDate: string;
|
@@ -6,9 +7,13 @@ export type CieData = {
|
|
6
7
|
name: string;
|
7
8
|
surname: string;
|
8
9
|
};
|
9
|
-
export type
|
10
|
-
|
11
|
-
|
10
|
+
export type AuthorizationConf = {
|
11
|
+
accessToken: string;
|
12
|
+
nonce: string;
|
13
|
+
clientId: string;
|
14
|
+
authorizationCode: string;
|
15
|
+
codeVerifier: string;
|
16
|
+
walletProviderBaseUrl: string;
|
12
17
|
};
|
13
18
|
export type PidResponse = {
|
14
19
|
credential: string;
|
@@ -16,87 +21,46 @@ export type PidResponse = {
|
|
16
21
|
c_nonce_expires_in: number;
|
17
22
|
format: string;
|
18
23
|
};
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
* Make an auth token request to the PID issuer
|
62
|
-
*
|
63
|
-
* @function
|
64
|
-
* @returns a token response
|
65
|
-
*
|
66
|
-
*/
|
67
|
-
getAuthToken(): Promise<TokenResponse>;
|
68
|
-
/**
|
69
|
-
* Return the unsigned jwt for nonce proof of possession
|
70
|
-
*
|
71
|
-
* @function
|
72
|
-
* @param nonce the nonce
|
73
|
-
*
|
74
|
-
* @returns Unsigned JWT for nonce proof
|
75
|
-
*
|
76
|
-
*/
|
77
|
-
getUnsignedNonceProof(nonce: string): Promise<string>;
|
78
|
-
/**
|
79
|
-
* Make the credential issuing request to the PID issuer
|
80
|
-
*
|
81
|
-
* @function
|
82
|
-
* @param unsignedDPopForPid The unsigned JWT for PID DPoP
|
83
|
-
* @param dPopPidSignature The JWT for PID DPoP signature
|
84
|
-
* @param unsignedNonceProof The unsigned JWT for nonce proof
|
85
|
-
* @param nonceProofSignature The JWT for nonce proof signature
|
86
|
-
* @param accessToken The access token obtained with getAuthToken
|
87
|
-
* @param cieData Personal data read by the CIE
|
88
|
-
*
|
89
|
-
* @returns a credential
|
90
|
-
*
|
91
|
-
*/
|
92
|
-
getCredential(unsignedDPopForPid: string, dPopPidSignature: string, unsignedNonceProof: string, nonceProofSignature: string, accessToken: string, cieData: CieData): Promise<PidResponse>;
|
93
|
-
/**
|
94
|
-
* Obtain the PID issuer metadata
|
95
|
-
*
|
96
|
-
* @function
|
97
|
-
* @returns PID issuer metadata
|
98
|
-
*
|
99
|
-
*/
|
100
|
-
getEntityConfiguration(): Promise<PidIssuerEntityConfiguration>;
|
101
|
-
}
|
24
|
+
/**
|
25
|
+
* Obtain the PID provider entity configuration.
|
26
|
+
*/
|
27
|
+
export declare const getEntityConfiguration: ({ appFetch }?: {
|
28
|
+
appFetch?: {
|
29
|
+
(input: RequestInfo, init?: RequestInit | undefined): Promise<Response>;
|
30
|
+
(input: RequestInfo, init?: RequestInit | undefined): Promise<Response>;
|
31
|
+
} | undefined;
|
32
|
+
}) => (relyingPartyBaseUrl: string) => Promise<PidIssuerEntityConfiguration>;
|
33
|
+
/**
|
34
|
+
* Start the issuing flow by generating an authorization request to the PID Provider. Obtain from the PID Provider an access token to be used to complete the issuing flow.
|
35
|
+
*
|
36
|
+
* @param params.wiaCryptoContext The key pair associated with the WIA. Will be use to prove the ownership of the attestation.
|
37
|
+
* @param params.appFetch (optional) Http client
|
38
|
+
* @param walletInstanceAttestation Wallet Instance Attestation token.
|
39
|
+
* @param walletProviderBaseUrl Base url for the Wallet Provider
|
40
|
+
* @param pidProviderEntityConfiguration The Entity Configuration of the PID Provider, from which discover public endooints.
|
41
|
+
* @returns The access token along with the values that identify the issuing session.
|
42
|
+
*/
|
43
|
+
export declare const authorizeIssuing: ({ wiaCryptoContext, appFetch, }: {
|
44
|
+
wiaCryptoContext: CryptoContext;
|
45
|
+
appFetch?: {
|
46
|
+
(input: RequestInfo, init?: RequestInit | undefined): Promise<Response>;
|
47
|
+
(input: RequestInfo, init?: RequestInit | undefined): Promise<Response>;
|
48
|
+
} | undefined;
|
49
|
+
}) => (walletInstanceAttestation: string, walletProviderBaseUrl: string, pidProviderEntityConfiguration: PidIssuerEntityConfiguration) => Promise<AuthorizationConf>;
|
50
|
+
/**
|
51
|
+
* Complete the issuing flow and get the PID credential.
|
52
|
+
*
|
53
|
+
* @param params.pidCryptoContext The key pair associated with the PID. Will be use to prove the ownership of the credential.
|
54
|
+
* @param params.appFetch (optional) Http client
|
55
|
+
* @param authConf The authorization configuration retrieved with the access token
|
56
|
+
* @param cieData Data red from the CIE login process
|
57
|
+
* @returns The PID credential token
|
58
|
+
*/
|
59
|
+
export declare const getCredential: ({ pidCryptoContext, appFetch, }: {
|
60
|
+
pidCryptoContext: CryptoContext;
|
61
|
+
appFetch?: {
|
62
|
+
(input: RequestInfo, init?: RequestInit | undefined): Promise<Response>;
|
63
|
+
(input: RequestInfo, init?: RequestInit | undefined): Promise<Response>;
|
64
|
+
} | undefined;
|
65
|
+
}) => ({ nonce, accessToken, clientId, walletProviderBaseUrl }: AuthorizationConf, pidProviderEntityConfiguration: PidIssuerEntityConfiguration, cieData: CieData) => Promise<PidResponse>;
|
102
66
|
//# sourceMappingURL=issuing.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"issuing.d.ts","sourceRoot":"","sources":["../../../src/pid/issuing.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"issuing.d.ts","sourceRoot":"","sources":["../../../src/pid/issuing.ts"],"names":[],"mappings":";AAAA,OAAO,EAEL,KAAK,aAAa,EAGnB,MAAM,6BAA6B,CAAC;AAKrC,OAAO,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAC;AAQ1D,MAAM,MAAM,OAAO,GAAG;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,qBAAqB,EAAE,MAAM,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;;4BAGV,MAAM,KAC1B,QAAQ,4BAA4B,CAItC,CAAC;AA6FJ;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB;sBAKP,aAAa;;;;;kCAIJ,MAAM,yBACV,MAAM,kCACG,4BAA4B,KAC3D,QAAQ,iBAAiB,CAqE3B,CAAC;AAyBJ;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa;sBAKJ,aAAa;;;;;gEAI0B,iBAAiB,kCAC1C,4BAA4B,WACnD,OAAO,KACf,QAAQ,WAAW,CAqDrB,CAAC"}
|