修改后台权限

This commit is contained in:
yoyuzh
2026-03-24 14:30:59 +08:00
parent 00f902f475
commit b2d9db7be9
9310 changed files with 1246063 additions and 48 deletions

9
node_modules/@ecies/ciphers/dist/_node/compat.d.ts generated vendored Normal file
View File

@@ -0,0 +1,9 @@
import { type Cipher } from "@noble/ciphers/utils";
/**
* make `node:crypto`'s ciphers compatible with `@noble/ciphers`.
*
* `Cipher`'s interface is the same for both `aes-256-gcm` and `chacha20-poly1305`,
* albeit the latter is one of `CipherCCMTypes`.
* Interestingly, whether to set `plaintextLength` or not, or which value to set, has no actual effect.
*/
export declare const _compat: (algorithm: "aes-256-gcm" | "aes-256-cbc" | "chacha20-poly1305", key: Uint8Array, nonce: Uint8Array, AAD?: Uint8Array) => Cipher;

55
node_modules/@ecies/ciphers/dist/_node/compat.js generated vendored Normal file
View File

@@ -0,0 +1,55 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports._compat = void 0;
// biome-ignore-all lint/suspicious/noExplicitAny: hide type error
var node_crypto_1 = require("node:crypto");
var utils_1 = require("@noble/ciphers/utils");
var AEAD_TAG_LENGTH = 16;
// @ts-expect-error: only necessary for deno
var IS_DENO = globalThis.Deno !== undefined;
/**
* make `node:crypto`'s ciphers compatible with `@noble/ciphers`.
*
* `Cipher`'s interface is the same for both `aes-256-gcm` and `chacha20-poly1305`,
* albeit the latter is one of `CipherCCMTypes`.
* Interestingly, whether to set `plaintextLength` or not, or which value to set, has no actual effect.
*/
var _compat = function (algorithm, key, nonce, AAD) {
var isAEAD = algorithm === "aes-256-gcm" || algorithm === "chacha20-poly1305";
var authTagLength = isAEAD ? AEAD_TAG_LENGTH : 0;
// authTagLength is necessary for `chacha20-poly1305` before Node v16.17
var options = isAEAD ? { authTagLength: authTagLength } : undefined;
var encrypt = function (plainText) {
var cipher = (0, node_crypto_1.createCipheriv)(algorithm, key, nonce, options);
if (isAEAD && AAD !== undefined) {
cipher.setAAD(AAD);
}
var updated = cipher.update(plainText);
var finalized = cipher.final();
var tag = isAEAD ? cipher.getAuthTag() : new Uint8Array(0);
return (0, utils_1.concatBytes)(updated, finalized, tag);
};
var decrypt = function (cipherText) {
var rawCipherText = cipherText.subarray(0, cipherText.length - authTagLength);
var tag = cipherText.subarray(cipherText.length - authTagLength);
var decipher = (0, node_crypto_1.createDecipheriv)(algorithm, key, nonce, options);
if (isAEAD) {
if (AAD !== undefined) {
decipher.setAAD(AAD);
}
decipher.setAuthTag(tag);
}
/* v8 ignore if -- @preserve */
if (!isAEAD && IS_DENO) {
decipher.setAutoPadding(false); // See: https://github.com/denoland/deno/issues/28381
}
var updated = decipher.update(rawCipherText);
var finalized = decipher.final();
return (0, utils_1.concatBytes)(updated, finalized);
};
return {
encrypt: encrypt,
decrypt: decrypt,
};
};
exports._compat = _compat;

4
node_modules/@ecies/ciphers/dist/_node/hchacha.d.ts generated vendored Normal file
View File

@@ -0,0 +1,4 @@
/**
* Copied from `@noble/ciphers/chacha`
*/
export declare const _hchacha20: (s: Uint32Array, k: Uint32Array, i: Uint32Array, o32: Uint32Array) => void;

90
node_modules/@ecies/ciphers/dist/_node/hchacha.js generated vendored Normal file
View File

