@pagopa/io-react-native-wallet 0.17.0 → 0.17.1

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -1,251 +1,200 @@
1
1
  # 🪪 @pagopa/io-react-native-wallet
2
2
 
3
- 📲 Provide data structures, helpers, and API to Wallet Instance.
3
+ Library which provides a high level abstraction to interact with the IT-Wallet ecosystem via a predefined flows, a set of utilities and helpers.
4
+ Follows the [eudi-wallet-it-docs](https://github.com/italia/eudi-wallet-it-docs) specifications, currently aligned with version [0.7.1](https://github.com/italia/eudi-wallet-it-docs/releases/tag/0.7.1).
4
5
 
5
- Depends on [@pagopa/io-react-native-jwt](https://github.com/pagopa/io-react-native-jwt)
6
+ ## Dependencies
7
+
8
+ - [@pagopa/io-react-native-jwt](https://github.com/pagopa/io-react-native-jwt) is used to manage JWT tokens;
9
+ - [@pagopa/react-native-cie](https://github.com/pagopa/io-cie-sdk) is used to manage CIE authentication;
10
+ - [react-native-webview](https://github.com/react-native-webview/react-native-webview) is used to manage the webview for the CIE authentication flow.
6
11
 
7
12
  ## Installation
8
13
 
9
14
  ```sh
10
- # First install JWT dependency if you don't have it
11
- npm install @pagopa/io-react-native-jwt
15
+ # Install the required dependencies specified in the peerDependencies of the package.json
12
16
 
13
- npm install @pagopa/io-react-native-wallet
17
+ # Library
18
+ yarn install @pagopa/io-react-native-wallet
14
19
  ```
15
20
 
16
- ## Usage
21
+ ## Contexts
22
+
23
+ The library makes use of contexts to delegate certain aspects of the implementation to the application. Some of these aspects might greatly vary depending on the consumer application. This allows the library to be more flexible by not forcing the application to use a specific implementation and also to focus on the core functionalities.
17
24
 
18
- Refer to Example App for actual usages.
25
+ Currently the library uses the following contexts:
19
26
 
20
27
  <details>
21
- <summary>Handling cryptographic assets</summary>
28
+ <summary>CryptoContext (cryptographic assets handling)</summary>
22
29
 
23
30
  User flows implementions make use of tokens signed using asymmetric key pairs. Such cryptographic keys are managed by the device according to its specifications. It's not the intention of this package to handle such cryptographic assets and their peculiarities; instead, an handy interface is used to provide the right abstraction to allow responsibilities segregation:
24
31
 
25
- - the application knows who to generate/store/delete keys;
26
- - the package knows when and where to use them.
32
+ - The application knows who to generate/store/delete keys;
33
+ - The package knows when and where to use them.
27
34
 
28
- The interface is `CryptoContext` inherited from the `@pagopa/io-react-native-jwt` package.
35
+ The interface is `CryptoContext` inherited from the `@pagopa/io-react-native-jwt` package:
29
36
 
30
- This package provides an helper to build a `CryptoContext` object bound to a given key tag
37
+ The suggested library to manage cryptographic assets is [io-react-native-crypto](https://github.com/pagopa/io-react-native-crypto).
31
38
 
32
39
  ```ts
33
- import { createCryptoContextFor } from "@pagopa/io-react-native-wallet";
34
-
35
- const ctx = createCryptoContextFor("my-tag");
40
+ export interface CryptoContext {
41
+ /**
42
+ * Retrieves the public key to be used in this context.
43
+ * MUST be the same key at every invocation.
44
+ * @returns The public key to be used
45
+ * @throws If no keys are found
46
+ */
47
+ getPublicKey: () => Promise<JWK>;
48
+ /**
49
+ * Produce a cryptographic signature for a given value.
50
+ * The signature MUST be produced using the private key paired with the public retrieved by getPublicKey()
51
+ * @param value The value to be signed
52
+ * @returns The signature
53
+ * @throws If no keys are found
54
+ */
55
+ getSignature: (value: string) => Promise<string>;
56
+ }
36
57
  ```
37
58
 
38
- Be sure the key for `my-tag` already exists.
39
-
40
- </details>
41
-
42
- <details>
43
- <summary>Making HTTP requests</summary>
44
-
45
- This package is compatibile with any http client which implements [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API). Functions that makes http requests allow for an optional `appFetch` parameter to provide a custom http client implementation. If not provided, the built-in implementation on the runtime is used.
46
-
47
- </details>
48
-
49
- ### Credential
50
-
51
- Credential Issuance and Presentation flows are defined in under `src/credential/issuance` and `src/credential/presentation`.
52
- Each flow exposes in the public API a function definition for each step. Some step also has an implementation; for those that have no implementation, the App is expected to fullfil.
53
-
54
- #### Issuance
59
+ This package provides an helper to build a `CryptoContext` object bound to a given key tag
55
60
 
56
61
  ```ts
57
- import { Credential } from "@pagopa/io-react-native-wallet";
58
-
59
- // Retrieve Issuer configuration and evaluate trust
60
- const { issuerConf } = await Credential.Issuance.evaluateIssuerTrust(...);
61
-
62
- // Obtain the directions to perform user authorization
63
- const { clientId, requestUri } = await Credential.Issuance.startUserAuthorization(...);
64
-
65
-
62
+ import { createCryptoContextFor } from "@pagopa/io-react-native-wallet";
66
63
 
64
+ const ctx = createCryptoContextFor("my-tag");
67
65
  ```
68
66
 
69
- #### Encode and Decode
70
-
71
- ```ts
72
- import { PID } from "@pagopa/io-react-native-wallet";
67
+ The
73
68
 
74
- //Only for decode
75
- PID.SdJwt.decode("<token>");
69
+ **Be sure the key for `my-tag` already exists.**
76
70
 
77
- //Decode and verification
78
- PID.SdJwt.verify("<token>");
79
- ```
71
+ </details>
80
72
 
81
- ### Wallet Instance Attestation
73
+ <details>
74
+ <summary>AuthorizationContext (strong authentication handling)</summary>
82
75
 
83
- #### Issuing
76
+ Whenever a strong authentication is required, the library asks the consumer application to provide a way to perform the user authentication. This is done by providing a AuthenticationContext object formed as follows:
84
77
 
85
78
  ```ts
86
- import {
87
- WalletInstanceAttestation,
88
- createCryptoContextFor,
89
- getWalletProviderEntityConfiguration,
90
- } from "@pagopa/io-react-native-wallet";
91
- // create crypto context for the key pair associated with the Wallet Instance Attestation
92
- const wiaCryptoContext = createCryptoContextFor("wia-keytag");
93
-
94
- // obtain Wallet Provider metadata
95
- const entityConfiguration = await getWalletProviderEntityConfiguration(
96
- "https://wallet-provider.example"
97
- );
98
-
99
- // prepare the request
100
- const wiaRequest = WalletInstanceAttestation.getAttestation({
101
- wiaCryptoContext,
102
- });
103
-
104
- // request the signed Wallet Instance Attestation to the Wallet Provider
105
- const signedWIA = await wiaRequest(entityConfiguration);
79
+ /**
80
+ * Context for authorization during the {@link 03-start-user-authorization.ts} phase.
81
+ * It consists of a single method to identify the user which takes a URL and a redirect schema as input.
82
+ * Once the authorization is completed and the URL calls the redirect schema, the method should return the redirect URL.
83
+ */
84
+ export interface AuthorizationContext {
85
+ authorize: (url: string, redirectSchema: string) => Promise<string>;
86
+ }
106
87
  ```
107
88
 
108
- #### Encode and Decode
89
+ The authorize function is called with the URL to be opened and the schema to be used to redirect the user back to the application. The function should return a promise that resolves with the URL that the user has been redirected to.
90
+ The suggested library to manage authorizations is [io-react-native-login-utils](https://github.com/pagopa/io-react-native-login-utils), an example is shown below:
109
91
 
110
92
  ```ts
111
- import { WalletInstanceAttestation } from "io-react-native-wallet";
93
+ import { type AuthorizationContext } from "@pagopa/io-react-native-wallet";
94
+ import { openAuthenticationSession } from "@pagopa/io-react-native-login-utils";
112
95
 
113
- WalletInstanceAttestation.decode("<token>");
96
+ const authorizationContext: AuthorizationContext = {
97
+ authorize: openAuthenticationSession,
98
+ };
114
99
  ```
115
100
 
116
- ### Relying Party
117
-
118
- #### Credential presentation (PID)
119
-
120
- ```ts
121
- import {
122
- RelyingPartySolution,
123
- createCryptoContextFor,
124
- getRelyingPartyEntityConfiguration,
125
- } from "@pagopa/io-react-native-wallet";
126
-
127
- // create crypto context for the key pair associated with the Wallet Instance Attestation
128
- const wiaCryptoContext = createCryptoContextFor("wia-keytag");
129
- // create crypto context for the key pair associated with PID stored in the device
130
- const pidCryptoContext = createCryptoContextFor("pid-keytag");
131
-
132
- // resolve RP's entity configuration
133
- const entityConfiguration = await getRelyingPartyEntityConfiguration(
134
- "https://relying-party.example"
135
- );
136
-
137
- // get request object
138
- const getRequestObject = RelyingPartySolution.getRequestObject({
139
- wiaCryptoContext,
140
- });
141
- const requestObj = await getRequestObject(
142
- /* signed instance attestation */ walletInstanceAttestation,
143
- /* url to request authorization to */ authorizationUrl,
144
- entityConfiguration
145
- );
146
-
147
- // Submit authorization response
148
- const sendAuthorizationResponse =
149
- RelyingPartySolution.sendAuthorizationResponse({
150
- pidCryptoContext,
151
- });
152
-
153
- const result = await sendAuthorizationResponse(requestObj, [
154
- /* signed PID token */ pidToken,
155
- /* array of claims to disclose from PID */ claims,
156
- ]);
157
- ```
158
-
159
- ### Trust Model
160
-
161
- #### Fetch federation entity statements
101
+ </details>
162
102
 
163
- ```ts
164
- import {
165
- // generic statement
166
- getEntityStatement,
167
- getEntityConfiguration,
168
- // statement with shape parsing
169
- getCredentialIssuerEntityConfiguration,
170
- getRelyingPartyEntityConfiguration,
171
- getTrustAnchorEntityConfiguration,
172
- getWalletProviderEntityConfiguration,
173
- } from "@pagopa/io-react-native-wallet";
174
- ```
103
+ <details>
104
+ <summary>IntegrityToken (device integrity)</summary>
175
105
 
176
- #### Validate trust
106
+ In order to ensure the integrity of the device, the library asks the consumer application to provide a way to generate a token that can be used to verify the device integrity. This is done by providing an IntegrityToken object formed as follows:
177
107
 
178
108
  ```ts
179
- import {
180
- verifyTrustChain,
181
- getTrustAnchorEntityConfiguration,
182
- } from "@pagopa/io-react-native-wallet";
183
-
184
- const trustChain = ["ejJ0eX...", "eyG5eX...", "erU9eX..."];
185
- const trustChainEC = await getTrustAnchorEntityConfiguration(
186
- "https://trust-anchor.example"
187
- );
188
-
189
- // Validate a given trust chain offline (no renewal on failures)
190
- await verifyTrustChain(trustChainEC, trustChain);
191
-
192
- // Validate a given trust chain online (try to renew on failures)
193
- await verifyTrustChain(trustChainEC, trustChain, { renewOnFail: true });
109
+ /**
110
+ * Interface for the integrity context which provides the necessary functions to interact with the integrity service.
111
+ * The functions are platform specific and must be implemented in the platform specific code.
112
+ * getHardwareKeyTag: returns the hardware key tag in a url safe format (e.g. base64url).
113
+ * getAttestation: requests the attestation from the integrity service.
114
+ * getHardwareSignatureWithAuthData: signs the clientData and returns the signature with the authenticator data.
115
+ */
116
+ export interface IntegrityContext {
117
+ getHardwareKeyTag: () => string;
118
+ getAttestation: (nonce: string) => Promise<string>;
119
+ getHardwareSignatureWithAuthData: (
120
+ clientData: string
121
+ ) => Promise<HardwareSignatureWithAuthData>;
122
+ }
194
123
  ```
195
124
 
196
- ## Example
197
-
198
- ### NodeJS and Ruby
125
+ Usually this is achieved by using [Google Play Integrity API](https://developer.android.com/google/play/integrity/overview) and [Key Attestation](https://developer.android.com/privacy-and-security/security-key-attestation) on Android, [DCAppAttestService](https://developer.apple.com/documentation/devicecheck/establishing-your-app-s-integrity) on iOS.
199
126
 
200
- To run the example project you need to install the correct version of NodeJS and Ruby.
201
- We recommend the use of a virtual environment of your choice. For ease of use, this guide adopts [nodenv](https://github.com/nodenv/nodenv) or [nvm](https://github.com/nvm-sh/nvm) for NodeJS and [rbenv](https://github.com/rbenv/rbenv) for Ruby.
202
- [Yarn](https://yarnpkg.com/) is the package manager of choice.
127
+ The suggested library to manage integrity is [io-react-native-integrity](https://github.com/pagopa/io-react-native-integrity).
203
128
 
204
- The node version used in this project is stored in [example/.node-version](example/.node-version) and [example/.nvmrc],
205
- while the version of Ruby is stored in [example/.ruby-version](.ruby-version).
206
-
207
- ### React Native
208
-
209
- Follow the [official tutorial](https://reactnative.dev/docs/environment-setup?guide=native) for installing the `React Native CLI` for your operating system.
210
-
211
- If you have a macOS system, you can follow both the tutorial for iOS and for Android. If you have a Linux or Windows system, you only need to install the development environment for Android.
212
-
213
- ### Build the app
214
-
215
- In order to build the app,
216
- As stated [previously](#nodejs-and-ruby), we also use `nodenv` and `rbenv` for managing the environment:
217
-
218
- ```bash
219
- # Clone the repository
220
- $ git clone https://github.com/pagopa/io-react-native-wallet
221
-
222
- # CD into the repository
223
- $ cd io-react-native-wallet
224
-
225
- # Install library dependencies
226
- $ yarn install
227
-
228
- # CD into the example folder
229
- $ cd example
230
-
231
- # Install bundle
232
- $ gem install bundle
129
+ </details>
233
130
 
234
- # Install the required Gems from the Gemfile
235
- # Run this only during the first setup and when Gems dependencies change
236
- $ bundle install
131
+ <details>
132
+ <summary>appFetch (making HTTP requests)</summary>
237
133
 
238
- # Install example dependencies
239
- # Run this only during the first setup and when JS dependencies change
240
- $ yarn install
134
+ This package is compatibile with any http client which implements [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API). Functions that makes http requests allow for an optional `appFetch` parameter to provide a custom http client implementation. If not provided, the built-in implementation on the runtime is used.
241
135
 
242
- # Install podfiles when targeting iOS (ignore this step for Android)
243
- # Run this only during the first setup and when Pods dependencies change
244
- $ cd ios && bundle exec pod install && cd ..
136
+ </details>
245
137
 
246
- # Run the app on iOS
247
- $ yarn ios
138
+ ### Flows
139
+
140
+ Different flows are provided to perform common operations. Each flow is a set of steps that must be executed in a given order. The documentation is provided inside the related folder:
141
+
142
+ - Wallet Instance
143
+ - [Creation](./src/wallet-instance/README.md)
144
+ - [Attestation](./src/wallet-instance-attestation/README.md)
145
+ - Credentail
146
+ - [Issuance](./src/credential/issuance/README.md)
147
+ - [Presentation](./src/credential/presentation/README.md) (TODO)
148
+ - [Status](./src/credential/status/README.md)
149
+
150
+ ### Example
151
+
152
+ An example app is provided in [example](./example) folder which demostrates how to implemente these flows. To run it, follow the instructions in the [README](./example/README.md).
153
+
154
+ ### Ecosystem
155
+
156
+ `io-react-native-wallet` is designed to be used in [io-app](https://github.com/pagopa/io-app) and its ecosystem. There are a few libraries that can be used to implement the context required to implement the flows defined by this package.
157
+ Below there's a list of the libraries and a schema of how they interact with each other:
158
+
159
+ - [@pagopa/io-react-native-crypto](https://github.com/pagopa/io-react-native-crypto) - Used to manage cryptographic keys and signatures
160
+ - [@pagopa/io-react-native-integrity](https://github.com/pagopa/io-react-native-integrity) - Used to manage and verify the integrity of the device
161
+ - [@pagopa/io-react-native-login-utils](https://github.com/pagopa/io-react-native-login-utils) - Used to manage strong authentication flows securely
162
+ - [@pagopa/io-react-native-secure-storage](https://github.com/pagopa/io-react-native-secure-storage) - Used to store data securely on the device
163
+
164
+ ```mermaid
165
+ graph TD;
166
+ ioa[io-app]
167
+ iornw[io-react-native-wallet]
168
+ iornc[io-react-native-crypto]
169
+ iorni[io-react-native-integrity]
170
+ iornlu[io-react-native-login-utils]
171
+ iornss[io-react-native-secure-storage]
172
+ iornjwt[io-react-native-jwt]
173
+ rncie[react-native-cie]
174
+ rnw(react-native-webview)
175
+
176
+ ioa --> iornw
177
+ iornw --> iornjwt
178
+ iornw --> rncie
179
+ iornw --> rnw
180
+
181
+ subgraph IoApp Deps
182
+ direction TB
183
+ iornc
184
+ iorni
185
+ iornlu
186
+ iornss
187
+ end
188
+
189
+ subgraph IoRnWallet Deps
190
+ iornjwt
191
+ rncie
192
+ rnw
193
+ end
194
+
195
+ ioa --> |dependency to implement CryptoContext| iornc
196
+ ioa --> |dependency to implement IntegrityContext| iorni
197
+ ioa --> |dependency to implement AuthorizationContext| iornlu
198
+ ioa --> |dependency to store credentials| iornss
248
199
 
249
- # Run the app on Android
250
- $ yarn android
251
200
  ```
@@ -0,0 +1,6 @@
1
+ # CIE
2
+
3
+ This library provides a components and a set of utilities to interact with the physical [CIE (Carta d'Identità Elettronica)](https://www.cartaidentita.interno.gov.it/) card. It can be used to [obtain an eID](../credential/issuance/README.md) via strong authentication.
4
+ Under the hood it uses [@pagopa/react-native-cie](https://github.com/pagopa/io-cie-sdk) to interact with the card and [react-native-webview](https://github.com/react-native-webview/react-native-webview) to complete the authorization flow.
5
+
6
+ An example of usage can be found in the [example](./example) folder of this repository.
@@ -11,6 +11,8 @@ var _manager = require("./manager");
11
11
  var _error = require("./error");
12
12
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
13
13
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
14
+ const AUTH_LINK_PATTERN = "lettura carta";
15
+
14
16
  /* To obtain the authentication URL on CIE L3 it is necessary to take the
15
17
  * link contained in the "Entra con lettura carta CIE" button.
16
18
  * This link can then be used on CieManager.
@@ -20,7 +22,7 @@ const injectedJavaScript = `
20
22
  (function() {
21
23
  function sendDocumentContent() {
22
24
  const idpAuthUrl = [...document.querySelectorAll("a")]
23
- .filter(a => a.textContent.includes("lettura carta CIE"))
25
+ .filter(a => a.textContent.toLowerCase().includes("${AUTH_LINK_PATTERN}"))
24
26
  .map(a=>a.href)[0];
25
27
 
26
28
  if(idpAuthUrl) {
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeWebview","_manager","_error","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","injectedJavaScript","CieEvent","exports","iOSUserAgent","defaultUserAgent","Platform","select","ios","undefined","webView","createRef","WebViewComponent","params","webViewUrl","setWebViewUrl","React","useState","authUrl","isCardReadingFinished","setCardReadingFinished","continueWithUrl","callbackUrl","handleMessage","event","cieAuthorizationUri","nativeEvent","data","startCie","startCieiOS","startCieAndroid","useUat","pin","onError","onEvent","handleShouldStartLoading","onSuccess","redirectUrl","url","includes","handleOnLoadEnd","onCieEvent","e","eventTitle","title","toLowerCase","handleOnError","Error","completed","error","webViewError","webViewHttpError","statusCode","description","CieError","message","type","CieErrorType","WEB_VIEW_ERROR","code","createElement","WebView","ref","userAgent","javaScriptEnabled","source","uri","onLoadEnd","onHttpError","onShouldStartLoadWithRequest","onMessage"],"sourceRoot":"../../../src","sources":["cie/component.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,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B,EAAElC,wBAAwB,CACpDtB,MAAM,CAACuB,SAAS,EAChBvB,MAAM,CAACwB,WACT,CAAE;IACFiC,SAAS,EAAE/C;EAAc,CAC1B,CAAC;AAEN,CAAC;AAACpB,OAAA,CAAAS,gBAAA,GAAAA,gBAAA"}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeWebview","_manager","_error","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","AUTH_LINK_PATTERN","injectedJavaScript","CieEvent","exports","iOSUserAgent","defaultUserAgent","Platform","select","ios","undefined","webView","createRef","WebViewComponent","params","webViewUrl","setWebViewUrl","React","useState","authUrl","isCardReadingFinished","setCardReadingFinished","continueWithUrl","callbackUrl","handleMessage","event","cieAuthorizationUri","nativeEvent","data","startCie","startCieiOS","startCieAndroid","useUat","pin","onError","onEvent","handleShouldStartLoading","onSuccess","redirectUrl","url","includes","handleOnLoadEnd","onCieEvent","e","eventTitle","title","toLowerCase","handleOnError","Error","completed","error","webViewError","webViewHttpError","statusCode","description","CieError","message","type","CieErrorType","WEB_VIEW_ERROR","code","createElement","WebView","ref","userAgent","javaScriptEnabled","source","uri","onLoadEnd","onHttpError","onShouldStartLoadWithRequest","onMessage"],"sourceRoot":"../../../src","sources":["cie/component.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,mBAAA,GAAAF,OAAA;AASA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAAiD,SAAAK,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WA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