@c9up/warden 0.2.5 → 0.2.6

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 (96) hide show
  1. package/README.md +70 -3
  2. package/dist/AccessToken.d.ts +257 -0
  3. package/dist/AccessToken.d.ts.map +1 -0
  4. package/dist/AccessToken.js +370 -0
  5. package/dist/AccessToken.js.map +1 -0
  6. package/dist/AttemptStore.d.ts +16 -2
  7. package/dist/AttemptStore.d.ts.map +1 -1
  8. package/dist/AttemptStore.js +26 -12
  9. package/dist/AttemptStore.js.map +1 -1
  10. package/dist/AuthManager.d.ts +33 -2
  11. package/dist/AuthManager.d.ts.map +1 -1
  12. package/dist/AuthManager.js +23 -2
  13. package/dist/AuthManager.js.map +1 -1
  14. package/dist/Authenticator.d.ts +19 -1
  15. package/dist/Authenticator.d.ts.map +1 -1
  16. package/dist/Authenticator.js +37 -3
  17. package/dist/Authenticator.js.map +1 -1
  18. package/dist/Guard.d.ts.map +1 -1
  19. package/dist/Guard.js +17 -5
  20. package/dist/Guard.js.map +1 -1
  21. package/dist/ResilientBlacklistDriver.d.ts +23 -6
  22. package/dist/ResilientBlacklistDriver.d.ts.map +1 -1
  23. package/dist/ResilientBlacklistDriver.js +24 -8
  24. package/dist/ResilientBlacklistDriver.js.map +1 -1
  25. package/dist/WardenProvider.d.ts +2 -0
  26. package/dist/WardenProvider.d.ts.map +1 -1
  27. package/dist/WardenProvider.js +4 -58
  28. package/dist/WardenProvider.js.map +1 -1
  29. package/dist/config.d.ts +8 -4
  30. package/dist/config.d.ts.map +1 -1
  31. package/dist/config.js +4 -1
  32. package/dist/config.js.map +1 -1
  33. package/dist/index.d.ts +4 -2
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +2 -1
  36. package/dist/index.js.map +1 -1
  37. package/dist/mfa/MfaManager.d.ts +16 -4
  38. package/dist/mfa/MfaManager.d.ts.map +1 -1
  39. package/dist/mfa/MfaManager.js +32 -6
  40. package/dist/mfa/MfaManager.js.map +1 -1
  41. package/dist/middleware.d.ts.map +1 -1
  42. package/dist/middleware.js +27 -5
  43. package/dist/middleware.js.map +1 -1
  44. package/dist/native.d.ts +6 -2
  45. package/dist/native.d.ts.map +1 -1
  46. package/dist/native.js +19 -2
  47. package/dist/native.js.map +1 -1
  48. package/dist/quasar.d.ts.map +1 -1
  49. package/dist/quasar.js +8 -1
  50. package/dist/quasar.js.map +1 -1
  51. package/dist/standalone.d.ts +24 -3
  52. package/dist/standalone.d.ts.map +1 -1
  53. package/dist/standalone.js +21 -29
  54. package/dist/standalone.js.map +1 -1
  55. package/dist/strategies/ApiKeyStrategy.d.ts +45 -12
  56. package/dist/strategies/ApiKeyStrategy.d.ts.map +1 -1
  57. package/dist/strategies/ApiKeyStrategy.js +71 -37
  58. package/dist/strategies/ApiKeyStrategy.js.map +1 -1
  59. package/dist/strategies/JwtStrategy.d.ts.map +1 -1
  60. package/dist/strategies/JwtStrategy.js +3 -3
  61. package/dist/strategies/JwtStrategy.js.map +1 -1
  62. package/dist/templateTags.d.ts +42 -0
  63. package/dist/templateTags.d.ts.map +1 -0
  64. package/dist/templateTags.js +82 -0
  65. package/dist/templateTags.js.map +1 -0
  66. package/dist/vendor/nativeBinary.d.ts +26 -2
  67. package/dist/vendor/nativeBinary.d.ts.map +1 -1
  68. package/dist/vendor/nativeBinary.js +63 -6
  69. package/dist/vendor/nativeBinary.js.map +1 -1
  70. package/dist/vendor/quasarConnection.d.ts +26 -3
  71. package/dist/vendor/quasarConnection.d.ts.map +1 -1
  72. package/dist/vendor/quasarConnection.js +44 -23
  73. package/dist/vendor/quasarConnection.js.map +1 -1
  74. package/index.darwin-arm64.node +0 -0
  75. package/index.darwin-x64.node +0 -0
  76. package/index.win32-x64-msvc.node +0 -0
  77. package/package.json +7 -2
  78. package/src/AccessToken.ts +550 -0
  79. package/src/AttemptStore.ts +29 -13
  80. package/src/AuthManager.ts +40 -2
  81. package/src/Authenticator.ts +39 -3
  82. package/src/Guard.ts +18 -5
  83. package/src/ResilientBlacklistDriver.ts +28 -8
  84. package/src/WardenProvider.ts +6 -83
  85. package/src/config.ts +8 -4
  86. package/src/index.ts +18 -0
  87. package/src/mfa/MfaManager.ts +39 -6
  88. package/src/middleware.ts +36 -5
  89. package/src/native.ts +20 -4
  90. package/src/quasar.ts +13 -2
  91. package/src/standalone.ts +74 -33
  92. package/src/strategies/ApiKeyStrategy.ts +112 -42
  93. package/src/strategies/JwtStrategy.ts +3 -1
  94. package/src/templateTags.ts +117 -0
  95. package/src/vendor/nativeBinary.ts +82 -6
  96. package/src/vendor/quasarConnection.ts +84 -22
