@platform-sec/sensitive-string-core 0.6.0 → 0.6.1

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 (153) hide show
  1. package/dist/bson.d.ts +28 -0
  2. package/dist/bson.d.ts.map +1 -0
  3. package/dist/bson.js +37 -0
  4. package/dist/bson.js.map +1 -0
  5. package/dist/classification.d.ts +69 -0
  6. package/dist/classification.d.ts.map +1 -0
  7. package/dist/classification.js +104 -0
  8. package/dist/classification.js.map +1 -0
  9. package/dist/compare.d.ts +36 -0
  10. package/dist/compare.d.ts.map +1 -0
  11. package/dist/compare.js +123 -0
  12. package/dist/compare.js.map +1 -0
  13. package/dist/context.d.ts +78 -0
  14. package/dist/context.d.ts.map +1 -0
  15. package/dist/context.js +110 -0
  16. package/dist/context.js.map +1 -0
  17. package/dist/derive.d.ts +110 -0
  18. package/dist/derive.d.ts.map +1 -0
  19. package/dist/derive.js +153 -0
  20. package/dist/derive.js.map +1 -0
  21. package/dist/destination.d.ts +120 -0
  22. package/dist/destination.d.ts.map +1 -0
  23. package/dist/destination.js +352 -0
  24. package/dist/destination.js.map +1 -0
  25. package/dist/deterministic.d.ts +145 -0
  26. package/dist/deterministic.d.ts.map +1 -0
  27. package/dist/deterministic.js +352 -0
  28. package/dist/deterministic.js.map +1 -0
  29. package/dist/dev-mode.d.ts +177 -0
  30. package/dist/dev-mode.d.ts.map +1 -0
  31. package/dist/dev-mode.js +503 -0
  32. package/dist/dev-mode.js.map +1 -0
  33. package/dist/environment.d.ts +181 -0
  34. package/dist/environment.d.ts.map +1 -0
  35. package/dist/environment.js +558 -0
  36. package/dist/environment.js.map +1 -0
  37. package/dist/errors.d.ts +23 -0
  38. package/dist/errors.d.ts.map +1 -0
  39. package/dist/errors.js +21 -0
  40. package/dist/errors.js.map +1 -0
  41. package/dist/global-state.d.ts +8 -0
  42. package/dist/global-state.d.ts.map +1 -0
  43. package/dist/global-state.js +22 -0
  44. package/dist/global-state.js.map +1 -0
  45. package/dist/hash.d.ts +74 -0
  46. package/dist/hash.d.ts.map +1 -0
  47. package/dist/hash.js +253 -0
  48. package/dist/hash.js.map +1 -0
  49. package/dist/hygiene.d.ts +242 -0
  50. package/dist/hygiene.d.ts.map +1 -0
  51. package/dist/hygiene.js +257 -0
  52. package/dist/hygiene.js.map +1 -0
  53. package/dist/index.d.ts +85 -0
  54. package/dist/index.d.ts.map +1 -0
  55. package/dist/index.js +233 -0
  56. package/dist/index.js.map +1 -0
  57. package/dist/mask.d.ts +51 -0
  58. package/dist/mask.d.ts.map +1 -0
  59. package/dist/mask.js +461 -0
  60. package/dist/mask.js.map +1 -0
  61. package/dist/own-property.d.ts +20 -0
  62. package/dist/own-property.d.ts.map +1 -0
  63. package/dist/own-property.js +34 -0
  64. package/dist/own-property.js.map +1 -0
  65. package/dist/patterns.d.ts +12 -0
  66. package/dist/patterns.d.ts.map +1 -0
  67. package/dist/patterns.js +19 -0
  68. package/dist/patterns.js.map +1 -0
  69. package/dist/policy.d.ts +51 -0
  70. package/dist/policy.d.ts.map +1 -0
  71. package/dist/policy.js +181 -0
  72. package/dist/policy.js.map +1 -0
  73. package/dist/probe.d.ts +141 -0
  74. package/dist/probe.d.ts.map +1 -0
  75. package/dist/probe.js +213 -0
  76. package/dist/probe.js.map +1 -0
  77. package/dist/redact-copy.d.ts +61 -0
  78. package/dist/redact-copy.d.ts.map +1 -0
  79. package/dist/redact-copy.js +217 -0
  80. package/dist/redact-copy.js.map +1 -0
  81. package/dist/redact.d.ts +141 -0
  82. package/dist/redact.d.ts.map +1 -0
  83. package/dist/redact.js +514 -0
  84. package/dist/redact.js.map +1 -0
  85. package/dist/redaction-marker.d.ts +48 -0
  86. package/dist/redaction-marker.d.ts.map +1 -0
  87. package/dist/redaction-marker.js +138 -0
  88. package/dist/redaction-marker.js.map +1 -0
  89. package/dist/redaction-observer.d.ts +108 -0
  90. package/dist/redaction-observer.d.ts.map +1 -0
  91. package/dist/redaction-observer.js +103 -0
  92. package/dist/redaction-observer.js.map +1 -0
  93. package/dist/redaction-scope.d.ts +21 -0
  94. package/dist/redaction-scope.d.ts.map +1 -0
  95. package/dist/redaction-scope.js +44 -0
  96. package/dist/redaction-scope.js.map +1 -0
  97. package/dist/reference.d.ts +101 -0
  98. package/dist/reference.d.ts.map +1 -0
  99. package/dist/reference.js +123 -0
  100. package/dist/reference.js.map +1 -0
  101. package/dist/regexp.d.ts +25 -0
  102. package/dist/regexp.d.ts.map +1 -0
  103. package/dist/regexp.js +61 -0
  104. package/dist/regexp.js.map +1 -0
  105. package/dist/release.d.ts +88 -0
  106. package/dist/release.d.ts.map +1 -0
  107. package/dist/release.js +108 -0
  108. package/dist/release.js.map +1 -0
  109. package/dist/reveal-budget.d.ts +148 -0
  110. package/dist/reveal-budget.d.ts.map +1 -0
  111. package/dist/reveal-budget.js +314 -0
  112. package/dist/reveal-budget.js.map +1 -0
  113. package/dist/revocation.d.ts +168 -0
  114. package/dist/revocation.d.ts.map +1 -0
  115. package/dist/revocation.js +541 -0
  116. package/dist/revocation.js.map +1 -0
  117. package/dist/sealing.d.ts +283 -0
  118. package/dist/sealing.d.ts.map +1 -0
  119. package/dist/sealing.js +523 -0
  120. package/dist/sealing.js.map +1 -0
  121. package/dist/sensitive-string.d.ts +919 -0
  122. package/dist/sensitive-string.d.ts.map +1 -0
  123. package/dist/sensitive-string.js +2260 -0
  124. package/dist/sensitive-string.js.map +1 -0
  125. package/dist/serialized.d.ts +33 -0
  126. package/dist/serialized.d.ts.map +1 -0
  127. package/dist/serialized.js +65 -0
  128. package/dist/serialized.js.map +1 -0
  129. package/dist/template.d.ts +69 -0
  130. package/dist/template.d.ts.map +1 -0
  131. package/dist/template.js +158 -0
  132. package/dist/template.js.map +1 -0
  133. package/dist/ttl.d.ts +104 -0
  134. package/dist/ttl.d.ts.map +1 -0
  135. package/dist/ttl.js +330 -0
  136. package/dist/ttl.js.map +1 -0
  137. package/dist/types.d.ts +859 -0
  138. package/dist/types.d.ts.map +1 -0
  139. package/dist/types.js +13 -0
  140. package/dist/types.js.map +1 -0
  141. package/dist/winston.d.ts +114 -0
  142. package/dist/winston.d.ts.map +1 -0
  143. package/dist/winston.js +170 -0
  144. package/dist/winston.js.map +1 -0
  145. package/dist/worker.d.ts +398 -0
  146. package/dist/worker.d.ts.map +1 -0
  147. package/dist/worker.js +861 -0
  148. package/dist/worker.js.map +1 -0
  149. package/dist/wrap.d.ts +287 -0
  150. package/dist/wrap.d.ts.map +1 -0
  151. package/dist/wrap.js +553 -0
  152. package/dist/wrap.js.map +1 -0
  153. package/package.json +10 -10
