@netacea/netaceaintegrationbase 2.0.18 → 2.0.20

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.
package/dist/index.cjs ADDED
@@ -0,0 +1,562 @@
1
+ 'use strict';
2
+
3
+ var crypto = require('crypto');
4
+ var buffer = require('buffer');
5
+
6
+ exports.NetaceaIngestType = void 0;
7
+ (function (NetaceaIngestType) {
8
+ /**
9
+ * ORIGIN Ingest mode; data to be ingested is set by headers, so it can be forwarded via a seperate mechanism
10
+ */
11
+ NetaceaIngestType["ORIGIN"] = "ORIGIN";
12
+ /**
13
+ * HTTP Ingest mode, this is the standard implementation
14
+ */
15
+ NetaceaIngestType["HTTP"] = "HTTP";
16
+ /**
17
+ * Ingest over Kinesis, Netacea will inform you if this is required
18
+ * and will provide you with kinesis credentials.
19
+ */
20
+ NetaceaIngestType["KINESIS"] = "KINESIS";
21
+ /**
22
+ * Data to be Ingest via some mechanism native to the host/CDN, e.g. log shipping.
23
+ */
24
+ NetaceaIngestType["NATIVE"] = "NATIVE";
25
+ })(exports.NetaceaIngestType || (exports.NetaceaIngestType = {}));
26
+ exports.NetaceaLogVersion = void 0;
27
+ (function (NetaceaLogVersion) {
28
+ /**
29
+ * Current style log version
30
+ */
31
+ NetaceaLogVersion["V1"] = "V1";
32
+ /**
33
+ * V2 Log format, should only be used if Netacea instructs
34
+ */
35
+ NetaceaLogVersion["V2"] = "V2";
36
+ })(exports.NetaceaLogVersion || (exports.NetaceaLogVersion = {}));
37
+ exports.NetaceaMitigationType = void 0;
38
+ (function (NetaceaMitigationType) {
39
+ /**
40
+ * Run Netacea with mitigation mode enabled.
41
+ * This will serve Captcha pages and Forbidden pages when instructed to do so
42
+ */
43
+ NetaceaMitigationType["MITIGATE"] = "MITIGATE";
44
+ /**
45
+ * Run Netacea with Inject mode enabled.
46
+ * The end-user will only receive a cookie.
47
+ * The origin server will receive 3-4 headers,
48
+ *
49
+ * 'x-netacea-match' indicating what was matched (nothing(0), ua(1), ip(2), etc...)
50
+ *
51
+ * 'x-netacea-mitigate' indicating what action would've be taken (nothing (0), block(1), allow(2), etc...)
52
+ *
53
+ * 'x-netacea-captcha' indicating what captcha action would've been taken
54
+ *
55
+ * 'x-netacea-event-id' event id value that should be injected to the captcha
56
+ * page if using `@netacea/captchafeedback` module on the origin server
57
+ */
58
+ NetaceaMitigationType["INJECT"] = "INJECT";
59
+ /**
60
+ * Run Netacea with Ingest only mode
61
+ * No cookies will be set for the end user.
62
+ * No mitigations will be applied.
63
+ *
64
+ * **It's recommended to start in this mode!**
65
+ */
66
+ NetaceaMitigationType["INGEST"] = "INGEST";
67
+ })(exports.NetaceaMitigationType || (exports.NetaceaMitigationType = {}));
68
+ exports.NetaceaCookieV3IssueReason = void 0;
69
+ (function (NetaceaCookieV3IssueReason) {
70
+ NetaceaCookieV3IssueReason["CAPTCHA_GET"] = "captcha_get";
71
+ NetaceaCookieV3IssueReason["CAPTCHA_POST"] = "captcha_post";
72
+ NetaceaCookieV3IssueReason["EXPIRED_SESSION"] = "expired_session";
73
+ NetaceaCookieV3IssueReason["FORCED_REVALIDATION"] = "forced_revalidation";
74
+ NetaceaCookieV3IssueReason["INVALID_SESSION"] = "invalid_session";
75
+ NetaceaCookieV3IssueReason["IP_CHANGE"] = "ip_change";
76
+ NetaceaCookieV3IssueReason["NO_SESSION"] = "no_session";
77
+ })(exports.NetaceaCookieV3IssueReason || (exports.NetaceaCookieV3IssueReason = {}));
78
+
79
+ const ONE_HOUR_IN_SECONDS = 60 * 60;
80
+ function correctTimeout(timeout) {
81
+ return timeout <= 0 ? defaultTimeout : timeout;
82
+ }
83
+ function safeParseInt(value, defaultValue = 0) {
84
+ if (isNaN(value)) {
85
+ return defaultValue;
86
+ }
87
+ return parseInt(value);
88
+ }
89
+ const defaultTimeout = 3000;
90
+ function configureMitataExpiry(mitigationType, expirySeconds) {
91
+ if (expirySeconds === undefined) {
92
+ return mitigationType === exports.NetaceaMitigationType.INGEST ? ONE_HOUR_IN_SECONDS : 60;
93
+ }
94
+ return expirySeconds;
95
+ }
96
+
97
+ const COOKIEDELIMITER = '_/@#/';
98
+ const mitigationTypes = {
99
+ none: '',
100
+ block: 'block',
101
+ captcha: 'captcha',
102
+ allow: 'allow',
103
+ captchaPass: 'captchapass'
104
+ };
105
+ const netaceaHeaders = {
106
+ match: 'x-netacea-match',
107
+ mitigate: 'x-netacea-mitigate',
108
+ captcha: 'x-netacea-captcha',
109
+ mitata: 'x-netacea-mitata-value',
110
+ mitataExpiry: 'x-netacea-mitata-expiry',
111
+ mitataCaptcha: 'x-netacea-mitatacaptcha-value',
112
+ mitataCaptchaExpiry: 'x-netacea-mitatacaptcha-expiry',
113
+ eventId: 'x-netacea-event-id'
114
+ };
115
+ const matchMap = {
116
+ 0: '',
117
+ 1: 'ua_',
118
+ 2: 'ip_',
119
+ 3: 'visitor_',
120
+ 4: 'datacenter_',
121
+ 5: 'sev_',
122
+ 6: 'organisation_',
123
+ 7: 'asn_',
124
+ 8: 'country_',
125
+ 9: 'combination_'
126
+ };
127
+ const mitigateMap = {
128
+ 0: '',
129
+ 1: 'blocked',
130
+ 2: 'allow',
131
+ 3: 'hardblocked',
132
+ 4: 'block'
133
+ };
134
+ const captchaMap = {
135
+ 0: '',
136
+ 1: 'captcha_serve',
137
+ 2: 'captcha_pass',
138
+ 3: 'captcha_fail',
139
+ 4: 'captcha_cookiepass',
140
+ 5: 'captcha_cookiefail'
141
+ };
142
+ const captchaStatusCodes = {
143
+ '': 0,
144
+ 'captchaServe': 1,
145
+ 'captchaPass': 2,
146
+ 'captchaFail': 3,
147
+ 'captchaCookiePass': 4,
148
+ 'captchaCookieFail': 5
149
+ };
150
+ const bestMitigationMap = {
151
+ 0: mitigationTypes.none,
152
+ 1: mitigationTypes.block,
153
+ 2: mitigationTypes.none,
154
+ 3: mitigationTypes.block,
155
+ 4: mitigationTypes.block
156
+ };
157
+ const bestMitigationCaptchaMap = {
158
+ 1: mitigationTypes.captcha,
159
+ 2: mitigationTypes.captchaPass,
160
+ 3: mitigationTypes.captcha,
161
+ 4: mitigationTypes.allow,
162
+ 5: mitigationTypes.captcha
163
+ };
164
+ const netaceaCookieV3KeyMap = {
165
+ clientIP: 'cip',
166
+ userId: 'uid',
167
+ gracePeriod: 'grp',
168
+ cookieId: 'cid',
169
+ match: 'mat',
170
+ mitigate: 'mit',
171
+ captcha: 'cap',
172
+ issueTimestamp: 'ist',
173
+ issueReason: 'isr'
174
+ };
175
+ const netaceaCookieV3OptionalKeyMap = {
176
+ checkAllPostRequests: 'fCAPR'
177
+ };
178
+ const netaceaSettingsMap = {
179
+ checkAllPostRequests: 'checkAllPostRequests'
180
+ };
181
+
182
+ var dictionary = /*#__PURE__*/Object.freeze({
183
+ __proto__: null,
184
+ COOKIEDELIMITER: COOKIEDELIMITER,
185
+ bestMitigationCaptchaMap: bestMitigationCaptchaMap,
186
+ bestMitigationMap: bestMitigationMap,
187
+ captchaMap: captchaMap,
188
+ captchaStatusCodes: captchaStatusCodes,
189
+ matchMap: matchMap,
190
+ mitigateMap: mitigateMap,
191
+ mitigationTypes: mitigationTypes,
192
+ netaceaCookieV3KeyMap: netaceaCookieV3KeyMap,
193
+ netaceaCookieV3OptionalKeyMap: netaceaCookieV3OptionalKeyMap,
194
+ netaceaHeaders: netaceaHeaders,
195
+ netaceaSettingsMap: netaceaSettingsMap
196
+ });
197
+
198
+ // Using clientIP has no advantage when setting cookies in Ingest Only mode.
199
+ // We therefore use a dummy value in place of the IP.
200
+ // This brings its own advantage in that if the integration is switched
201
+ // from INGEST to MITIGATE, then the INGEST cookie will be treated as expired
202
+ // & a new MITIGATE cookie will be set
203
+ const ingestIgnoredIpValue = 'ignored';
204
+ const BASE_62_CHARSET = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');
205
+ const mitataCookieRegExp = /^(.*)_\/@#\/(.*)_\/@#\/(.*)_\/@#\/(.*)_\/@#\/((\d)(\d)(\d))$/;
206
+ function matchMitataCookie(netaceaCookie) {
207
+ if (netaceaCookie === undefined) {
208
+ return undefined;
209
+ }
210
+ const matches = netaceaCookie.match(mitataCookieRegExp);
211
+ if (matches !== null && matches !== undefined) {
212
+ const [, signature, expiry, userId, ipHash, mitigationType, match, mitigate, captcha] = matches;
213
+ return {
214
+ signature,
215
+ expiry,
216
+ userId,
217
+ ipHash,
218
+ mitigationType,
219
+ match: parseInt(match),
220
+ mitigate: parseInt(mitigate),
221
+ captcha: parseInt(captcha)
222
+ };
223
+ }
224
+ return undefined;
225
+ }
226
+ function generateId(length = 16, charset = BASE_62_CHARSET) {
227
+ const randomBytesBuffer = crypto.randomBytes(length - 1);
228
+ const randomString = Array.from(randomBytesBuffer)
229
+ .map(byte => charset[byte % charset.length])
230
+ .join('');
231
+ return `c${randomString}`;
232
+ }
233
+ function createMitataCookie(clientIP, userId, expiryTime, saltKey, mitCode = '000') {
234
+ if (userId === undefined) {
235
+ userId = generateId();
236
+ }
237
+ const ipHash = hexSha256(clientIP + '|' + String(expiryTime), saltKey);
238
+ const originCookieValue = [
239
+ expiryTime,
240
+ userId,
241
+ ipHash,
242
+ mitCode
243
+ ].join(COOKIEDELIMITER);
244
+ const value = hexSha256(originCookieValue, saltKey);
245
+ const cookieValue = `${value}${COOKIEDELIMITER}${originCookieValue}`;
246
+ return cookieValue;
247
+ }
248
+ function hexSha256(value, saltKey) {
249
+ const hash = crypto.createHmac('sha256', saltKey);
250
+ hash.update(value);
251
+ return buffer.Buffer.from(hash.digest('hex')).toString('base64');
252
+ }
253
+ const warmupCookie = {
254
+ // eslint-disable-next-line max-len
255
+ cookie: 'MzBkZDEwYjc0ZmIyMzQ4YmY0OTlhNTkyNjY0MDRjMjhjNmQ5Y2RlYjVkYzVkMDQyZmEzODU4MDBiN2MwNTk1OQ==_/@#/1653044256_/@#/UUID_/@#/NjEyOWIzY2JiMjE5NjcwMThlYjg5NDYzY2YyMDZlYjE0ZDg2NTRjYmMxODg5Y2I4Y2U2NGFjZDAxOTdhMGFmNA==_/@#/000',
256
+ secretKey: 'EXAMPLE_SECRET_KEY',
257
+ clientIP: '192.168.0.1'
258
+ };
259
+ function checkMitataCookie(netaceaCookie, clientIP, secretKey) {
260
+ const defaultInvalidResponse = {
261
+ mitata: undefined,
262
+ requiresReissue: false,
263
+ isExpired: false,
264
+ shouldExpire: false,
265
+ isSameIP: false,
266
+ isPrimaryHashValid: false,
267
+ captcha: 0,
268
+ match: 0,
269
+ mitigate: 0
270
+ };
271
+ if (typeof netaceaCookie !== 'string' || netaceaCookie === '') {
272
+ return defaultInvalidResponse;
273
+ }
274
+ const mitata = matchMitataCookie(netaceaCookie);
275
+ if (mitata !== undefined) {
276
+ // Check cookie signature
277
+ const mitSvcStringValue = [
278
+ mitata.expiry, mitata.userId, mitata.ipHash, mitata.mitigationType
279
+ ].join(COOKIEDELIMITER);
280
+ const currentUnixTime = Math.floor(Date.now() / 1000);
281
+ const isExpired = parseInt(mitata.expiry) < currentUnixTime;
282
+ // serve, fail, cookiefail
283
+ const isCaptchaServe = [1, 3, 5].includes(mitata.captcha);
284
+ const isHardBlocked = mitata.mitigate === 3;
285
+ const shouldExpire = isCaptchaServe || isHardBlocked;
286
+ const currentIPHash = hexSha256(clientIP + '|' + mitata.expiry, secretKey);
287
+ const isSameIP = mitata.ipHash === currentIPHash;
288
+ const valid = mitata.signature === hexSha256(mitSvcStringValue, secretKey);
289
+ return {
290
+ mitata,
291
+ requiresReissue: isExpired || !isSameIP,
292
+ isExpired,
293
+ shouldExpire,
294
+ isSameIP,
295
+ isPrimaryHashValid: valid,
296
+ match: mitata.match,
297
+ mitigate: mitata.mitigate,
298
+ captcha: mitata.captcha
299
+ };
300
+ }
301
+ return defaultInvalidResponse;
302
+ }
303
+
304
+ function createNetaceaCookieV3(cookieParams) {
305
+ const paramEntries = Object.entries(cookieParams);
306
+ const cookieParts = paramEntries
307
+ .filter(([_, v]) => v !== undefined)
308
+ .map(([key, value]) => {
309
+ if (key in netaceaCookieV3OptionalKeyMap) {
310
+ return `${netaceaCookieV3OptionalKeyMap[key]}=${encodeURIComponent(value)}`;
311
+ }
312
+ return `${netaceaCookieV3KeyMap[key]}=${encodeURIComponent(value)}`;
313
+ });
314
+ return cookieParts.join('&');
315
+ }
316
+ function cookieIsNetaceaV3Format(cookie) {
317
+ if (cookie === undefined) {
318
+ return false;
319
+ }
320
+ return cookie.split('&')
321
+ .map(part => part.split('=')[0]) // E.g. 'cip' in cip=1.2.3.4
322
+ .filter(key => !Object.values(netaceaCookieV3OptionalKeyMap).includes(key)) // Filter out optional keys
323
+ .every(key => Object.values(netaceaCookieV3KeyMap).includes(key));
324
+ }
325
+ function objectIsNetaceaCookieV3(obj) {
326
+ if (typeof obj !== 'object' || obj === null) {
327
+ return false;
328
+ }
329
+ for (const key of Object.keys(netaceaCookieV3KeyMap)) {
330
+ if (!(key in obj)) {
331
+ return false;
332
+ }
333
+ if (obj[key] === undefined) {
334
+ return false;
335
+ }
336
+ }
337
+ return true;
338
+ }
339
+ function checkNetaceaCookieV3(netaceaCookie, clientIP) {
340
+ if (netaceaCookie === undefined || netaceaCookie === '') {
341
+ return defaultInvalidResponse();
342
+ }
343
+ const netaceaCookieV3 = matchNetaceaCookieV3(netaceaCookie);
344
+ if (netaceaCookieV3 !== undefined) {
345
+ const currentUnixTime = Math.floor(Date.now() / 1000);
346
+ const expiryTimestamp = netaceaCookieV3.issueTimestamp + netaceaCookieV3.gracePeriod;
347
+ const isExpired = expiryTimestamp < currentUnixTime;
348
+ const isSameIP = clientIP === netaceaCookieV3.clientIP;
349
+ // serve, fail, cookiefail
350
+ const isCaptchaServe = [1, 3, 5].includes(netaceaCookieV3.captcha);
351
+ const isHardBlocked = netaceaCookieV3.mitigate === 3;
352
+ const shouldExpire = isCaptchaServe || isHardBlocked;
353
+ return {
354
+ mitata: netaceaCookieV3,
355
+ requiresReissue: isExpired || !isSameIP,
356
+ isExpired,
357
+ shouldExpire,
358
+ isSameIP,
359
+ isPrimaryHashValid: true,
360
+ match: netaceaCookieV3.match,
361
+ mitigate: netaceaCookieV3.mitigate,
362
+ captcha: netaceaCookieV3.captcha,
363
+ issueReason: netaceaCookieV3.issueReason
364
+ };
365
+ }
366
+ return defaultInvalidResponse();
367
+ }
368
+ function matchNetaceaCookieV3(netaceaCookie) {
369
+ if (netaceaCookie === undefined || netaceaCookie === '') {
370
+ return undefined;
371
+ }
372
+ const cookieParts = netaceaCookie.split('&');
373
+ const cookieParams = {
374
+ clientIP: '',
375
+ userId: '',
376
+ cookieId: '',
377
+ gracePeriod: 0,
378
+ match: 0,
379
+ mitigate: 0,
380
+ captcha: 0,
381
+ issueTimestamp: 0,
382
+ issueReason: '',
383
+ checkAllPostRequests: undefined
384
+ };
385
+ for (const part of cookieParts) {
386
+ const [key, rawValue] = part.split('=');
387
+ const value = decodeURIComponent(rawValue);
388
+ let fullKey = Object.keys(netaceaCookieV3KeyMap).find(k => netaceaCookieV3KeyMap[k] === key);
389
+ if (fullKey === undefined) {
390
+ fullKey = Object.keys(netaceaCookieV3OptionalKeyMap).find(k => netaceaCookieV3OptionalKeyMap[k] === key);
391
+ }
392
+ let parsedValue = value === '' ? undefined : Number(value);
393
+ if (parsedValue !== undefined && isNaN(parsedValue)) {
394
+ parsedValue = value;
395
+ }
396
+ cookieParams[fullKey] = parsedValue;
397
+ }
398
+ return cookieParams;
399
+ }
400
+ function defaultInvalidResponse() {
401
+ return {
402
+ mitata: undefined,
403
+ requiresReissue: false,
404
+ isExpired: false,
405
+ shouldExpire: false,
406
+ isSameIP: false,
407
+ isPrimaryHashValid: false,
408
+ captcha: 0,
409
+ match: 0,
410
+ mitigate: 0,
411
+ issueReason: exports.NetaceaCookieV3IssueReason.NO_SESSION
412
+ };
413
+ }
414
+
415
+ // eslint-disable-next-line complexity
416
+ function configureCookiesDomain(cookieAttr, captchaCookieAttr) {
417
+ cookieAttr = removeDuplicateAttrs(cookieAttr ?? '', true);
418
+ captchaCookieAttr = removeDuplicateAttrs(captchaCookieAttr ?? '', true);
419
+ let finalCookieAttr = cookieAttr;
420
+ let finalCaptchaCookieAttr = captchaCookieAttr;
421
+ if (cookieAttr !== undefined && captchaCookieAttr !== undefined) {
422
+ const domain = extractCookieAttr(cookieAttr, 'Domain');
423
+ const captchaDomain = extractCookieAttr(captchaCookieAttr, 'Domain');
424
+ if (domain !== undefined && captchaDomain !== undefined) {
425
+ finalCaptchaCookieAttr = captchaCookieAttr.replace(captchaDomain, domain);
426
+ }
427
+ else if (domain !== undefined && captchaDomain === undefined) {
428
+ // eslint-disable-next-line max-len
429
+ finalCaptchaCookieAttr = captchaCookieAttr + (captchaCookieAttr !== '' ? `; Domain=${domain}` : `Domain=${domain}`);
430
+ }
431
+ else if (domain === undefined && captchaDomain !== undefined) {
432
+ finalCookieAttr = cookieAttr + (cookieAttr !== '' ? `; Domain=${captchaDomain}` : `Domain=${captchaDomain}`);
433
+ }
434
+ }
435
+ else if (cookieAttr !== undefined && captchaCookieAttr === undefined) {
436
+ const domain = extractCookieAttr(cookieAttr, 'Domain');
437
+ if (domain !== undefined) {
438
+ finalCaptchaCookieAttr = `Domain=${domain}`;
439
+ }
440
+ }
441
+ else if (cookieAttr === undefined && captchaCookieAttr !== undefined) {
442
+ const captchaDomain = extractCookieAttr(captchaCookieAttr, 'Domain');
443
+ if (captchaDomain !== undefined) {
444
+ finalCookieAttr = `Domain=${captchaDomain}`;
445
+ }
446
+ }
447
+ return {
448
+ cookieAttributes: finalCookieAttr !== '' ? finalCookieAttr : undefined,
449
+ captchaCookieAttributes: finalCaptchaCookieAttr !== '' ? finalCaptchaCookieAttr : undefined
450
+ };
451
+ }
452
+ function extractAndRemoveCookieAttr(attributes, attribute) {
453
+ const attrValue = extractCookieAttr(attributes, attribute);
454
+ if (attrValue !== undefined) {
455
+ const attributesList = attributes
456
+ .replace(/ /g, '')
457
+ .replace(`${attribute}=${attrValue}`, '')
458
+ .split(';')
459
+ .filter(z => z.length > 0);
460
+ return {
461
+ extractedAttribute: attrValue,
462
+ cookieAttributes: attributesList.join('; ')
463
+ };
464
+ }
465
+ return {
466
+ extractedAttribute: undefined,
467
+ cookieAttributes: attributes
468
+ };
469
+ }
470
+ function extractCookieAttr(attributes, attribute) {
471
+ const extractedAttr = attributes
472
+ .split(';')
473
+ .map(attr => attr.trim())
474
+ .filter(attr => attr.toLowerCase().startsWith(attribute.toLowerCase()))[0];
475
+ return (extractedAttr !== undefined && extractedAttr.length > 0)
476
+ ? extractedAttr?.replace(`${attribute}=`, '')
477
+ : undefined;
478
+ }
479
+ function removeDuplicateAttrs(attributes, keepLast = false) {
480
+ if (attributes === '') {
481
+ return '';
482
+ }
483
+ const capitalizeAttrName = (attr) => attr.charAt(0).toUpperCase() + attr.slice(1);
484
+ return attributes
485
+ .replace(/ /g, '')
486
+ .split(';')
487
+ .map(capitalizeAttrName)
488
+ .filter(s => s.trim() !== '')
489
+ .filter((attr, i, attrs) => {
490
+ const getAttrName = (attr) => attr.split('=')[0];
491
+ const attrName = getAttrName(attr);
492
+ const attrNames = attrs.map(getAttrName);
493
+ if (keepLast) {
494
+ return i === attrNames.lastIndexOf(attrName);
495
+ }
496
+ return i === attrNames.indexOf(attrName);
497
+ })
498
+ .join('; ');
499
+ }
500
+
501
+ var cookieAttributes = /*#__PURE__*/Object.freeze({
502
+ __proto__: null,
503
+ configureCookiesDomain: configureCookiesDomain,
504
+ extractAndRemoveCookieAttr: extractAndRemoveCookieAttr,
505
+ extractCookieAttr: extractCookieAttr,
506
+ removeDuplicateAttrs: removeDuplicateAttrs
507
+ });
508
+
509
+ function createSetCookieString(args) {
510
+ // prefer attributes set in otherAttributes (customer configured)
511
+ const attributes = removeDuplicateAttrs([
512
+ args.otherAttributes ?? '',
513
+ `Max-Age=${args.maxAgeAttribute ?? 86400}`,
514
+ 'Path=/'
515
+ ].join('; '));
516
+ return `${args.cookieName}=${args.cookieValue}; ${attributes}`;
517
+ }
518
+ function createNetaceaSetCookieString(args) {
519
+ return createSetCookieString({
520
+ ...args,
521
+ cookieName: args.cookieName ?? '_mitata'
522
+ });
523
+ }
524
+ function createNetaceaCaptchaSetCookieString(args) {
525
+ return createSetCookieString({
526
+ ...args,
527
+ cookieName: args.cookieName ?? '_mitatacaptcha'
528
+ });
529
+ }
530
+
531
+ var netaceaSessionCookie = /*#__PURE__*/Object.freeze({
532
+ __proto__: null,
533
+ createNetaceaCaptchaSetCookieString: createNetaceaCaptchaSetCookieString,
534
+ createNetaceaSetCookieString: createNetaceaSetCookieString,
535
+ createSetCookieString: createSetCookieString
536
+ });
537
+
538
+ const lib = {
539
+ cookie: {
540
+ attributes: cookieAttributes,
541
+ netaceaSession: netaceaSessionCookie
542
+ }
543
+ };
544
+
545
+ exports.checkMitataCookie = checkMitataCookie;
546
+ exports.checkNetaceaCookieV3 = checkNetaceaCookieV3;
547
+ exports.configureMitataExpiry = configureMitataExpiry;
548
+ exports.cookieIsNetaceaV3Format = cookieIsNetaceaV3Format;
549
+ exports.correctTimeout = correctTimeout;
550
+ exports.createMitataCookie = createMitataCookie;
551
+ exports.createNetaceaCookieV3 = createNetaceaCookieV3;
552
+ exports.defaultInvalidResponse = defaultInvalidResponse;
553
+ exports.dictionary = dictionary;
554
+ exports.generateId = generateId;
555
+ exports.hexSha256 = hexSha256;
556
+ exports.ingestIgnoredIpValue = ingestIgnoredIpValue;
557
+ exports.lib = lib;
558
+ exports.matchMitataCookie = matchMitataCookie;
559
+ exports.matchNetaceaCookieV3 = matchNetaceaCookieV3;
560
+ exports.objectIsNetaceaCookieV3 = objectIsNetaceaCookieV3;
561
+ exports.safeParseInt = safeParseInt;
562
+ exports.warmupCookie = warmupCookie;