@authsignal/browser 0.0.17 → 0.0.18
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/{cjs/src/authsignal.d.ts → authsignal.d.ts} +0 -0
- package/dist/{cjs/src/helpers.d.ts → helpers.d.ts} +0 -0
- package/dist/index.d.ts +2 -0
- package/dist/{cjs/index.js → index.js} +0 -416
- package/dist/{esm/index.js → index.mjs} +0 -416
- package/dist/{cjs/src/popup-handler.d.ts → popup-handler.d.ts} +0 -0
- package/dist/{cjs/src/types.d.ts → types.d.ts} +0 -0
- package/package.json +6 -7
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/rollup.config.d.ts +0 -3
- package/dist/cjs/src/index.d.ts +0 -2
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/rollup.config.d.ts +0 -3
- package/dist/esm/src/authsignal.d.ts +0 -15
- package/dist/esm/src/helpers.d.ts +0 -11
- package/dist/esm/src/index.d.ts +0 -2
- package/dist/esm/src/popup-handler.d.ts +0 -19
- package/dist/esm/src/types.d.ts +0 -52
|
File without changes
|
|
File without changes
|
package/dist/index.d.ts
ADDED
|
@@ -21,12 +21,6 @@ function rng() {
|
|
|
21
21
|
return getRandomValues(rnds8);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
var REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
|
25
|
-
|
|
26
|
-
function validate(uuid) {
|
|
27
|
-
return typeof uuid === 'string' && REGEX.test(uuid);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
24
|
/**
|
|
31
25
|
* Convert array of 16 byte values to UUID string format of the form:
|
|
32
26
|
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
|
@@ -44,318 +38,6 @@ function unsafeStringify(arr, offset = 0) {
|
|
|
44
38
|
return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
|
|
45
39
|
}
|
|
46
40
|
|
|
47
|
-
function parse(uuid) {
|
|
48
|
-
if (!validate(uuid)) {
|
|
49
|
-
throw TypeError('Invalid UUID');
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
let v;
|
|
53
|
-
const arr = new Uint8Array(16); // Parse ########-....-....-....-............
|
|
54
|
-
|
|
55
|
-
arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24;
|
|
56
|
-
arr[1] = v >>> 16 & 0xff;
|
|
57
|
-
arr[2] = v >>> 8 & 0xff;
|
|
58
|
-
arr[3] = v & 0xff; // Parse ........-####-....-....-............
|
|
59
|
-
|
|
60
|
-
arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8;
|
|
61
|
-
arr[5] = v & 0xff; // Parse ........-....-####-....-............
|
|
62
|
-
|
|
63
|
-
arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8;
|
|
64
|
-
arr[7] = v & 0xff; // Parse ........-....-....-####-............
|
|
65
|
-
|
|
66
|
-
arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8;
|
|
67
|
-
arr[9] = v & 0xff; // Parse ........-....-....-....-############
|
|
68
|
-
// (Use "/" to avoid 32-bit truncation when bit-shifting high-order bytes)
|
|
69
|
-
|
|
70
|
-
arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff;
|
|
71
|
-
arr[11] = v / 0x100000000 & 0xff;
|
|
72
|
-
arr[12] = v >>> 24 & 0xff;
|
|
73
|
-
arr[13] = v >>> 16 & 0xff;
|
|
74
|
-
arr[14] = v >>> 8 & 0xff;
|
|
75
|
-
arr[15] = v & 0xff;
|
|
76
|
-
return arr;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function stringToBytes(str) {
|
|
80
|
-
str = unescape(encodeURIComponent(str)); // UTF8 escape
|
|
81
|
-
|
|
82
|
-
const bytes = [];
|
|
83
|
-
|
|
84
|
-
for (let i = 0; i < str.length; ++i) {
|
|
85
|
-
bytes.push(str.charCodeAt(i));
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
return bytes;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
|
|
92
|
-
const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
|
|
93
|
-
function v35(name, version, hashfunc) {
|
|
94
|
-
function generateUUID(value, namespace, buf, offset) {
|
|
95
|
-
var _namespace;
|
|
96
|
-
|
|
97
|
-
if (typeof value === 'string') {
|
|
98
|
-
value = stringToBytes(value);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
if (typeof namespace === 'string') {
|
|
102
|
-
namespace = parse(namespace);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
if (((_namespace = namespace) === null || _namespace === void 0 ? void 0 : _namespace.length) !== 16) {
|
|
106
|
-
throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)');
|
|
107
|
-
} // Compute hash of namespace and value, Per 4.3
|
|
108
|
-
// Future: Use spread syntax when supported on all platforms, e.g. `bytes =
|
|
109
|
-
// hashfunc([...namespace, ... value])`
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
let bytes = new Uint8Array(16 + value.length);
|
|
113
|
-
bytes.set(namespace);
|
|
114
|
-
bytes.set(value, namespace.length);
|
|
115
|
-
bytes = hashfunc(bytes);
|
|
116
|
-
bytes[6] = bytes[6] & 0x0f | version;
|
|
117
|
-
bytes[8] = bytes[8] & 0x3f | 0x80;
|
|
118
|
-
|
|
119
|
-
if (buf) {
|
|
120
|
-
offset = offset || 0;
|
|
121
|
-
|
|
122
|
-
for (let i = 0; i < 16; ++i) {
|
|
123
|
-
buf[offset + i] = bytes[i];
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
return buf;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
return unsafeStringify(bytes);
|
|
130
|
-
} // Function#name is not settable on some platforms (#270)
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
try {
|
|
134
|
-
generateUUID.name = name; // eslint-disable-next-line no-empty
|
|
135
|
-
} catch (err) {} // For CommonJS default export support
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
generateUUID.DNS = DNS;
|
|
139
|
-
generateUUID.URL = URL;
|
|
140
|
-
return generateUUID;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
/*
|
|
144
|
-
* Browser-compatible JavaScript MD5
|
|
145
|
-
*
|
|
146
|
-
* Modification of JavaScript MD5
|
|
147
|
-
* https://github.com/blueimp/JavaScript-MD5
|
|
148
|
-
*
|
|
149
|
-
* Copyright 2011, Sebastian Tschan
|
|
150
|
-
* https://blueimp.net
|
|
151
|
-
*
|
|
152
|
-
* Licensed under the MIT license:
|
|
153
|
-
* https://opensource.org/licenses/MIT
|
|
154
|
-
*
|
|
155
|
-
* Based on
|
|
156
|
-
* A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
|
|
157
|
-
* Digest Algorithm, as defined in RFC 1321.
|
|
158
|
-
* Version 2.2 Copyright (C) Paul Johnston 1999 - 2009
|
|
159
|
-
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
|
|
160
|
-
* Distributed under the BSD License
|
|
161
|
-
* See http://pajhome.org.uk/crypt/md5 for more info.
|
|
162
|
-
*/
|
|
163
|
-
function md5(bytes) {
|
|
164
|
-
if (typeof bytes === 'string') {
|
|
165
|
-
const msg = unescape(encodeURIComponent(bytes)); // UTF8 escape
|
|
166
|
-
|
|
167
|
-
bytes = new Uint8Array(msg.length);
|
|
168
|
-
|
|
169
|
-
for (let i = 0; i < msg.length; ++i) {
|
|
170
|
-
bytes[i] = msg.charCodeAt(i);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
return md5ToHexEncodedArray(wordsToMd5(bytesToWords(bytes), bytes.length * 8));
|
|
175
|
-
}
|
|
176
|
-
/*
|
|
177
|
-
* Convert an array of little-endian words to an array of bytes
|
|
178
|
-
*/
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
function md5ToHexEncodedArray(input) {
|
|
182
|
-
const output = [];
|
|
183
|
-
const length32 = input.length * 32;
|
|
184
|
-
const hexTab = '0123456789abcdef';
|
|
185
|
-
|
|
186
|
-
for (let i = 0; i < length32; i += 8) {
|
|
187
|
-
const x = input[i >> 5] >>> i % 32 & 0xff;
|
|
188
|
-
const hex = parseInt(hexTab.charAt(x >>> 4 & 0x0f) + hexTab.charAt(x & 0x0f), 16);
|
|
189
|
-
output.push(hex);
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
return output;
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* Calculate output length with padding and bit length
|
|
196
|
-
*/
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
function getOutputLength(inputLength8) {
|
|
200
|
-
return (inputLength8 + 64 >>> 9 << 4) + 14 + 1;
|
|
201
|
-
}
|
|
202
|
-
/*
|
|
203
|
-
* Calculate the MD5 of an array of little-endian words, and a bit length.
|
|
204
|
-
*/
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
function wordsToMd5(x, len) {
|
|
208
|
-
/* append padding */
|
|
209
|
-
x[len >> 5] |= 0x80 << len % 32;
|
|
210
|
-
x[getOutputLength(len) - 1] = len;
|
|
211
|
-
let a = 1732584193;
|
|
212
|
-
let b = -271733879;
|
|
213
|
-
let c = -1732584194;
|
|
214
|
-
let d = 271733878;
|
|
215
|
-
|
|
216
|
-
for (let i = 0; i < x.length; i += 16) {
|
|
217
|
-
const olda = a;
|
|
218
|
-
const oldb = b;
|
|
219
|
-
const oldc = c;
|
|
220
|
-
const oldd = d;
|
|
221
|
-
a = md5ff(a, b, c, d, x[i], 7, -680876936);
|
|
222
|
-
d = md5ff(d, a, b, c, x[i + 1], 12, -389564586);
|
|
223
|
-
c = md5ff(c, d, a, b, x[i + 2], 17, 606105819);
|
|
224
|
-
b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330);
|
|
225
|
-
a = md5ff(a, b, c, d, x[i + 4], 7, -176418897);
|
|
226
|
-
d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426);
|
|
227
|
-
c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341);
|
|
228
|
-
b = md5ff(b, c, d, a, x[i + 7], 22, -45705983);
|
|
229
|
-
a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416);
|
|
230
|
-
d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417);
|
|
231
|
-
c = md5ff(c, d, a, b, x[i + 10], 17, -42063);
|
|
232
|
-
b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162);
|
|
233
|
-
a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682);
|
|
234
|
-
d = md5ff(d, a, b, c, x[i + 13], 12, -40341101);
|
|
235
|
-
c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290);
|
|
236
|
-
b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329);
|
|
237
|
-
a = md5gg(a, b, c, d, x[i + 1], 5, -165796510);
|
|
238
|
-
d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632);
|
|
239
|
-
c = md5gg(c, d, a, b, x[i + 11], 14, 643717713);
|
|
240
|
-
b = md5gg(b, c, d, a, x[i], 20, -373897302);
|
|
241
|
-
a = md5gg(a, b, c, d, x[i + 5], 5, -701558691);
|
|
242
|
-
d = md5gg(d, a, b, c, x[i + 10], 9, 38016083);
|
|
243
|
-
c = md5gg(c, d, a, b, x[i + 15], 14, -660478335);
|
|
244
|
-
b = md5gg(b, c, d, a, x[i + 4], 20, -405537848);
|
|
245
|
-
a = md5gg(a, b, c, d, x[i + 9], 5, 568446438);
|
|
246
|
-
d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690);
|
|
247
|
-
c = md5gg(c, d, a, b, x[i + 3], 14, -187363961);
|
|
248
|
-
b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501);
|
|
249
|
-
a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467);
|
|
250
|
-
d = md5gg(d, a, b, c, x[i + 2], 9, -51403784);
|
|
251
|
-
c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473);
|
|
252
|
-
b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734);
|
|
253
|
-
a = md5hh(a, b, c, d, x[i + 5], 4, -378558);
|
|
254
|
-
d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463);
|
|
255
|
-
c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562);
|
|
256
|
-
b = md5hh(b, c, d, a, x[i + 14], 23, -35309556);
|
|
257
|
-
a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060);
|
|
258
|
-
d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353);
|
|
259
|
-
c = md5hh(c, d, a, b, x[i + 7], 16, -155497632);
|
|
260
|
-
b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640);
|
|
261
|
-
a = md5hh(a, b, c, d, x[i + 13], 4, 681279174);
|
|
262
|
-
d = md5hh(d, a, b, c, x[i], 11, -358537222);
|
|
263
|
-
c = md5hh(c, d, a, b, x[i + 3], 16, -722521979);
|
|
264
|
-
b = md5hh(b, c, d, a, x[i + 6], 23, 76029189);
|
|
265
|
-
a = md5hh(a, b, c, d, x[i + 9], 4, -640364487);
|
|
266
|
-
d = md5hh(d, a, b, c, x[i + 12], 11, -421815835);
|
|
267
|
-
c = md5hh(c, d, a, b, x[i + 15], 16, 530742520);
|
|
268
|
-
b = md5hh(b, c, d, a, x[i + 2], 23, -995338651);
|
|
269
|
-
a = md5ii(a, b, c, d, x[i], 6, -198630844);
|
|
270
|
-
d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415);
|
|
271
|
-
c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905);
|
|
272
|
-
b = md5ii(b, c, d, a, x[i + 5], 21, -57434055);
|
|
273
|
-
a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571);
|
|
274
|
-
d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606);
|
|
275
|
-
c = md5ii(c, d, a, b, x[i + 10], 15, -1051523);
|
|
276
|
-
b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799);
|
|
277
|
-
a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359);
|
|
278
|
-
d = md5ii(d, a, b, c, x[i + 15], 10, -30611744);
|
|
279
|
-
c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380);
|
|
280
|
-
b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649);
|
|
281
|
-
a = md5ii(a, b, c, d, x[i + 4], 6, -145523070);
|
|
282
|
-
d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379);
|
|
283
|
-
c = md5ii(c, d, a, b, x[i + 2], 15, 718787259);
|
|
284
|
-
b = md5ii(b, c, d, a, x[i + 9], 21, -343485551);
|
|
285
|
-
a = safeAdd(a, olda);
|
|
286
|
-
b = safeAdd(b, oldb);
|
|
287
|
-
c = safeAdd(c, oldc);
|
|
288
|
-
d = safeAdd(d, oldd);
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
return [a, b, c, d];
|
|
292
|
-
}
|
|
293
|
-
/*
|
|
294
|
-
* Convert an array bytes to an array of little-endian words
|
|
295
|
-
* Characters >255 have their high-byte silently ignored.
|
|
296
|
-
*/
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
function bytesToWords(input) {
|
|
300
|
-
if (input.length === 0) {
|
|
301
|
-
return [];
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
const length8 = input.length * 8;
|
|
305
|
-
const output = new Uint32Array(getOutputLength(length8));
|
|
306
|
-
|
|
307
|
-
for (let i = 0; i < length8; i += 8) {
|
|
308
|
-
output[i >> 5] |= (input[i / 8] & 0xff) << i % 32;
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
return output;
|
|
312
|
-
}
|
|
313
|
-
/*
|
|
314
|
-
* Add integers, wrapping at 2^32. This uses 16-bit operations internally
|
|
315
|
-
* to work around bugs in some JS interpreters.
|
|
316
|
-
*/
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
function safeAdd(x, y) {
|
|
320
|
-
const lsw = (x & 0xffff) + (y & 0xffff);
|
|
321
|
-
const msw = (x >> 16) + (y >> 16) + (lsw >> 16);
|
|
322
|
-
return msw << 16 | lsw & 0xffff;
|
|
323
|
-
}
|
|
324
|
-
/*
|
|
325
|
-
* Bitwise rotate a 32-bit number to the left.
|
|
326
|
-
*/
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
function bitRotateLeft(num, cnt) {
|
|
330
|
-
return num << cnt | num >>> 32 - cnt;
|
|
331
|
-
}
|
|
332
|
-
/*
|
|
333
|
-
* These functions implement the four basic operations the algorithm uses.
|
|
334
|
-
*/
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
function md5cmn(q, a, b, x, s, t) {
|
|
338
|
-
return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b);
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
function md5ff(a, b, c, d, x, s, t) {
|
|
342
|
-
return md5cmn(b & c | ~b & d, a, b, x, s, t);
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
function md5gg(a, b, c, d, x, s, t) {
|
|
346
|
-
return md5cmn(b & d | c & ~d, a, b, x, s, t);
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
function md5hh(a, b, c, d, x, s, t) {
|
|
350
|
-
return md5cmn(b ^ c ^ d, a, b, x, s, t);
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
function md5ii(a, b, c, d, x, s, t) {
|
|
354
|
-
return md5cmn(c ^ (b | ~d), a, b, x, s, t);
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
v35('v3', 0x30, md5);
|
|
358
|
-
|
|
359
41
|
const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
360
42
|
var native = {
|
|
361
43
|
randomUUID
|
|
@@ -385,103 +67,6 @@ function v4(options, buf, offset) {
|
|
|
385
67
|
return unsafeStringify(rnds);
|
|
386
68
|
}
|
|
387
69
|
|
|
388
|
-
// Adapted from Chris Veness' SHA1 code at
|
|
389
|
-
// http://www.movable-type.co.uk/scripts/sha1.html
|
|
390
|
-
function f(s, x, y, z) {
|
|
391
|
-
switch (s) {
|
|
392
|
-
case 0:
|
|
393
|
-
return x & y ^ ~x & z;
|
|
394
|
-
|
|
395
|
-
case 1:
|
|
396
|
-
return x ^ y ^ z;
|
|
397
|
-
|
|
398
|
-
case 2:
|
|
399
|
-
return x & y ^ x & z ^ y & z;
|
|
400
|
-
|
|
401
|
-
case 3:
|
|
402
|
-
return x ^ y ^ z;
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
function ROTL(x, n) {
|
|
407
|
-
return x << n | x >>> 32 - n;
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
function sha1(bytes) {
|
|
411
|
-
const K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6];
|
|
412
|
-
const H = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0];
|
|
413
|
-
|
|
414
|
-
if (typeof bytes === 'string') {
|
|
415
|
-
const msg = unescape(encodeURIComponent(bytes)); // UTF8 escape
|
|
416
|
-
|
|
417
|
-
bytes = [];
|
|
418
|
-
|
|
419
|
-
for (let i = 0; i < msg.length; ++i) {
|
|
420
|
-
bytes.push(msg.charCodeAt(i));
|
|
421
|
-
}
|
|
422
|
-
} else if (!Array.isArray(bytes)) {
|
|
423
|
-
// Convert Array-like to Array
|
|
424
|
-
bytes = Array.prototype.slice.call(bytes);
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
bytes.push(0x80);
|
|
428
|
-
const l = bytes.length / 4 + 2;
|
|
429
|
-
const N = Math.ceil(l / 16);
|
|
430
|
-
const M = new Array(N);
|
|
431
|
-
|
|
432
|
-
for (let i = 0; i < N; ++i) {
|
|
433
|
-
const arr = new Uint32Array(16);
|
|
434
|
-
|
|
435
|
-
for (let j = 0; j < 16; ++j) {
|
|
436
|
-
arr[j] = bytes[i * 64 + j * 4] << 24 | bytes[i * 64 + j * 4 + 1] << 16 | bytes[i * 64 + j * 4 + 2] << 8 | bytes[i * 64 + j * 4 + 3];
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
M[i] = arr;
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
M[N - 1][14] = (bytes.length - 1) * 8 / Math.pow(2, 32);
|
|
443
|
-
M[N - 1][14] = Math.floor(M[N - 1][14]);
|
|
444
|
-
M[N - 1][15] = (bytes.length - 1) * 8 & 0xffffffff;
|
|
445
|
-
|
|
446
|
-
for (let i = 0; i < N; ++i) {
|
|
447
|
-
const W = new Uint32Array(80);
|
|
448
|
-
|
|
449
|
-
for (let t = 0; t < 16; ++t) {
|
|
450
|
-
W[t] = M[i][t];
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
for (let t = 16; t < 80; ++t) {
|
|
454
|
-
W[t] = ROTL(W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16], 1);
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
let a = H[0];
|
|
458
|
-
let b = H[1];
|
|
459
|
-
let c = H[2];
|
|
460
|
-
let d = H[3];
|
|
461
|
-
let e = H[4];
|
|
462
|
-
|
|
463
|
-
for (let t = 0; t < 80; ++t) {
|
|
464
|
-
const s = Math.floor(t / 20);
|
|
465
|
-
const T = ROTL(a, 5) + f(s, b, c, d) + e + K[s] + W[t] >>> 0;
|
|
466
|
-
e = d;
|
|
467
|
-
d = c;
|
|
468
|
-
c = ROTL(b, 30) >>> 0;
|
|
469
|
-
b = a;
|
|
470
|
-
a = T;
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
H[0] = H[0] + a >>> 0;
|
|
474
|
-
H[1] = H[1] + b >>> 0;
|
|
475
|
-
H[2] = H[2] + c >>> 0;
|
|
476
|
-
H[3] = H[3] + d >>> 0;
|
|
477
|
-
H[4] = H[4] + e >>> 0;
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
return [H[0] >> 24 & 0xff, H[0] >> 16 & 0xff, H[0] >> 8 & 0xff, H[0] & 0xff, H[1] >> 24 & 0xff, H[1] >> 16 & 0xff, H[1] >> 8 & 0xff, H[1] & 0xff, H[2] >> 24 & 0xff, H[2] >> 16 & 0xff, H[2] >> 8 & 0xff, H[2] & 0xff, H[3] >> 24 & 0xff, H[3] >> 16 & 0xff, H[3] >> 8 & 0xff, H[3] & 0xff, H[4] >> 24 & 0xff, H[4] >> 16 & 0xff, H[4] >> 8 & 0xff, H[4] & 0xff];
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
v35('v5', 0x50, sha1);
|
|
484
|
-
|
|
485
70
|
var setCookie = function (_a) {
|
|
486
71
|
var name = _a.name, value = _a.value, expire = _a.expire, domain = _a.domain, secure = _a.secure;
|
|
487
72
|
var expireString = expire === Infinity ? " expires=Fri, 31 Dec 9999 23:59:59 GMT" : "; max-age=" + expire;
|
|
@@ -1071,4 +656,3 @@ var Authsignal = /** @class */ (function () {
|
|
|
1071
656
|
}());
|
|
1072
657
|
|
|
1073
658
|
exports.Authsignal = Authsignal;
|
|
1074
|
-
//# sourceMappingURL=index.js.map
|