@@ -0,0 +1,90 @@
"use strict";
// biome-ignore-all format lint: copied code
// prettier-ignore
Object.defineProperty(exports, "__esModule", { value: true });
exports._hchacha20 = void 0;
/**
* Copied from `@noble/ciphers/chacha`
*/
var _hchacha20 = function (s, k, i, o32) {
var x00 = s[0], x01 = s[1], x02 = s[2], x03 = s[3], x04 = k[0], x05 = k[1], x06 = k[2], x07 = k[3], x08 = k[4], x09 = k[5], x10 = k[6], x11 = k[7], x12 = i[0], x13 = i[1], x14 = i[2], x15 = i[3];
for (var r = 0; r < 20; r += 2) {
x00 = (x00 + x04) | 0;
x12 = rotl(x12 ^ x00, 16);
x08 = (x08 + x12) | 0;
x04 = rotl(x04 ^ x08, 12);
x00 = (x00 + x04) | 0;
x12 = rotl(x12 ^ x00, 8);
x08 = (x08 + x12) | 0;
x04 = rotl(x04 ^ x08, 7);
x01 = (x01 + x05) | 0;
x13 = rotl(x13 ^ x01, 16);
x09 = (x09 + x13) | 0;
x05 = rotl(x05 ^ x09, 12);
x01 = (x01 + x05) | 0;
x13 = rotl(x13 ^ x01, 8);
x09 = (x09 + x13) | 0;
x05 = rotl(x05 ^ x09, 7);
x02 = (x02 + x06) | 0;
x14 = rotl(x14 ^ x02, 16);
x10 = (x10 + x14) | 0;
x06 = rotl(x06 ^ x10, 12);
x02 = (x02 + x06) | 0;
x14 = rotl(x14 ^ x02, 8);
x10 = (x10 + x14) | 0;
x06 = rotl(x06 ^ x10, 7);
x03 = (x03 + x07) | 0;
x15 = rotl(x15 ^ x03, 16);
x11 = (x11 + x15) | 0;
x07 = rotl(x07 ^ x11, 12);
x03 = (x03 + x07) | 0;
x15 = rotl(x15 ^ x03, 8);
x11 = (x11 + x15) | 0;
x07 = rotl(x07 ^ x11, 7);
x00 = (x00 + x05) | 0;
x15 = rotl(x15 ^ x00, 16);
x10 = (x10 + x15) | 0;
x05 = rotl(x05 ^ x10, 12);
x00 = (x00 + x05) | 0;
x15 = rotl(x15 ^ x00, 8);
x10 = (x10 + x15) | 0;
x05 = rotl(x05 ^ x10, 7);
x01 = (x01 + x06) | 0;
x12 = rotl(x12 ^ x01, 16);
x11 = (x11 + x12) | 0;
x06 = rotl(x06 ^ x11, 12);
x01 = (x01 + x06) | 0;
x12 = rotl(x12 ^ x01, 8);
x11 = (x11 + x12) | 0;
x06 = rotl(x06 ^ x11, 7);
x02 = (x02 + x07) | 0;
x13 = rotl(x13 ^ x02, 16);
x08 = (x08 + x13) | 0;
x07 = rotl(x07 ^ x08, 12);
x02 = (x02 + x07) | 0;
x13 = rotl(x13 ^ x02, 8);
x08 = (x08 + x13) | 0;
x07 = rotl(x07 ^ x08, 7);
x03 = (x03 + x04) | 0;
x14 = rotl(x14 ^ x03, 16);
x09 = (x09 + x14) | 0;
x04 = rotl(x04 ^ x09, 12);
x03 = (x03 + x04) | 0;
x14 = rotl(x14 ^ x03, 8);
x09 = (x09 + x14) | 0;
x04 = rotl(x04 ^ x09, 7);
}
var oi = 0;
o32[oi++] = x00;
o32[oi++] = x01;
o32[oi++] = x02;
o32[oi++] = x03;
o32[oi++] = x12;
o32[oi++] = x13;
o32[oi++] = x14;
o32[oi++] = x15;
};
exports._hchacha20 = _hchacha20;
var rotl = function (a, b) {
return (a << b) | (a >>> (32 - b));
};

3
node_modules/@ecies/ciphers/dist/aes/noble.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import type { Cipher } from "@noble/ciphers/utils";
export declare const aes256gcm: (key: Uint8Array, nonce: Uint8Array, AAD?: Uint8Array) => Cipher;
export declare const aes256cbc: (key: Uint8Array, nonce: Uint8Array, _AAD?: Uint8Array) => Cipher;

12
node_modules/@ecies/ciphers/dist/aes/noble.js generated vendored Normal file
View File

