修改后台权限

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

34
node_modules/eciesjs/dist/keys/PrivateKey.d.ts generated vendored Normal file
View File

@@ -0,0 +1,34 @@
import type { EllipticCurve } from "../config.js";
import { PublicKey } from "./PublicKey.js";
export declare class PrivateKey {
static fromHex(hex: string, curve?: EllipticCurve): PrivateKey;
private readonly curve?;
private readonly data;
readonly publicKey: PublicKey;
/**
* @description
* In version 0.4.18, `Buffer` is returned when available, otherwise `Uint8Array`.
* From version 0.5.0, `Uint8Array` will be returned instead of `Buffer`.
*/
get secret(): Uint8Array;
constructor(secret?: Uint8Array, curve?: EllipticCurve);
toHex(): string;
/**
* Derives a shared secret from ephemeral private key (this) and receiver's public key (pk).
* @description The shared key is 32 bytes, derived with `HKDF-SHA256(senderPoint || sharedPoint)`. See implementation for details.
*
* There are some variations in different ECIES implementations:
* which key derivation function to use, compressed or uncompressed `senderPoint`/`sharedPoint`, whether to include `senderPoint`, etc.
*
* Because the entropy of `senderPoint`, `sharedPoint` is enough high[1], we don't need salt to derive keys.
*
* [1]: Two reasons: the public keys are "random" bytes (albeit secp256k1 public keys are **not uniformly** random), and ephemeral keys are generated in every encryption.
*
* @param pk - Receiver's public key.
* @param compressed - (default: `false`) Whether to use compressed or uncompressed public keys in the key derivation (secp256k1 only).
* @returns Shared secret, derived with HKDF-SHA256.
*/
encapsulate(pk: PublicKey, compressed?: boolean): Uint8Array;
multiply(pk: PublicKey, compressed?: boolean): Uint8Array;
equals(other: PrivateKey): boolean;
}

71
node_modules/eciesjs/dist/keys/PrivateKey.js generated vendored Normal file
View File

@@ -0,0 +1,71 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PrivateKey = void 0;
var utils_1 = require("@noble/ciphers/utils");
var types_js_1 = require("../types.js");
var index_js_1 = require("../utils/index.js");
var PublicKey_js_1 = require("./PublicKey.js");
var PrivateKey = /** @class */ (function () {
function PrivateKey(secret, curve) {
this.curve = curve;
if (secret === undefined) {
this.data = (0, index_js_1.getValidSecret)(curve);
}
else if ((0, index_js_1.isValidPrivateKey)(secret, curve)) {
this.data = secret;
}
else {
throw new Error("Invalid private key");
}
this.publicKey = new PublicKey_js_1.PublicKey((0, index_js_1.getPublicKey)(this.data, curve), curve);
}
PrivateKey.fromHex = function (hex, curve) {
return new PrivateKey((0, index_js_1.decodeHex)(hex), curve);
};
Object.defineProperty(PrivateKey.prototype, "secret", {
/**
* @description
* In version 0.4.18, `Buffer` is returned when available, otherwise `Uint8Array`.
* From version 0.5.0, `Uint8Array` will be returned instead of `Buffer`.
*/
get: function () {
// TODO: Uint8Array only
return types_js_1.IS_BUFFER_SUPPORTED ? Buffer.from(this.data) : this.data;
},
enumerable: false,
configurable: true
});
PrivateKey.prototype.toHex = function () {
return (0, utils_1.bytesToHex)(this.data);
};
/**
* Derives a shared secret from ephemeral private key (this) and receiver's public key (pk).
* @description The shared key is 32 bytes, derived with `HKDF-SHA256(senderPoint || sharedPoint)`. See implementation for details.
*
* There are some variations in different ECIES implementations:
* which key derivation function to use, compressed or uncompressed `senderPoint`/`sharedPoint`, whether to include `senderPoint`, etc.
*
* Because the entropy of `senderPoint`, `sharedPoint` is enough high[1], we don't need salt to derive keys.
*
* [1]: Two reasons: the public keys are "random" bytes (albeit secp256k1 public keys are **not uniformly** random), and ephemeral keys are generated in every encryption.
*
* @param pk - Receiver's public key.
* @param compressed - (default: `false`) Whether to use compressed or uncompressed public keys in the key derivation (secp256k1 only).
* @returns Shared secret, derived with HKDF-SHA256.
*/
PrivateKey.prototype.encapsulate = function (pk, compressed) {
if (compressed === void 0) { compressed = false; }
var senderPoint = this.publicKey.toBytes(compressed);
var sharedPoint = this.multiply(pk, compressed);
return (0, index_js_1.getSharedKey)(senderPoint, sharedPoint);
};
PrivateKey.prototype.multiply = function (pk, compressed) {
if (compressed === void 0) { compressed = false; }
return (0, index_js_1.getSharedPoint)(this.data, pk.toBytes(true), compressed, this.curve);
};
PrivateKey.prototype.equals = function (other) {
return (0, utils_1.equalBytes)(this.data, other.data);
};
return PrivateKey;
}());
exports.PrivateKey = PrivateKey;

26
node_modules/eciesjs/dist/keys/PublicKey.d.ts generated vendored Normal file
View File

