forked from olcxjas-softworks/LarpixClient
update electron to v43
This commit is contained in:
parent
68ac0beedf
commit
fb6c8b6ee9
5385 changed files with 513060 additions and 123058 deletions
31
electron/node_modules/builder-util/out/ksuid.js
generated
vendored
Normal file
31
electron/node_modules/builder-util/out/ksuid.js
generated
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.generateKsuid = generateKsuid;
|
||||
const crypto_1 = require("crypto");
|
||||
// KSUID custom epoch (May 13, 2014 in Unix seconds)
|
||||
const KSUID_EPOCH = BigInt(1400000000);
|
||||
const ALPHABET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||
const BASE = BigInt(62);
|
||||
/**
|
||||
* Generates a K-Sortable Unique Identifier (KSUID): a 27-char base62 string
|
||||
* encoding 4 bytes of timestamp + 16 bytes of random data.
|
||||
* Compatible with https://github.com/segmentio/ksuid
|
||||
*/
|
||||
function generateKsuid() {
|
||||
const ts = BigInt(Math.floor(Date.now() / 1000)) - KSUID_EPOCH;
|
||||
const buf = Buffer.allocUnsafe(20);
|
||||
buf.writeUInt32BE(Number(ts), 0);
|
||||
(0, crypto_1.randomBytes)(16).copy(buf, 4);
|
||||
return base62Encode(buf);
|
||||
}
|
||||
function base62Encode(buf) {
|
||||
let n = BigInt("0x" + buf.toString("hex"));
|
||||
let result = "";
|
||||
// 27 digits: ceil(160 / log2(62)) = 27
|
||||
for (let i = 0; i < 27; i++) {
|
||||
result = ALPHABET[Number(n % BASE)] + result;
|
||||
n /= BASE;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
//# sourceMappingURL=ksuid.js.map
|
||||
Loading…
Add table
Add a link
Reference in a new issue