package/README.md CHANGED
@@ -22,16 +22,80 @@ class OrderController {
22
22
  }
23
23
  ```
24
24
 
25
+ Authorization decorators imply authentication: an action carrying `@Role`,
26
+ `@Permission` or `@RequireMfa` without `@Guard` is authenticated with the default
27
+ guard (an anonymous request gets a 401). Decorators are read through the
28
+ prototype chain, so an action a controller inherits keeps its parent's guard and
29
+ authorization; an override inherits them too unless it declares its own.
30
+
25
31
  ## Features
26
32
 
27
- - Multi-strategy AuthManager (JWT, session, API key, HTTP Basic)
33
+ - Multi-strategy AuthManager (JWT, session, access tokens, HTTP Basic)
28
34
  - `@Guard()`, `@Permission()`, `@Role()` decorators
29
35
  - RBAC: `hasRole`, `hasPermission`, `hasAllPermissions`
30
36
  - Unified authorization: Bouncer-shaped abilities & policies over one resolver — RBAC + ACL + ownership + multi-tenant scope, zero `@adonisjs/bouncer` dependency
31
37
  - Strategy exception safety (catch → AuthResult)
32
38
  - Runtime strategy registration
33
39
  - **Multi-factor authentication** — TOTP, backup codes, email/SMS OTP, WebAuthn/passkeys, all dependency-free
34
- - JWT revocation blacklist (Memory / Redis-KeyDB / resilient fallback drivers)
40
+ - JWT and session revocation blacklist (Memory / Redis-KeyDB / resilient fallback drivers)
41
+
42
+ ## Access tokens
43
+
44
+ Opaque bearer tokens for APIs, CLIs and mobile apps. A token value looks like
45
+ `oat_<identifier>.<secret>`; only `sha256(secret)` is stored, the comparison is
46
+ constant-time, and the secret ends with a CRC-32 checksum so secret scanners can
47
+ recognise a leaked token.
48
+
49
+ ```typescript
50
+ import { AccessTokensProvider, MemoryAccessTokenStore } from '@c9up/warden'
51
+ import { apiKeyGuard, defineConfig } from '@c9up/warden/config'
52
+
53
+ // Implement AccessTokenStore over your own table in production.
54
+ const tokens = new AccessTokensProvider({ store: new MemoryAccessTokenStore(), expiresIn: '30 days' })
55
+
56
+ export default defineConfig({
57
+ default: 'api',
58
+ guards: { api: apiKeyGuard({ tokens, findUser: (id) => User.find(id) }) },
59
+ })
60
+
61
+ // Mint — `value` is readable only on the token just created.
62
+ const token = await tokens.create(user, ['orders:read'], { name: 'CI' })
63
+ token.value.release() // "oat_…" — hand it to the client now
64
+
65
+ // In a handler, after the guard authenticated the request:
66
+ ctx.auth.user.currentAccessToken.authorize('orders:read')
67
+ ```
68
+
69
+ The guard reads `Authorization: Bearer <token>` or the `x-api-key` header
70
+ (`headerName` to change it), reloads the user through `findUser` on every
71
+ request, and attaches the token as `user.currentAccessToken` (`abilities`,
72
+ `allows`, `denies`, `authorize`, `isExpired`, `lastUsedAt`). A token's abilities
73
+ are never merged into `user.permissions`, which holds the user's own permissions:
74
+ what a request may do is what the user may do AND what the token allows.
75
+ `@Permission(...)`, `hasPermission` and `hasAllPermissions` enforce exactly that
76
+ for a request made with a token (`tokenAllows(user, permission)` is the check on
77
+ its own); a session or JWT user is checked against their own permissions only.
78
+
79
+ `tokens.all(user)`, `find`, `delete`, `deleteAll` manage a user's tokens;
80
+ `tokens.invalidate(value)` (or `guard.invalidateToken(value)`) revokes the token
81
+ behind a presented value.
82
+
83
+ ## Sessions and remember-me
84
+
85
+ `ctx.auth.use('web').logout()` ends the session and the remember-me credential:
86
+ the cookie is cleared and the stored token behind it deleted.
87
+
88
+ Revocation lists (`TokenBlacklist`) can sit on a `ResilientBlacklistDriver`,
89
+ which keeps a local record beside Redis/KeyDB. When the primary is unreachable
90
+ and the local record does not know a credential, the check fails (the request is
91
+ refused as a server error, never treated as "not revoked"). Pass
92
+ `{ failOpen: true }` to let such credentials through instead, for a deployment
93
+ whose only consumer is a short-lived JWT.
94
+
95
+ `AuthRateLimiter` and the MFA lockout count attempts in a `MemoryAttemptStore`
96
+ by default: per process, bounded, and never dropping a live counter to make room
97
+ (a new key is refused while the store is full). In production, use
98
+ `RedisAttemptStore`: it is shared by every instance and has no such bound.
35
99
 
36
100
  ## Multi-factor authentication
37
101
 
@@ -57,9 +121,12 @@ const mfa = new MfaManager({
57
121
 
58
122
  // Enroll (returns the otpauth:// URI to render as a QR code)
59
123
  const { factorId, uri } = await mfa.enrollTotp({ id: user.id, name: user.email })
60
- await mfa.confirmTotp(factorId, codeFromAuthenticatorApp) // → true once confirmed
124
+ await mfa.confirmTotp(user.id, factorId, codeFromAuthenticatorApp) // → true once confirmed
61
125
  const recoveryCodes = await mfa.createBackupCodes(user.id) // show once
62
126
 
127
+ // Factor operations name the owner, and refuse a factor that is not theirs.
128
+ await mfa.disableFactor(user.id, factorId) // → false if not theirs
129
+
63
130
  // At sign-in step-up: TOTP code OR a backup code (rate-limited)
64
131
  if (await mfa.verify(user.id, submittedCode)) {
65
132
  const token = auth.issueFor(user, 'jwt', { mfa: true }) // JWT: the token carries the step-up
@@ -0,0 +1,257 @@
1
+ /**
2
+ * Access tokens — opaque, revocable bearer tokens an application issues to its
3
+ * own users (API keys, personal access tokens, mobile app tokens).
4
+ *
5
+ * Modelled on `@adonisjs/auth`'s access-tokens guard (`AccessToken` +
6
+ * `DbAccessTokensProvider`), so an app moving over keeps its token format:
7
+ *
8
+ * value = prefix + base64url(identifier) + "." + base64url(secret)
9
+ * secret = random(tokenSecretLength) + crc32(random) in decimal
10
+ * stored = sha256(secret), never the secret itself
11
+ *
12
+ * What makes it safe, all taken from upstream:
13
+ *
14
+ * 1. **Only a hash is stored.** A dump of the tokens table hands out no
15
+ * working token: the secret exists only in the hands of whoever received
16
+ * the value when it was minted.
17
+ * 2. **The comparison is constant-time**, so a timing side channel cannot
18
+ * forge a secret one byte at a time.
19
+ * 3. **The value is recognisable.** The `oat_` prefix and the CRC32 suffix let
20
+ * secret scanners (GitHub's, a pre-commit hook) flag a leaked token.
21
+ * 4. **Abilities, expiry and last use travel with the token**, and the guard
22
+ * hands the token to the request as `user.currentAccessToken`, where a
23
+ * handler checks `allows()` / `authorize()`.
24
+ *
25
+ * Two places go further than upstream, both named where they happen: the row
26
+ * identifier is random rather than a database counter, and neither verifying
27
+ * nor invalidating touches a row before its secret has been checked.
28
+ *
29
+ * Warden owns no database: rows go through an {@link AccessTokenStore} the
30
+ * application implements over its own table. {@link MemoryAccessTokenStore}
31
+ * serves tests and single-process tools.
32
+ */
33
+ import { type TokenDuration } from "./duration.js";
34
+ import { Secret } from "./Secret.js";
35
+ /**
36
+ * CRC-32 of a string's UTF-8 bytes, as an unsigned integer.
37
+ *
38
+ * Not a security measure — a checksum anyone can compute. It is there so a
39
+ * scanner can tell a real token from random text that happens to carry the
40
+ * prefix, which is what keeps leaked-token alerts precise.
41
+ */
42
+ export declare function crc32(input: string): number;
43
+ /** Attributes an {@link AccessToken} is built from. */
44
+ export interface AccessTokenAttributes {
45
+ /** Unique id of the row; the public half of the token value. */
46
+ identifier: string;
47
+ /** Whose token this is. */
48
+ tokenableId: string | number;
49
+ /** The kind of token, so one table can hold several (`auth_token`). */
50
+ type: string;
51
+ /** A label the user recognises it by ("CI deploy key"), if any. */
52
+ name: string | null;
53
+ /** `sha256(secret)`, hex. */
54
+ hash: string;
55
+ /** What the token may do. Absent means everything (`["*"]`). */
56
+ abilities?: string[];
57
+ createdAt: Date;
58
+ updatedAt: Date;
59
+ lastUsedAt: Date | null;
60
+ /** `null` for a token that never expires. */
61
+ expiresAt: Date | null;
62
+ /** Required with `secret`: the prefix the value starts with. */
63
+ prefix?: string;
64
+ /** The secret, only on a token just minted; it builds {@link AccessToken.value}. */
65
+ secret?: Secret<string>;
66
+ }
67
+ /**
68
+ * One access token. Hands out `value` only right after it was minted, because
69
+ * nothing stored can rebuild it.
70
+ */
71
+ export declare class AccessToken {
72
+ /**
73
+ * Split a token value into its identifier and secret, or `null` for
74
+ * anything that is not one of ours — a missing prefix, a malformed body.
75
+ * A bad token is an ordinary event, not an exception.
76
+ */
77
+ static decode(prefix: string, value: unknown): {
78
+ identifier: string;
79
+ secret: Secret<string>;
80
+ } | null;
81
+ /** A fresh secret, checksummed, and the hash to store for it. */
82
+ static seed(size: number): {
83
+ secret: Secret<string>;
84
+ hash: string;
85
+ };
86
+ /**
87
+ * Everything the persistence layer needs for a new token, without deciding
88
+ * how it is stored. `expiresIn` is in SECONDS; absent, the token never
89
+ * expires.
90
+ */
91
+ static createTransientToken(userId: string | number, size: number, expiresIn?: number): {
92
+ userId: string | number;
93
+ expiresAt: Date | undefined;
94
+ secret: Secret<string>;
95
+ hash: string;
96
+ };
97
+ readonly identifier: string;
98
+ readonly tokenableId: string | number;
99
+ readonly type: string;
100
+ readonly name: string | null;
101
+ readonly hash: string;
102
+ readonly abilities: string[];
103
+ readonly createdAt: Date;
104
+ readonly updatedAt: Date;
105
+ readonly lastUsedAt: Date | null;
106
+ readonly expiresAt: Date | null;
107
+ /** The public token value — only on a token just minted. */
108
+ readonly value?: Secret<string>;
109
+ constructor(attributes: AccessTokenAttributes);
110
+ /** Whether the token may do `ability`. `*` means every ability. */
111
+ allows(ability: string): boolean;
112
+ /** The negation of {@link allows}. */
113
+ denies(ability: string): boolean;
114
+ /** Throw `E_UNAUTHORIZED_ACCESS` unless the token may do `ability`. */
115
+ authorize(ability: string): void;
116
+ /**
117
+ * Whether the token is past its expiry. A token with none never expires; an
118
+ * expiry that is not a valid date counts as past, never as "no expiry".
119
+ */
120
+ isExpired(): boolean;
121
+ /** Constant-time check of a presented secret against the stored hash. */
122
+ verify(secret: Secret<string>): boolean;
123
+ /** What a client receives. `token` is present only on a token just minted. */
124
+ toJSON(): {
125
+ type: "bearer";
126
+ name: string | null;
127
+ token: string | undefined;
128
+ abilities: string[];
129
+ lastUsedAt: Date | null;
130
+ expiresAt: Date | null;
131
+ };
132
+ }
133
+ /** A token as persisted. The secret is NOT here — only its hash. */
134
+ export interface StoredAccessToken {
135
+ identifier: string;
136
+ tokenableId: string | number;
137
+ type: string;
138
+ name: string | null;
139
+ /** `sha256(secret)`, hex. */
140
+ hash: string;
141
+ abilities: string[];
142
+ /** Epoch milliseconds, like every timestamp below. */
143
+ createdAt: number;
144
+ updatedAt: number;
145
+ lastUsedAt: number | null;
146
+ expiresAt: number | null;
147
+ }
148
+ /** What a token table must offer. Structural: warden owns no database. */
149
+ export interface AccessTokenStore {
150
+ create(token: StoredAccessToken): Promise<void>;
151
+ find(identifier: string): Promise<StoredAccessToken | null>;
152
+ /** Record a use of the token. */
153
+ touch(identifier: string, lastUsedAt: number): Promise<void>;
154
+ /** Delete a row; answers whether one was there. */
155
+ delete(identifier: string): Promise<boolean>;
156
+ /** Every row of the user, whatever its type. */
157
+ listForUser(userId: string | number): Promise<StoredAccessToken[]>;
158
+ }
159
+ /** In-memory store — for tests and single-process tools. Not for a cluster. */
160
+ export declare class MemoryAccessTokenStore implements AccessTokenStore {
161
+ #private;
162
+ create(token: StoredAccessToken): Promise<void>;
163
+ find(identifier: string): Promise<StoredAccessToken | null>;
164
+ touch(identifier: string, lastUsedAt: number): Promise<void>;
165
+ delete(identifier: string): Promise<boolean>;
166
+ listForUser(userId: string | number): Promise<StoredAccessToken[]>;
167
+ }
168
+ /** Whose token: anything carrying the user's id. */
169
+ export interface TokenOwner {
170
+ id: string | number;
171
+ }
172
+ /** Options of a single {@link AccessTokensProvider.create} call. */
173
+ export interface CreateAccessTokenOptions {
174
+ name?: string;
175
+ /** Seconds, or a duration string (`'30 days'`). Overrides the provider's. */
176
+ expiresIn?: TokenDuration;
177
+ }
178
+ /**
179
+ * What the access-tokens guard needs from a provider. {@link AccessTokensProvider}
180
+ * is the one shipped; an application with its own token scheme implements this
181
+ * and returns {@link AccessToken}s.
182
+ */
183
+ export interface AccessTokensProviderContract {
184
+ create(user: TokenOwner, abilities?: string[], options?: CreateAccessTokenOptions): Promise<AccessToken>;
185
+ /** The token behind a presented value, or `null` if it does not verify. */
186
+ verify(tokenValue: Secret<string>): Promise<AccessToken | null>;
187
+ /** Revoke the token behind a presented value; answers whether it existed. */
188
+ invalidate(tokenValue: Secret<string>): Promise<boolean>;
189
+ }
190
+ export interface AccessTokensProviderOptions {
191
+ /** Where the rows live. */
192
+ store: AccessTokenStore;
193
+ /** The value's prefix, for secret scanners. Default `oat_`. */
194
+ prefix?: string;
195
+ /** The row type, so one table can hold several kinds. Default `auth_token`. */
196
+ type?: string;
197
+ /**
198
+ * Characters of randomness in a secret. Default 40.
199
+ *
200
+ * NAMED DEVIATION — upstream takes any length; fewer than 32 is refused
201
+ * here, because a short secret is one an attacker can guess.
202
+ */
203
+ tokenSecretLength?: number;
204
+ /** Default lifetime: seconds or a duration string. Absent: never expires. */
205
+ expiresIn?: TokenDuration;
206
+ }
207
+ /**
208
+ * Mints, verifies, lists and revokes access tokens over an
209
+ * {@link AccessTokenStore}.
210
+ */
211
+ export declare class AccessTokensProvider implements AccessTokensProviderContract {
212
+ #private;
213
+ readonly prefix: string;
214
+ readonly type: string;
215
+ readonly tokenSecretLength: number;
216
+ constructor(options: AccessTokensProviderOptions);
217
+ /**
218
+ * Mint a token for `user`. The returned token is the only one that carries
219
+ * `value`: hand it to the client now, it cannot be read back later.
220
+ *
221
+ * NAMED DEVIATION — the identifier is 128 random bits, not the row's
222
+ * auto-increment id: a guessable identifier lets anyone enumerate rows and
223
+ * aim at a given user's token.
224
+ */
225
+ create(user: TokenOwner, abilities?: string[], options?: CreateAccessTokenOptions): Promise<AccessToken>;
226
+ /** One of `user`'s tokens by identifier, or `null`. */
227
+ find(user: TokenOwner, identifier: string): Promise<AccessToken | null>;
228
+ /** Delete one of `user`'s tokens; answers how many rows went (0 or 1). */
229
+ delete(user: TokenOwner, identifier: string): Promise<number>;
230
+ /** Delete every token of `user` of this provider's type. */
231
+ deleteAll(user: TokenOwner): Promise<number>;
232
+ /**
233
+ * Every token of `user` of this provider's type: most recently used first,
234
+ * never-used ones last, newest first among equals.
235
+ */
236
+ all(user: TokenOwner): Promise<AccessToken[]>;
237
+ /**
238
+ * The token behind a presented value, or `null` for anything wrong: not one
239
+ * of ours, unknown, of another type, a secret that does not match, expired.
240
+ * The caller cannot tell these apart, which is deliberate.
241
+ *
242
+ * NAMED DEVIATION — upstream records the use before it compares the secret,
243
+ * so anyone who knows an identifier can move a token's "last used" date.
244
+ * Here only a verified token is touched.
245
+ */
246
+ verify(tokenValue: Secret<string>): Promise<AccessToken | null>;
247
+ /**
248
+ * Revoke the token behind a presented value. Answers whether one went.
249
+ *
250
+ * NAMED DEVIATION — upstream deletes from the identifier alone. Here the
251
+ * secret must match first: an identifier is not a credential, and without
252
+ * the check anyone who learned one (a log line, a token listing) could
253
+ * revoke someone else's token.
254
+ */
255
+ invalidate(tokenValue: Secret<string>): Promise<boolean>;
256
+ }
257
+ //# sourceMappingURL=AccessToken.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AccessToken.d.ts","sourceRoot":"","sources":["../src/AccessToken.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAGH,OAAO,EAA2B,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAO5E,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAarC;;;;;;GAMG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAM3C;AAYD,uDAAuD;AACvD,MAAM,WAAW,qBAAqB;IACrC,gEAAgE;IAChE,UAAU,EAAE,MAAM,CAAC;IACnB,2BAA2B;IAC3B,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,uEAAuE;IACvE,IAAI,EAAE,MAAM,CAAC;IACb,mEAAmE;IACnE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,6BAA6B;IAC7B,IA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