@@ -0,0 +1,26 @@
import type { EllipticCurve } from "../config.js";
import type { PrivateKey } from "./PrivateKey.js";
export declare class PublicKey {
static fromHex(hex: string, curve?: EllipticCurve): PublicKey;
private readonly data;
private readonly dataUncompressed;
private get _uncompressed();
/** @deprecated - use `PublicKey.toBytes(false)` instead. You may also need `Buffer.from`. */
get uncompressed(): Uint8Array;
/** @deprecated - use `PublicKey.toBytes()` instead. You may also need `Buffer.from`. */
get compressed(): Uint8Array;
constructor(data: Uint8Array, curve?: EllipticCurve);
toBytes(compressed?: boolean): Uint8Array;
toHex(compressed?: boolean): string;
/**
* Derives a shared secret from receiver's private key (sk) and ephemeral public key (this).
* Opposite of `encapsulate`.
* @see PrivateKey.encapsulate
*
* @param sk - Receiver's private key.
* @param compressed - (default: `false`) Whether to use compressed or uncompressed public keys in the key derivation (secp256k1 only).
* @returns Shared secret, derived with HKDF-SHA256.
*/
decapsulate(sk: PrivateKey, compressed?: boolean): Uint8Array;
equals(other: PublicKey): boolean;
}

72
node_modules/eciesjs/dist/keys/PublicKey.js generated vendored Normal file
View File

@@ -0,0 +1,72 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PublicKey = void 0;
var utils_1 = require("@noble/ciphers/utils");
var types_js_1 = require("../types.js");
var index_js_1 = require("../utils/index.js");
var PublicKey = /** @class */ (function () {
function PublicKey(data, curve) {
// data can be either compressed or uncompressed if secp256k1
var compressed = (0, index_js_1.convertPublicKeyFormat)(data, true, curve);
var uncompressed = (0, index_js_1.convertPublicKeyFormat)(data, false, curve);
this.data = compressed;
this.dataUncompressed =
compressed.length !== uncompressed.length ? uncompressed : null;
}
PublicKey.fromHex = function (hex, curve) {
return new PublicKey((0, index_js_1.hexToPublicKey)(hex, curve), curve);
};
Object.defineProperty(PublicKey.prototype, "_uncompressed", {
get: function () {
return this.dataUncompressed !== null ? this.dataUncompressed : this.data;
},
enumerable: false,
configurable: true
});
Object.defineProperty(PublicKey.prototype, "uncompressed", {
/** @deprecated - use `PublicKey.toBytes(false)` instead. You may also need `Buffer.from`. */
get: function () {
// TODO: delete
return types_js_1.IS_BUFFER_SUPPORTED ? Buffer.from(this._uncompressed) : this._uncompressed;
},
enumerable: false,
configurable: true
});
Object.defineProperty(PublicKey.prototype, "compressed", {
/** @deprecated - use `PublicKey.toBytes()` instead. You may also need `Buffer.from`. */
get: function () {
// TODO: delete
return types_js_1.IS_BUFFER_SUPPORTED ? Buffer.from(this.data) : this.data;
},
enumerable: false,
configurable: true
});
PublicKey.prototype.toBytes = function (compressed) {
if (compressed === void 0) { compressed = true; }
return compressed ? this.data : this._uncompressed;
};
PublicKey.prototype.toHex = function (compressed) {
if (compressed === void 0) { compressed = true; }
return (0, utils_1.bytesToHex)(this.toBytes(compressed));
};
/**
* Derives a shared secret from receiver's private key (sk) and ephemeral public key (this).
* Opposite of `encapsulate`.
* @see PrivateKey.encapsulate
*
* @param sk - Receiver's private key.
* @param compressed - (default: `false`) Whether to use compressed or uncompressed public keys in the key derivation (secp256k1 only).
* @returns Shared secret, derived with HKDF-SHA256.
*/
PublicKey.prototype.decapsulate = function (sk, compressed) {
if (compressed === void 0) { compressed = false; }
var senderPoint = this.toBytes(compressed);
var sharedPoint = sk.multiply(this, compressed);
return (0, index_js_1.getSharedKey)(senderPoint, sharedPoint);
};
PublicKey.prototype.equals = function (other) {
return (0, utils_1.equalBytes)(this.data, other.data);
};
return PublicKey;
}());
exports.PublicKey = PublicKey;

2
node_modules/eciesjs/dist/keys/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
export { PrivateKey } from "./PrivateKey.js";
export { PublicKey } from "./PublicKey.js";

9
node_modules/eciesjs/dist/keys/index.js generated vendored Normal file
View File

@@ -0,0 +1,9 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PublicKey = exports.PrivateKey = void 0;
// treat Buffer as Uint8array, i.e. no call of Buffer specific functions
// finally Uint8Array only
var PrivateKey_js_1 = require("./PrivateKey.js");
Object.defineProperty(exports, "PrivateKey", { enumerable: true, get: function () { return PrivateKey_js_1.PrivateKey; } });
var PublicKey_js_1 = require("./PublicKey.js");
Object.defineProperty(exports, "PublicKey", { enumerable: true, get: function () { return PublicKey_js_1.PublicKey; } });