@webda/auth 0.0.0-stage → 4.0.0-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/LICENSE +166 -0
  2. package/README.md +26 -2
  3. package/lib/authentication.service.d.ts +286 -0
  4. package/lib/authentication.service.d.ts.map +1 -0
  5. package/lib/authentication.service.js +798 -0
  6. package/lib/authentication.service.js.map +1 -0
  7. package/lib/compat/upgrade.d.ts +71 -0
  8. package/lib/compat/upgrade.d.ts.map +1 -0
  9. package/lib/compat/upgrade.js +185 -0
  10. package/lib/compat/upgrade.js.map +1 -0
  11. package/lib/email/emailpassword.service.d.ts +241 -0
  12. package/lib/email/emailpassword.service.d.ts.map +1 -0
  13. package/lib/email/emailpassword.service.js +718 -0
  14. package/lib/email/emailpassword.service.js.map +1 -0
  15. package/lib/email/tokens.d.ts +36 -0
  16. package/lib/email/tokens.d.ts.map +1 -0
  17. package/lib/email/tokens.js +46 -0
  18. package/lib/email/tokens.js.map +1 -0
  19. package/lib/errors.d.ts +53 -0
  20. package/lib/errors.d.ts.map +1 -0
  21. package/lib/errors.js +73 -0
  22. package/lib/errors.js.map +1 -0
  23. package/lib/index.d.ts +9 -0
  24. package/lib/index.d.ts.map +1 -0
  25. package/lib/index.js +9 -0
  26. package/lib/index.js.map +1 -0
  27. package/lib/oauth/oauth.service.d.ts +293 -0
  28. package/lib/oauth/oauth.service.d.ts.map +1 -0
  29. package/lib/oauth/oauth.service.js +557 -0
  30. package/lib/oauth/oauth.service.js.map +1 -0
  31. package/lib/provider.d.ts +53 -0
  32. package/lib/provider.d.ts.map +1 -0
  33. package/lib/provider.js +55 -0
  34. package/lib/provider.js.map +1 -0
  35. package/lib/test/authtest.d.ts +39 -0
  36. package/lib/test/authtest.d.ts.map +1 -0
  37. package/lib/test/authtest.js +62 -0
  38. package/lib/test/authtest.js.map +1 -0
  39. package/lib/test/emailtest.d.ts +25 -0
  40. package/lib/test/emailtest.d.ts.map +1 -0
  41. package/lib/test/emailtest.js +39 -0
  42. package/lib/test/emailtest.js.map +1 -0
  43. package/lib/test/fakeoauth.service.d.ts +45 -0
  44. package/lib/test/fakeoauth.service.d.ts.map +1 -0
  45. package/lib/test/fakeoauth.service.js +78 -0
  46. package/lib/test/fakeoauth.service.js.map +1 -0
  47. package/lib/test/stubprovider.d.ts +35 -0
  48. package/lib/test/stubprovider.d.ts.map +1 -0
  49. package/lib/test/stubprovider.js +46 -0
  50. package/lib/test/stubprovider.js.map +1 -0
  51. package/lib/test/v3.d.ts +29 -0
  52. package/lib/test/v3.d.ts.map +1 -0
  53. package/lib/test/v3.js +47 -0
  54. package/lib/test/v3.js.map +1 -0
  55. package/lib/throttle.d.ts +40 -0
  56. package/lib/throttle.d.ts.map +1 -0
  57. package/lib/throttle.js +47 -0
  58. package/lib/throttle.js.map +1 -0
  59. package/package.json +69 -3
  60. package/test/config.json +20 -0
  61. package/webda.module.json +632 -0