@@ -0,0 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.aes256cbc = exports.aes256gcm = void 0;
var aes_1 = require("@noble/ciphers/aes");
var aes256gcm = function (key, nonce, AAD) {
return (0, aes_1.gcm)(key, nonce, AAD);
};
exports.aes256gcm = aes256gcm;
var aes256cbc = function (key, nonce, _AAD) {
return (0, aes_1.cbc)(key, nonce);
};
exports.aes256cbc = aes256cbc;

3
node_modules/@ecies/ciphers/dist/aes/node.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import type { Cipher } from "@noble/ciphers/utils";
export declare const aes256gcm: (key: Uint8Array, nonce: Uint8Array, AAD?: Uint8Array) => Cipher;
export declare const aes256cbc: (key: Uint8Array, nonce: Uint8Array, _AAD?: Uint8Array) => Cipher;

12
node_modules/@ecies/ciphers/dist/aes/node.js generated vendored Normal file
View File

@@ -0,0 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.aes256cbc = exports.aes256gcm = void 0;
var compat_js_1 = require("../_node/compat.js");
var aes256gcm = function (key, nonce, AAD) {
return (0, compat_js_1._compat)("aes-256-gcm", key, nonce, AAD);
};
exports.aes256gcm = aes256gcm;
var aes256cbc = function (key, nonce, _AAD) {
return (0, compat_js_1._compat)("aes-256-cbc", key, nonce);
};
exports.aes256cbc = aes256cbc;

3
node_modules/@ecies/ciphers/dist/chacha/noble.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import type { Cipher } from "@noble/ciphers/utils";
export declare const xchacha20: (key: Uint8Array, nonce: Uint8Array, AAD?: Uint8Array) => Cipher;
export declare const chacha20: (key: Uint8Array, nonce: Uint8Array, AAD?: Uint8Array) => Cipher;

12
node_modules/@ecies/ciphers/dist/chacha/noble.js generated vendored Normal file
View File

@@ -0,0 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.chacha20 = exports.xchacha20 = void 0;
var chacha_1 = require("@noble/ciphers/chacha");
var xchacha20 = function (key, nonce, AAD) {
return (0, chacha_1.xchacha20poly1305)(key, nonce, AAD);
};
exports.xchacha20 = xchacha20;
var chacha20 = function (key, nonce, AAD) {
return (0, chacha_1.chacha20poly1305)(key, nonce, AAD);
};
exports.chacha20 = chacha20;

3
node_modules/@ecies/ciphers/dist/chacha/node.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import { type Cipher } from "@noble/ciphers/utils";
export declare const xchacha20: (key: Uint8Array, nonce: Uint8Array, AAD?: Uint8Array) => Cipher;
export declare const chacha20: (key: Uint8Array, nonce: Uint8Array, AAD?: Uint8Array) => Cipher;

26
node_modules/@ecies/ciphers/dist/chacha/node.js generated vendored Normal file
View File

@@ -0,0 +1,26 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.chacha20 = exports.xchacha20 = void 0;
var utils_1 = require("@noble/ciphers/utils");
var compat_js_1 = require("../_node/compat.js");
var hchacha_js_1 = require("../_node/hchacha.js");
var xchacha20 = function (key, nonce, AAD) {
if (nonce.length !== 24) {
throw new Error("xchacha20's nonce must be 24 bytes");
}
var constants = new Uint32Array([0x61707865, 0x3320646e, 0x79622d32, 0x6b206574]); // "expand 32-byte k"
var subKey = new Uint32Array(8);
(0, hchacha_js_1._hchacha20)(constants, (0, utils_1.u32)(key), (0, utils_1.u32)(nonce.subarray(0, 16)), subKey);
var subNonce = new Uint8Array(12);
subNonce.set([0, 0, 0, 0]);
subNonce.set(nonce.subarray(16), 4);
return (0, compat_js_1._compat)("chacha20-poly1305", (0, utils_1.u8)(subKey), subNonce, AAD);
};
exports.xchacha20 = xchacha20;
var chacha20 = function (key, nonce, AAD) {
if (nonce.length !== 12) {
throw new Error("chacha20's nonce must be 12 bytes");
}
return (0, compat_js_1._compat)("chacha20-poly1305", key, nonce, AAD);
};
exports.chacha20 = chacha20;

1
node_modules/@ecies/ciphers/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1 @@
export {};

3
node_modules/@ecies/ciphers/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
throw new Error("There is no entry-point in @ecies/ciphers. Check README.md for usage.");