package/dist/ttl.js ADDED
@@ -0,0 +1,330 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RenewalNotAllowedError = exports.ExpiredSensitiveValueError = void 0;
4
+ exports.planExpiry = planExpiry;
5
+ exports.expiredDeadline = expiredDeadline;
6
+ exports.planRenewal = planRenewal;
7
+ exports.renewAuditDetails = renewAuditDetails;
8
+ const errors_js_1 = require("./errors.js");
9
+ /**
10
+ * The intrinsic `getTime`, so a deadline is read from a Date's internal slot.
11
+ *
12
+ * Calling it verifies the internal slot across realms and bypasses an
13
+ * instance's overridden `getTime`, which could otherwise report one deadline to
14
+ * the constructor and another to anything else that inspected the same object.
15
+ */
16
+ // eslint-disable-next-line @typescript-eslint/unbound-method -- detaching it is the point, per the note above; it is invoked with an explicit receiver via .call()
17
+ const DATE_GET_TIME = Date.prototype.getTime;
18
+ /**
19
+ * The largest time value ECMAScript can represent, from the Date specification.
20
+ *
21
+ * A duration is only bounded by the float range, so a deadline computed from one
22
+ * can land past this. Such a deadline is worse than useless: `new Date()` of it
23
+ * is an Invalid Date, `now < deadline` is true forever, and `toISOString()`
24
+ * throws when the value is serialized. A deadline that can never be reached is
25
+ * the same as no deadline at all, so it is rejected rather than accepted as one.
26
+ */
27
+ const MAX_TIMESTAMP = 8_640_000_000_000_000;
28
+ /**
29
+ * Describe a rejected option without disclosing it.
30
+ */
31
+ function describeType(value) {
32
+ return value === null ? 'null' : typeof value;
33
+ }
34
+ /**
35
+ * Raised when an operation needs the raw value of an expired instance.
36
+ *
37
+ * Callers distinguish this from a policy denial to decide whether to fetch a
38
+ * fresh secret or to fail the request outright.
39
+ */
40
+ class ExpiredSensitiveValueError extends errors_js_1.SensitiveStringError {
41
+ expiredAt;
42
+ attemptedAt;
43
+ label;
44
+ key;
45
+ name = 'ExpiredSensitiveValueError';
46
+ code = 'expired-value';
47
+ /**
48
+ * @param key - The key the value had in a worker payload, when the expiry
49
+ * was found at that boundary. The label is the value's own name and the
50
+ * key is the caller's, and a handler fixing a handoff needs the second.
51
+ */
52
+ constructor(expiredAt, attemptedAt, label, key) {
53
+ super(`Sensitive value${label !== undefined ? ` '${label}'` : ''}` +
54
+ `${key !== undefined ? ` (payload key '${key}')` : ''} expired at ` +
55
+ expiredAt.toISOString());
56
+ this.expiredAt = expiredAt;
57
+ this.attemptedAt = attemptedAt;
58
+ this.label = label;
59
+ this.key = key;
60
+ }
61
+ /** Milliseconds between the deadline and the attempted access. */
62
+ get expiredFor() {
63
+ return this.attemptedAt.getTime() - this.expiredAt.getTime();
64
+ }
65
+ }
66
+ exports.ExpiredSensitiveValueError = ExpiredSensitiveValueError;
67
+ /**
68
+ * Raised when `renew()` cannot extend a deadline.
69
+ */
70
+ class RenewalNotAllowedError extends errors_js_1.SensitiveStringError {
71
+ reason;
72
+ label;
73
+ name = 'RenewalNotAllowedError';
74
+ code = 'renewal-not-allowed';
75
+ constructor(reason, label) {
76
+ const reasons = {
77
+ policy: 'renewal is not allowed for this value',
78
+ exhausted: 'the maximum number of renewals has been reached',
79
+ 'no-expiration': 'the value has no expiration to renew',
80
+ derived: 'the value is derived from another value, so renew the value it came from',
81
+ capped: 'the lifetime cap leaves no room to extend',
82
+ };
83
+ super(`Cannot renew${label !== undefined ? ` '${label}'` : ''}: ${reasons[reason]}`);
84
+ this.reason = reason;
85
+ this.label = label;
86
+ }
87
+ }
88
+ exports.RenewalNotAllowedError = RenewalNotAllowedError;
89
+ /**
90
+ * Validate a duration in milliseconds.
91
+ *
92
+ * Zero is a valid duration and means "already expired". Rejecting it, or
93
+ * testing the option for truthiness, would turn the most conservative TTL a
94
+ * caller can ask for into no TTL at all.
95
+ */
96
+ function requireDuration(value, name) {
97
+ if (value === undefined) {
98
+ return undefined;
99
+ }
100
+ if (typeof value !== 'number') {
101
+ throw new TypeError(`SensitiveString: ${name} must be a number of milliseconds, received ${describeType(value)}`);
102
+ }
103
+ if (!Number.isFinite(value) || value < 0) {
104
+ throw new RangeError(`SensitiveString: ${name} must be a non-negative, finite number`);
105
+ }
106
+ return value;
107
+ }
108
+ /**
109
+ * Validate an absolute deadline and read it as epoch milliseconds.
110
+ *
111
+ * The result is a number, so a caller that mutates the Date it passed does not
112
+ * move a deadline the library already accepted.
113
+ */
114
+ function requireDeadline(value, name) {
115
+ if (value === undefined) {
116
+ return undefined;
117
+ }
118
+ let time;
119
+ try {
120
+ time = DATE_GET_TIME.call(value);
121
+ }
122
+ catch {
123
+ throw new TypeError(`SensitiveString: ${name} must be a Date, received ${describeType(value)}`);
124
+ }
125
+ if (!Number.isFinite(time)) {
126
+ throw new RangeError(`SensitiveString: ${name} must be a valid Date`);
127
+ }
128
+ return time;
129
+ }
130
+ /**
131
+ * Reject a computed deadline that no Date can represent.
132
+ */
133
+ function requireRepresentable(deadline, name) {
134
+ if (deadline > MAX_TIMESTAMP) {
135
+ throw new RangeError(`SensitiveString: ${name} puts the deadline past the largest representable date, ` +
136
+ new Date(MAX_TIMESTAMP).toISOString());
137
+ }
138
+ return deadline;
139
+ }
140
+ /**
141
+ * Validate a renewal budget.
142
+ */
143
+ function requireCount(value, name) {
144
+ if (value === undefined) {
145
+ return undefined;
146
+ }
147
+ if (typeof value !== 'number') {
148
+ throw new TypeError(`SensitiveString: ${name} must be a number, received ${describeType(value)}`);
149
+ }
150
+ if (!Number.isInteger(value) || value < 0) {
151
+ throw new RangeError(`SensitiveString: ${name} must be a non-negative integer`);
152
+ }
153
+ return value;
154
+ }
155
+ function requireFunction(value, name) {
156
+ if (value === undefined) {
157
+ return undefined;
158
+ }
159
+ if (typeof value !== 'function') {
160
+ throw new TypeError(`SensitiveString: ${name} must be a function, received ${describeType(value)}`);
161
+ }
162
+ return value;
163
+ }
164
+ function requireBoolean(value, name) {
165
+ if (value === undefined) {
166
+ return undefined;
167
+ }
168
+ if (typeof value !== 'boolean') {
169
+ throw new TypeError(`SensitiveString: ${name} must be a boolean, received ${describeType(value)}`);
170
+ }
171
+ return value;
172
+ }
173
+ /**
174
+ * Decide whether this value may ever be renewed.
175
+ *
176
+ * A policy that sets `allowRenewal: false` is a prohibition and the instance
177
+ * option cannot lift it, because a control every caller can switch off is not a
178
+ * control. A policy that says nothing, or that permits renewal, leaves the
179
+ * decision to the caller, whose default is the class default: credentials are
180
+ * not renewable, everything else is.
181
+ */
182
+ function resolveAllowRenewal(options, klass, policy) {
183
+ if (policy.allowRenewal === false) {
184
+ return false;
185
+ }
186
+ return (requireBoolean(options?.allowRenewal, 'allowRenewal') ??
187
+ policy.allowRenewal ??
188
+ klass !== 'credential');
189
+ }
190
+ /**
191
+ * Build the expiry state for a newly constructed value.
192
+ *
193
+ * Every deadline is decided here, at creation, so a policy change later in the
194
+ * process cannot extend the life of a value that already exists.
195
+ *
196
+ * @throws TypeError If an option has the wrong type.
197
+ * @throws RangeError If a duration is negative or a Date is invalid.
198
+ * @throws Error If both `ttl` and `expiresAt` are given, or the policy requires an expiration and none was set.
199
+ */
200
+ function planExpiry(options, klass, policy) {
201
+ const createdAt = Date.now();
202
+ const ttl = requireDuration(options?.ttl, 'ttl');
203
+ const absolute = requireDeadline(options?.expiresAt, 'expiresAt');
204
+ if (ttl !== undefined && absolute !== undefined) {
205
+ throw new Error('SensitiveString: ttl and expiresAt are mutually exclusive; pass a duration or a deadline');
206
+ }
207
+ const maxTtl = requireDuration(policy.maxTtl, 'policy maxTtl');
208
+ const lifetimeCap = maxTtl === undefined ? undefined : createdAt + maxTtl;
209
+ let deadline;
210
+ if (ttl !== undefined) {
211
+ deadline = createdAt + ttl;
212
+ }
213
+ else if (absolute !== undefined) {
214
+ deadline = absolute;
215
+ }
216
+ else {
217
+ const defaultTtl = requireDuration(policy.defaultTtl, 'policy defaultTtl');
218
+ deadline = defaultTtl === undefined ? undefined : createdAt + defaultTtl;
219
+ }
220
+ // The cap applies to a deadline the caller chose as well as to one the policy
221
+ // supplied, and it applies even when neither set a deadline at all. A class
222
+ // that caps its lifetime has no unexpiring values.
223
+ if (lifetimeCap !== undefined) {
224
+ deadline = deadline === undefined ? lifetimeCap : Math.min(deadline, lifetimeCap);
225
+ }
226
+ // After the cap, which can bring an out-of-range deadline back into range. A
227
+ // class that caps its lifetime has already decided how long is too long.
228
+ if (deadline !== undefined) {
229
+ requireRepresentable(deadline, 'the requested lifetime');
230
+ }
231
+ if (deadline === undefined && policy.requireExpiration === true) {
232
+ throw new Error(`SensitiveString: sensitivity class '${klass}' requires an expiration; ` +
233
+ 'pass ttl or expiresAt');
234
+ }
235
+ return {
236
+ deadline,
237
+ lifetimeCap,
238
+ allowRenewal: resolveAllowRenewal(options, klass, policy),
239
+ maxRenewals: requireCount(options?.maxRenewals, 'maxRenewals'),
240
+ renewalCount: 0,
241
+ onExpire: requireFunction(options?.onExpire, 'onExpire'),
242
+ notified: false,
243
+ };
244
+ }
245
+ /**
246
+ * The deadline this state has passed, or `undefined` while it is still live.
247
+ *
248
+ * A value is not usable at its own expiry instant, so the comparison is
249
+ * inclusive. When `notify` is set, the first detection fires `onExpire`; the
250
+ * flag is raised before the call, so a callback that reaches back into the
251
+ * value cannot start an unbounded recursion.
252
+ */
253
+ function expiredDeadline(state, now, notify) {
254
+ const { deadline } = state;
255
+ if (deadline === undefined || now < deadline) {
256
+ return undefined;
257
+ }
258
+ if (notify && !state.notified) {
259
+ state.notified = true;
260
+ try {
261
+ state.onExpire?.();
262
+ }
263
+ catch {
264
+ // A notification that fails must not replace the expiry error with its
265
+ // own, which would hide why the operation was denied.
266
+ }
267
+ }
268
+ return deadline;
269
+ }
270
+ /**
271
+ * The deadline a renewal would produce, without committing it.
272
+ *
273
+ * Separating the decision from the commit keeps a refused renewal out of the
274
+ * audit log, and lets an audit hook that throws stop the extension.
275
+ *
276
+ * @throws RangeError If `additionalTtl` is not a positive, finite number.
277
+ * @throws RenewalNotAllowedError If the value cannot be renewed, or the cap leaves no room.
278
+ */
279
+ function planRenewal(state, additionalTtl, options, label) {
280
+ const previous = state.deadline;
281
+ if (previous === undefined) {
282
+ throw new RenewalNotAllowedError('no-expiration', label);
283
+ }
284
+ if (!state.allowRenewal) {
285
+ throw new RenewalNotAllowedError('policy', label);
286
+ }
287
+ if (state.maxRenewals !== undefined && state.renewalCount >= state.maxRenewals) {
288
+ throw new RenewalNotAllowedError('exhausted', label);
289
+ }
290
+ if (typeof additionalTtl !== 'number') {
291
+ throw new TypeError('SensitiveString.renew: additionalTtl must be a number of milliseconds, received ' +
292
+ describeType(additionalTtl));
293
+ }
294
+ if (!Number.isFinite(additionalTtl) || additionalTtl <= 0) {
295
+ throw new RangeError('SensitiveString.renew: additionalTtl must be a positive, finite number');
296
+ }
297
+ const maxExtension = requireDeadline(options.maxExtension, 'maxExtension');
298
+ const now = Date.now();
299
+ // An expired value extends from now rather than from its lapsed deadline, so
300
+ // a renewal grants the full duration asked for instead of a fraction of it.
301
+ let next = Math.max(previous, now) + additionalTtl;
302
+ if (maxExtension !== undefined) {
303
+ next = Math.min(next, maxExtension);
304
+ }
305
+ if (state.lifetimeCap !== undefined) {
306
+ next = Math.min(next, state.lifetimeCap);
307
+ }
308
+ requireRepresentable(next, 'additionalTtl');
309
+ // Reporting success for a renewal a cap swallowed would leave the caller
310
+ // believing an expired value is live again.
311
+ if (next <= previous) {
312
+ throw new RenewalNotAllowedError('capped', label);
313
+ }
314
+ return { previous, next };
315
+ }
316
+ /**
317
+ * The audit record for a committed renewal.
318
+ *
319
+ * Deadlines are ISO strings rather than Dates: an audit sink receives a record
320
+ * it can serialize directly and cannot use to move a deadline.
321
+ */
322
+ function renewAuditDetails(state, plan) {
323
+ return Object.freeze({
324
+ operation: 'renew',
325
+ previousExpiresAt: new Date(plan.previous).toISOString(),
326
+ expiresAt: new Date(plan.next).toISOString(),
327
+ renewalCount: state.renewalCount + 1,
328
+ });
329
+ }
330
+ //# sourceMappingURL=ttl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ttl.js","sourceRoot":"","sources":["../src/ttl.ts"],"names":[],"mappings":";;;AA2QA,gCAyDC;AAUD,0CAuBC;AAqBD,kCAuDC;AAQD,8CAOC;AAzbD,2CAAmD;AAEnD;;;;;;GAMG;AACH,mKAAmK;AACnK,MAAM,aAAa,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;AAE7C;;;;;;;;GAQG;AACH,MAAM,aAAa,GAAG,qBAAqB,CAAC;AAE5C;;GAEG;AACH,SAAS,YAAY,CAAC,KAAc;IAClC,OAAO,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC;AAChD,CAAC;AAED;;;;;GAKG;AACH,MAAa,0BAA2B,SAAQ,gCAAoB;IAUvD;IACA;IACA;IACA;IAZO,IAAI,GAAG,4BAA4B,CAAC;IACpC,IAAI,GAAG,eAAe,CAAC;IAEzC;;;;OAIG;IACH,YACW,SAAe,EACf,WAAiB,EACjB,KAAc,EACd,GAAY;QAErB,KAAK,CACH,kBAAkB,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;YAC1D,GAAG,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAAC,CAAC,EAAE,cAAc;YACnE,SAAS,CAAC,WAAW,EAAE,CAC1B,CAAC;QATO,cAAS,GAAT,SAAS,CAAM;QACf,gBAAW,GAAX,WAAW,CAAM;QACjB,UAAK,GAAL,KAAK,CAAS;QACd,QAA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