package/LICENSE ADDED
@@ -0,0 +1,166 @@
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+
9
+ This version of the GNU Lesser General Public License incorporates
10
+ the terms and conditions of version 3 of the GNU General Public
11
+ License, supplemented by the additional permissions listed below.
12
+
13
+ 0. Additional Definitions.
14
+
15
+ As used herein, "this License" refers to version 3 of the GNU Lesser
16
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
+ General Public License.
18
+
19
+ "The Library" refers to a covered work governed by this License,
20
+ other than an Application or a Combined Work as defined below.
21
+
22
+ An "Application" is any work that makes use of an interface provided
23
+ by the Library, but which is not otherwise based on the Library.
24
+ Defining a subclass of a class defined by the Library is deemed a mode
25
+ of using an interface provided by the Library.
26
+
27
+ A "Combined Work" is a work produced by combining or linking an
28
+ Application with the Library. The particular version of the Library
29
+ with which the Combined Work was made is also called the "Linked
30
+ Version".
31
+
32
+ The "Minimal Corresponding Source" for a Combined Work means the
33
+ Corresponding Source for the Combined Work, excluding any source code
34
+ for portions of the Combined Work that, considered in isolation, are
35
+ based on the Application, and not on the Linked Version.
36
+
37
+ The "Corresponding Application Code" for a Combined Work means the
38
+ object code and/or source code for the Application, including any data
39
+ and utility programs needed for reproducing the Combined Work from the
40
+ Application, but excluding the System Libraries of the Combined Work.
41
+
42
+ 1. Exception to Section 3 of the GNU GPL.
43
+
44
+ You may convey a covered work under sections 3 and 4 of this License
45
+ without being bound by section 3 of the GNU GPL.
46
+
47
+ 2. Conveying Modified Versions.
48
+
49
+ If you modify a copy of the Library, and, in your modifications, a
50
+ facility refers to a function or data to be supplied by an Application
51
+ that uses the facility (other than as an argument passed when the
52
+ facility is invoked), then you may convey a copy of the modified
53
+ version:
54
+
55
+ a) under this License, provided that you make a good faith effort to
56
+ ensure that, in the event an Application does not supply the
57
+ function or data, the facility still operates, and performs
58
+ whatever part of its purpose remains meaningful, or
59
+
60
+ b) under the GNU GPL, with none of the additional permissions of
61
+ this License applicable to that copy.
62
+
63
+ 3. Object Code Incorporating Material from Library Header Files.
64
+
65
+ The object code form of an Application may incorporate material from
66
+ a header file that is part of the Library. You may convey such object
67
+ code under terms of your choice, provided that, if the incorporated
68
+ material is not limited to numerical parameters, data structure
69
+ layouts and accessors, or small macros, inline functions and templates
70
+ (ten or fewer lines in length), you do both of the following:
71
+
72
+ a) Give prominent notice with each copy of the object code that the
73
+ Library is used in it and that the Library and its use are
74
+ covered by this License.
75
+
76
+ b) Accompany the object code with a copy of the GNU GPL and this license
77
+ document.
78
+
79
+ 4. Combined Works.
80
+
81
+ You may convey a Combined Work under terms of your choice that,
82
+ taken together, effectively do not restrict modification of the
83
+ portions of the Library contained in the Combined Work and reverse
84
+ engineering for debugging such modifications, if you also do each of
85
+ the following:
86
+
87
+ a) Give prominent notice with each copy of the Combined Work that
88
+ the Library is used in it and that the Library and its use are
89
+ covered by this License.
90
+
91
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
+ document.
93
+
94
+ c) For a Combined Work that displays copyright notices during
95
+ execution, include the copyright notice for the Library among
96
+ these notices, as well as a reference directing the user to the
97
+ copies of the GNU GPL and this license document.
98
+
99
+ d) Do one of the following:
100
+
101
+ 0) Convey the Minimal Corresponding Source under the terms of this
102
+ License, and the Corresponding Application Code in a form
103
+ suitable for, and under terms that permit, the user to
104
+ recombine or relink the Application with a modified version of
105
+ the Linked Version to produce a modified Combined Work, in the
106
+ manner specified by section 6 of the GNU GPL for conveying
107
+ Corresponding Source.
108
+
109
+ 1) Use a suitable shared library mechanism for linking with the
110
+ Library. A suitable mechanism is one that (a) uses at run time
111
+ a copy of the Library already present on the user's computer
112
+ system, and (b) will operate properly with a modified version
113
+ of the Library that is interface-compatible with the Linked
114
+ Version.
115
+
116
+ e) Provide Installation Information, but only if you would otherwise
117
+ be required to provide such information under section 6 of the
118
+ GNU GPL, and only to the extent that such information is
119
+ necessary to install and execute a modified version of the
120
+ Combined Work produced by recombining or relinking the
121
+ Application with a modified version of the Linked Version. (If
122
+ you use option 4d0, the Installation Information must accompany
123
+ the Minimal Corresponding Source and Corresponding Application
124
+ Code. If you use option 4d1, you must provide the Installation
125
+ Information in the manner specified by section 6 of the GNU GPL
126
+ for conveying Corresponding Source.)
127
+
128
+ 5. Combined Libraries.
129
+
130
+ You may place library facilities that are a work based on the
131
+ Library side by side in a single library together with other library
132
+ facilities that are not Applications and are not covered by this
133
+ License, and convey such a combined library under terms of your
134
+ choice, if you do both of the following:
135
+
136
+ a) Accompany the combined library with a copy of the same work based
137
+ on the Library, uncombined with any other library facilities,
138
+ conveyed under the terms of this License.
139
+
140
+ b) Give prominent notice with the combined library that part of it
141
+ is a work based on the Library, and explaining where to find the
142
+ accompanying uncombined form of the same work.
143
+
144
+ 6. Revised Versions of the GNU Lesser General Public License.
145
+
146
+ The Free Software Foundation may publish revised and/or new versions
147
+ of the GNU Lesser General Public License from time to time. Such new
148
+ versions will be similar in spirit to the present version, but may
149
+ differ in detail to address new problems or concerns.
150
+
151
+ Each version is given a distinguishing version number. If the
152
+ Library as you received it specifies that a certain numbered version
153
+ of the GNU Lesser General Public License "or any later version"
154
+ applies to it, you have the option of following the terms and
155
+ conditions either of that published version or of any later version
156
+ published by the Free Software Foundation. If the Library as you
157
+ received it does not specify a version number of the GNU Lesser
158
+ General Public License, you may choose any version of the GNU Lesser
159
+ General Public License ever published by the Free Software Foundation.
160
+
161
+ If the Library as you received it specifies that a proxy can decide
162
+ whether future versions of the GNU Lesser General Public License shall
163
+ apply, that proxy's public statement of acceptance of any version is
164
+ permanent authorization for you to choose that version for the
165
+ Library.
166
+
package/README.md CHANGED
@@ -1,3 +1,27 @@
1
- # Temporary Holding Version
1
+ # @webda/auth
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Authentication for Webda: login providers, account linking, access/refresh tokens, email + password with verification
4
+ and recovery, and v3 data compatibility.
5
+
6
+ ## Install
7
+
8
+ ```bash
9
+ pnpm add @webda/auth
10
+ ```
11
+
12
+ ## Minimal configuration
13
+
14
+ ```jsonc
15
+ {
16
+ "services": {
17
+ "Authentication": { "type": "Webda/Authentication" },
18
+ "emailAuth": { "type": "Webda/EmailPasswordProvider", "mailer": "Mailer" },
19
+ "db": { "type": "MemoryStore", "models": ["Webda/User", "Webda/Ident", "Webda/RefreshToken"] }
20
+ }
21
+ }
22
+ ```
23
+
24
+ ## Documentation
25
+
26
+ - [Authentication](../../docs/pages/Security/Authentication.md)
27
+ - [v3 to v4 migration](../../docs/pages/Migration/Authentication-v3-to-v4.md)
@@ -0,0 +1,286 @@
1
+ import { type AuthenticationEvents, type AuthResult, Counter, Ident, type IAuthenticationService, type IssuedTokens, type ProviderInfo, type ResolvedIdentity, Service, ServiceParameters, type User } from "@webda/core";
2
+ import type { ModelClass } from "@webda/models";
3
+ import { type AuthProvider, type ProviderEmailPolicy } from "./provider.js";
4
+ /** Account linking policy for unauthenticated logins matching an existing email */
5
+ export type LinkingPolicy = "never" | "verified" | "always";
6
+ /** v3 data compatibility options */
7
+ export interface AuthenticationCompatibility {
8
+ /**
9
+ * Read and write v3 data layouts
10
+ * @default true
11
+ */
12
+ v3?: boolean;
13
+ }
14
+ /** Counts of one kind of migrated records */
15
+ export interface MigrationCounts {
16
+ /** Records migrated (or that would be, in a dry run) */
17
+ migrated: number;
18
+ /** Records that look like v3 data but are not migrated (unrecognised key, foreign row) */
19
+ skipped: number;
20
+ /** Keys of the records whose migration failed */
21
+ failed: string[];
22
+ }
23
+ /** Result of `webda auth migrate` */
24
+ export interface MigrationReport {
25
+ /** v3 ident records */
26
+ idents: MigrationCounts;
27
+ /** Users whose stored record still has the v3 `__password` */
28
+ users: MigrationCounts;
29
+ /** Nothing was written */
30
+ dryRun: boolean;
31
+ /** Set when the ident passes stopped at the pass limit with records still migrating: run the command again */
32
+ incomplete?: boolean;
33
+ }
34
+ /** Authentication methods (amr) that are a primary factor: a second factor only counts on top of one of them */
35
+ export declare const PRIMARY_FACTORS: readonly string[];
36
+ /** Authentication parameters */
37
+ export declare class AuthenticationParameters extends ServiceParameters {
38
+ /**
39
+ * User model
40
+ * @default "Webda/User"
41
+ */
42
+ userModel?: string;
43
+ /**
44
+ * Ident model
45
+ * @default "Webda/Ident"
46
+ */
47
+ identModel?: string;
48
+ /**
49
+ * Linking policy
50
+ * @default "verified"
51
+ */
52
+ linking?: LinkingPolicy;
53
+ /**
54
+ * Allow automatic registration of new users
55
+ * @default true
56
+ */
57
+ registration?: boolean;
58
+ /**
59
+ * v3 data compatibility
60
+ * @default { "v3": true }
61
+ */
62
+ compatibility?: AuthenticationCompatibility;
63
+ /**
64
+ * @param params - raw parameters
65
+ * @returns this
66
+ */
67
+ load(params?: any): this;
68
+ }
69
+ /**
70
+ * Shared authentication logic: providers hand a ResolvedIdentity to complete()
71
+ * @WebdaModda Authentication
72
+ */
73
+ export declare class Authentication<T extends AuthenticationParameters = AuthenticationParameters> extends Service<T, AuthenticationEvents> implements IAuthenticationService {
74
+ static Parameters: typeof AuthenticationParameters;
75
+ protected metrics?: {
76
+ login?: Counter;
77
+ logout?: Counter;
78
+ registration?: Counter;
79
+ };
80
+ protected providerMap: Map<string, AuthProvider>;
81
+ /**
82
+ * @returns the configured user model
83
+ */
84
+ getUserModel(): ModelClass<User>;
85
+ /**
86
+ * @returns the configured ident model
87
+ */
88
+ getIdentModel(): ModelClass<Ident>;
89
+ /** @override */
90
+ resolve(): this;
91
+ /** @override */
92
+ init(): Promise<this>;
93
+ /**
94
+ * Collect every service implementing {@link AuthProvider}
95
+ * @throws Error when two providers share the same name
96
+ */
97
+ protected discoverProviders(): void;
98
+ /** @override */
99
+ stop(): Promise<void>;
100
+ /**
101
+ * @param name - provider name
102
+ * @returns the provider
103
+ */
104
+ getProvider(name: string): AuthProvider | undefined;
105
+ /**
106
+ * @param name - provider name
107
+ * @returns the email policy of that provider, undefined for unknown providers or without policy
108
+ */
109
+ protected emailPolicyFor(name: string): ProviderEmailPolicy | undefined;
110
+ /**
111
+ * @returns public info of every provider
112
+ */
113
+ getProviders(): ProviderInfo[];
114
+ /**
115
+ * List available login methods
116
+ * @returns providers
117
+ */
118
+ providers(): ProviderInfo[];
119
+ /**
120
+ * Current user
121
+ * @returns public entry of the logged user
122
+ */
123
+ me(): Promise<any>;
124
+ /** @override */
125
+ initMetrics(): void;
126
+ /**
127
+ * Find an ident; with `compatibility.v3`, a miss falls back to the v3 record `"<uid>_<provider>"`, upgraded on
128
+ * the fly
129
+ * @param provider - provider
130
+ * @param providerUid - uid
131
+ * @returns the ident when it exists
132
+ */
133
+ protected findIdent(provider: string, providerUid: string): Promise<Ident | undefined>;
134
+ /**
135
+ * MFA methods enabled for a user (implemented by sub-project 4)
136
+ * @param user - user
137
+ * @returns enabled methods, empty when MFA is off
138
+ */
139
+ protected mfaMethods(user: User): string[];
140
+ /**
141
+ * Create and save a user for an identity
142
+ * @param identity - resolved identity
143
+ * @param data - extra profile data
144
+ * @param ctx - request context (complete() runs as system, so it passes the real one)
145
+ * @returns the user
146
+ */
147
+ registerUser(identity: ResolvedIdentity, data?: any, ctx?: any): Promise<User>;
148
+ /**
149
+ * Complete a login for an identity proven by a provider
150
+ * @param identity - resolved identity
151
+ * @param options - complete options
152
+ * @param options.newUser - identity.user was just created by the provider: its first ident is not a "link"
153
+ * @returns the result
154
+ * @throws IdentLinkedElsewhere when the ident belongs to another user than the logged one
155
+ * @throws AccountExists when the email matches an account the linking policy does not allow
156
+ * @throws RegistrationDisabled when a new user is needed but registration is off
157
+ * @throws WebdaError.BadRequest when `identity.provider` is not a registered AuthProvider
158
+ */
159
+ complete(identity: ResolvedIdentity, options?: {
160
+ newUser?: boolean;
161
+ }): Promise<AuthResult>;
162
+ /**
163
+ * Apply the email policy of the identity provider (complete() does it too, idempotently)
164
+ * Lets a provider refuse an identity before creating anything
165
+ * @param identity - resolved identity
166
+ * @returns the identity to use
167
+ * @throws EmailDomainNotAllowed when the policy refuses it
168
+ * @throws WebdaError.BadRequest when `identity.provider` is not a registered AuthProvider: an unknown name would
169
+ * escape the email policy of the provider it impersonates
170
+ */
171
+ applyPolicy(identity: ResolvedIdentity): ResolvedIdentity;
172
+ /**
173
+ * Body of {@link complete}, running as system with the request context passed explicitly
174
+ * @param identity - resolved identity
175
+ * @param ctx - request context
176
+ * @param retried - already retried after a concurrent creation
177
+ * @param newUser - identity.user was just created by the provider: its first ident is not a "link"
178
+ * @returns the result
179
+ */
180
+ protected completeAs(identity: ResolvedIdentity, ctx: any, retried: boolean, newUser?: boolean): Promise<AuthResult>;
181
+ /**
182
+ * @param userId - uuid
183
+ * @returns the user
184
+ */
185
+ protected loadUser(userId: string): Promise<User>;
186
+ /**
187
+ * Write the session, issue tokens, emit Login
188
+ * @param user - user or uuid
189
+ * @param ident - ident used
190
+ * @param identity - resolved identity
191
+ * @param ctx - request context (complete() runs as system, so it passes the real one)
192
+ * @returns the result
193
+ */
194
+ protected establish(user: User | string, ident: Ident, identity: ResolvedIdentity, ctx?: any): Promise<AuthResult>;
195
+ /**
196
+ * Patch storing new provider tokens encrypted; also drops plaintext tokens left by an earlier v4 beta (`__tokens`)
197
+ * @param ident - the ident
198
+ * @param tokens - tokens from the provider, if any
199
+ * @returns the attributes to patch
200
+ */
201
+ protected tokensUpdate(ident: Ident, tokens: any): Promise<any>;
202
+ /**
203
+ * @returns the logged user id
204
+ * @throws WebdaError.Unauthorized when no fully logged session exists
205
+ */
206
+ protected requireUser(): string;
207
+ /**
208
+ * Logout and revoke the current refresh family; also abandons a pending MFA session
209
+ */
210
+ logout(): Promise<void>;
211
+ /**
212
+ * Exchange a refresh token
213
+ * @param refreshToken - refresh token
214
+ * @returns new tokens
215
+ */
216
+ refresh(refreshToken: string): Promise<IssuedTokens>;
217
+ /**
218
+ * List the current user's idents; with `compatibility.v3`, listing upgrades the user's v3 ident records first
219
+ * @returns idents of the current user
220
+ */
221
+ idents(): Promise<{
222
+ provider: string;
223
+ providerUid: string;
224
+ email?: string;
225
+ verifiedAt?: Date;
226
+ lastUsedAt?: Date;
227
+ }[]>;
228
+ /**
229
+ * @param userId - user
230
+ * @returns all idents owned by the user
231
+ */
232
+ protected listIdents(userId: string): Promise<Ident[]>;
233
+ /**
234
+ * Remove one of the current user's idents
235
+ * @param provider - provider
236
+ * @param providerUid - uid
237
+ * @throws LastLoginMethod when no usable login method would remain (non-email idents, plus email idents when the
238
+ * user has a password), or when it would remove the last email ident of a user with a password
239
+ */
240
+ unlink(provider: string, providerUid: string): Promise<void>;
241
+ /**
242
+ * Migrate v3 authentication data to the v4 layout
243
+ *
244
+ * Idents: every v3 record (`"<providerUid>_<provider>"` key) is upgraded to its `"<providerUid>:<provider>"`
245
+ * record (emails normalised) then deleted; with a custom ident model, the v3 rows typed as the core
246
+ * `Webda/Ident` are found through its repository too. Upgrading shifts position-based paging, so passes run
247
+ * until one upgrades nothing. Users: a user whose stored record still has the v3 `__password` is saved again in
248
+ * the v4 `password` shape. Idempotent: a second run migrates nothing. Failures are reported by key and logged,
249
+ * the migration goes on.
250
+ *
251
+ * Operator notes:
252
+ * - A v3 ident whose upgraded key another user already holds (e.g. two v3 email keys differing only by case) is
253
+ * reported in `idents.failed` (IDENT_CONFLICT) and kept: decide which user keeps the email, then delete or
254
+ * rename the other v3 row and run the command again.
255
+ * - A malformed ident key in the store stops the scan: remove that row manually.
256
+ * - Re-running is always safe: migrated records are not touched again.
257
+ * @param dryRun - only count, write nothing
258
+ * @param batch - page size of the scans
259
+ * @returns the report
260
+ */
261
+ migrate(
262
+ /** @description Only count the records to migrate, write nothing */
263
+ dryRun?: boolean,
264
+ /** @description Page size of the store scans */
265
+ batch?: number): Promise<MigrationReport>;
266
+ /**
267
+ * Enumerate the v3 ident rows: through the ident model, and through the core `Ident` repository when the
268
+ * ident model is a subclass (its queries only see rows typed as itself or its subclasses)
269
+ * @param pageSize - page size
270
+ * @returns the v3 keys found, each once per pass
271
+ */
272
+ protected legacyIdentKeys(pageSize: number): AsyncGenerator<string>;
273
+ /**
274
+ * Upgrade the v3 idents
275
+ * @param report - report to fill
276
+ * @param pageSize - page size
277
+ */
278
+ protected migrateIdents(report: MigrationReport, pageSize: number): Promise<void>;
279
+ /**
280
+ * Save again the users whose stored record still has the v3 `__password`
281
+ * @param report - report to fill
282
+ * @param pageSize - page size
283
+ */
284
+ protected migrateUsers(report: MigrationReport, pageSize: number): Promise<void>;
285
+ }
286
+ //# sourceMappingURL=authentication.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authentication.service.d.ts","sourceRoot":"","sources":["../src/authentication.service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,UAAU,EAEf,OAAO,EACP,KAAK,EACL,KAAK,sBAAsB,EAC3B,KAAK,YAAY,EAEjB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EAGrB,OAAO,EACP,iBAAiB,EAKjB,KAAK,IAAI,EAGV,MAAM,a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