refactor: move brother_node development artifact to dev/test-nodes subdirectory
Development Artifact Cleanup: ✅ BROTHER_NODE REORGANIZATION: Moved development test node to appropriate location - dev/test-nodes/brother_node/: Moved from root directory for better organization - Contains development configuration, test logs, and test chain data - No impact on production systems - purely development/testing artifact ✅ DEVELOPMENT ARTIFACTS IDENTIFIED: - Chain ID: aitbc-brother-chain (test/development chain) - Ports: 8010 (P2P) and 8011 (RPC) - different from production - Environment: .env file with test configuration - Logs: rpc.log and node.log from development testing session (March 15, 2026) ✅ ROOT DIRECTORY CLEANUP: Removed development clutter from production directory - brother_node/ moved to dev/test-nodes/brother_node/ - Root directory now contains only production-ready components - Development artifacts properly organized in dev/ subdirectory DIRECTORY STRUCTURE IMPROVEMENT: 📁 dev/test-nodes/: Development and testing node configurations 🏗️ Root Directory: Clean production structure with only essential components 🧪 Development Isolation: Test environments separated from production BENEFITS: ✅ Clean Production Directory: No development artifacts in root ✅ Better Organization: Development nodes grouped in dev/ subdirectory ✅ Clear Separation: Production vs development environments clearly distinguished ✅ Maintainability: Easier to identify and manage development components RESULT: Successfully moved brother_node development artifact to dev/test-nodes/ subdirectory, cleaning up the root directory while preserving development testing environment for future use.
This commit is contained in:
15
dev/env/node_modules/ethers/lib.esm/crypto/crypto-browser.d.ts
generated
vendored
Executable file
15
dev/env/node_modules/ethers/lib.esm/crypto/crypto-browser.d.ts
generated
vendored
Executable file
@@ -0,0 +1,15 @@
|
||||
declare global {
|
||||
interface Window {
|
||||
}
|
||||
const window: Window;
|
||||
const self: Window;
|
||||
}
|
||||
export interface CryptoHasher {
|
||||
update(data: Uint8Array): CryptoHasher;
|
||||
digest(): Uint8Array;
|
||||
}
|
||||
export declare function createHash(algo: string): CryptoHasher;
|
||||
export declare function createHmac(_algo: string, key: Uint8Array): CryptoHasher;
|
||||
export declare function pbkdf2Sync(password: Uint8Array, salt: Uint8Array, iterations: number, keylen: number, _algo: "sha256" | "sha512"): Uint8Array;
|
||||
export declare function randomBytes(length: number): Uint8Array;
|
||||
//# sourceMappingURL=crypto-browser.d.ts.map
|
||||
1
dev/env/node_modules/ethers/lib.esm/crypto/crypto-browser.d.ts.map
generated
vendored
Executable file
1
dev/env/node_modules/ethers/lib.esm/crypto/crypto-browser.d.ts.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"crypto-browser.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/crypto-browser.ts"],"names":[],"mappings":"AAUA,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,MAAM;KAAI;IAEpB,MAAM,MAAM,EAAE,MAAM,CAAC;IACrB,MAAM,IAAI,EAAE,MAAM,CAAC;CACtB;AAcD,MAAM,WAAW,YAAY;IACzB,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,YAAY,CAAC;IACvC,MAAM,IAAI,UAAU,CAAC;CACxB;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAMrD;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,GAAG,YAAY,CAIvE;AAED,wBAAgB,UAAU,CAAC,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAI7I;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAStD"}
|
||||
48
dev/env/node_modules/ethers/lib.esm/crypto/crypto-browser.js
generated
vendored
Executable file
48
dev/env/node_modules/ethers/lib.esm/crypto/crypto-browser.js
generated
vendored
Executable file
@@ -0,0 +1,48 @@
|
||||
/* Browser Crypto Shims */
|
||||
import { hmac } from "@noble/hashes/hmac";
|
||||
import { pbkdf2 } from "@noble/hashes/pbkdf2";
|
||||
import { sha256 } from "@noble/hashes/sha256";
|
||||
import { sha512 } from "@noble/hashes/sha512";
|
||||
import { assert, assertArgument } from "../utils/index.js";
|
||||
function getGlobal() {
|
||||
if (typeof self !== 'undefined') {
|
||||
return self;
|
||||
}
|
||||
if (typeof window !== 'undefined') {
|
||||
return window;
|
||||
}
|
||||
if (typeof global !== 'undefined') {
|
||||
return global;
|
||||
}
|
||||
throw new Error('unable to locate global object');
|
||||
}
|
||||
;
|
||||
const anyGlobal = getGlobal();
|
||||
const crypto = anyGlobal.crypto || anyGlobal.msCrypto;
|
||||
export function createHash(algo) {
|
||||
switch (algo) {
|
||||
case "sha256": return sha256.create();
|
||||
case "sha512": return sha512.create();
|
||||
}
|
||||
assertArgument(false, "invalid hashing algorithm name", "algorithm", algo);
|
||||
}
|
||||
export function createHmac(_algo, key) {
|
||||
const algo = ({ sha256, sha512 }[_algo]);
|
||||
assertArgument(algo != null, "invalid hmac algorithm", "algorithm", _algo);
|
||||
return hmac.create(algo, key);
|
||||
}
|
||||
export function pbkdf2Sync(password, salt, iterations, keylen, _algo) {
|
||||
const algo = ({ sha256, sha512 }[_algo]);
|
||||
assertArgument(algo != null, "invalid pbkdf2 algorithm", "algorithm", _algo);
|
||||
return pbkdf2(algo, password, salt, { c: iterations, dkLen: keylen });
|
||||
}
|
||||
export function randomBytes(length) {
|
||||
assert(crypto != null, "platform does not support secure random numbers", "UNSUPPORTED_OPERATION", {
|
||||
operation: "randomBytes"
|
||||
});
|
||||
assertArgument(Number.isInteger(length) && length > 0 && length <= 1024, "invalid length", "length", length);
|
||||
const result = new Uint8Array(length);
|
||||
crypto.getRandomValues(result);
|
||||
return result;
|
||||
}
|
||||
//# sourceMappingURL=crypto-browser.js.map
|
||||
1
dev/env/node_modules/ethers/lib.esm/crypto/crypto-browser.js.map
generated
vendored
Executable file
1
dev/env/node_modules/ethers/lib.esm/crypto/crypto-browser.js.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"crypto-browser.js","sourceRoot":"","sources":["../../src.ts/crypto/crypto-browser.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAE1B,OAAO,EAAE,I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AI,EAAE,GAAG,CAAC,CAAC;AAClC,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,QAAoB,EAAE,IAAgB,EAAE,UAAkB,EAAE,MAAc,EAAE,KAA0B;IAC7H,MAAM,IAAI,GAAG,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IACzC,cAAc,CAAC,IAAI,IAAI,IAAI,EAAE,0BAA0B,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;IAC7E,OAAO,MAAM,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;AAC1E,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,MAAc;IACtC,MAAM,CAAC,MAAM,IAAI,IAAI,EAAE,iDAAiD,EAAE,uBAAuB,EAAE;QAC/F,SAAS,EAAE,aAAa;KAAE,CAAC,CAAC;IAEhC,cAAc,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,IAAI,MAAM,IAAI,IAAI,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IAE7G,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;IACtC,MAAM,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;IAC/B,OAAO,MAAM,CAAC;AAClB,CAAC"}
|
||||
2
dev/env/node_modules/ethers/lib.esm/crypto/crypto.d.ts
generated
vendored
Executable file
2
dev/env/node_modules/ethers/lib.esm/crypto/crypto.d.ts
generated
vendored
Executable file
@@ -0,0 +1,2 @@
|
||||
export { createHash, createHmac, pbkdf2Sync, randomBytes } from "crypto";
|
||||
//# sourceMappingURL=crypto.d.ts.map
|
||||
1
dev/env/node_modules/ethers/lib.esm/crypto/crypto.d.ts.map
generated
vendored
Executable file
1
dev/env/node_modules/ethers/lib.esm/crypto/crypto.d.ts.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/crypto.ts"],"names":[],"mappings":"AACA,OAAO,EACH,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAClD,MAAM,QAAQ,CAAC"}
|
||||
2
dev/env/node_modules/ethers/lib.esm/crypto/crypto.js
generated
vendored
Executable file
2
dev/env/node_modules/ethers/lib.esm/crypto/crypto.js
generated
vendored
Executable file
@@ -0,0 +1,2 @@
|
||||
export { createHash, createHmac, pbkdf2Sync, randomBytes } from "crypto";
|
||||
//# sourceMappingURL=crypto.js.map
|
||||
1
dev/env/node_modules/ethers/lib.esm/crypto/crypto.js.map
generated
vendored
Executable file
1
dev/env/node_modules/ethers/lib.esm/crypto/crypto.js.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"crypto.js","sourceRoot":"","sources":["../../src.ts/crypto/crypto.ts"],"names":[],"mappings":"AACA,OAAO,EACH,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAClD,MAAM,QAAQ,CAAC"}
|
||||
25
dev/env/node_modules/ethers/lib.esm/crypto/hmac.d.ts
generated
vendored
Executable file
25
dev/env/node_modules/ethers/lib.esm/crypto/hmac.d.ts
generated
vendored
Executable file
@@ -0,0 +1,25 @@
|
||||
import type { BytesLike } from "../utils/index.js";
|
||||
/**
|
||||
* Return the HMAC for %%data%% using the %%key%% key with the underlying
|
||||
* %%algo%% used for compression.
|
||||
*
|
||||
* @example:
|
||||
* key = id("some-secret")
|
||||
*
|
||||
* // Compute the HMAC
|
||||
* computeHmac("sha256", key, "0x1337")
|
||||
* //_result:
|
||||
*
|
||||
* // To compute the HMAC of UTF-8 data, the data must be
|
||||
* // converted to UTF-8 bytes
|
||||
* computeHmac("sha256", key, toUtf8Bytes("Hello World"))
|
||||
* //_result:
|
||||
*
|
||||
*/
|
||||
export declare function computeHmac(algorithm: "sha256" | "sha512", _key: BytesLike, _data: BytesLike): string;
|
||||
export declare namespace computeHmac {
|
||||
var _: (algorithm: "sha256" | "sha512", key: Uint8Array, data: Uint8Array) => BytesLike;
|
||||
var lock: () => void;
|
||||
var register: (func: (algorithm: "sha256" | "sha512", key: Uint8Array, data: Uint8Array) => BytesLike) => void;
|
||||
}
|
||||
//# sourceMappingURL=hmac.d.ts.map
|
||||
1
dev/env/node_modules/ethers/lib.esm/crypto/hmac.d.ts.map
generated
vendored
Executable file
1
dev/env/node_modules/ethers/lib.esm/crypto/hmac.d.ts.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"hmac.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/hmac.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAWnD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,QAAQ,GAAG,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,GAAG,MAAM,CAIrG;yBAJe,WAAW"}
|
||||
47
dev/env/node_modules/ethers/lib.esm/crypto/hmac.js
generated
vendored
Executable file
47
dev/env/node_modules/ethers/lib.esm/crypto/hmac.js
generated
vendored
Executable file
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* An **HMAC** enables verification that a given key was used
|
||||
* to authenticate a payload.
|
||||
*
|
||||
* See: [[link-wiki-hmac]]
|
||||
*
|
||||
* @_subsection: api/crypto:HMAC [about-hmac]
|
||||
*/
|
||||
import { createHmac } from "./crypto.js";
|
||||
import { getBytes, hexlify } from "../utils/index.js";
|
||||
let locked = false;
|
||||
const _computeHmac = function (algorithm, key, data) {
|
||||
return createHmac(algorithm, key).update(data).digest();
|
||||
};
|
||||
let __computeHmac = _computeHmac;
|
||||
/**
|
||||
* Return the HMAC for %%data%% using the %%key%% key with the underlying
|
||||
* %%algo%% used for compression.
|
||||
*
|
||||
* @example:
|
||||
* key = id("some-secret")
|
||||
*
|
||||
* // Compute the HMAC
|
||||
* computeHmac("sha256", key, "0x1337")
|
||||
* //_result:
|
||||
*
|
||||
* // To compute the HMAC of UTF-8 data, the data must be
|
||||
* // converted to UTF-8 bytes
|
||||
* computeHmac("sha256", key, toUtf8Bytes("Hello World"))
|
||||
* //_result:
|
||||
*
|
||||
*/
|
||||
export function computeHmac(algorithm, _key, _data) {
|
||||
const key = getBytes(_key, "key");
|
||||
const data = getBytes(_data, "data");
|
||||
return hexlify(__computeHmac(algorithm, key, data));
|
||||
}
|
||||
computeHmac._ = _computeHmac;
|
||||
computeHmac.lock = function () { locked = true; };
|
||||
computeHmac.register = function (func) {
|
||||
if (locked) {
|
||||
throw new Error("computeHmac is locked");
|
||||
}
|
||||
__computeHmac = func;
|
||||
};
|
||||
Object.freeze(computeHmac);
|
||||
//# sourceMappingURL=hmac.js.map
|
||||
1
dev/env/node_modules/ethers/lib.esm/crypto/hmac.js.map
generated
vendored
Executable file
1
dev/env/node_modules/ethers/lib.esm/crypto/hmac.js.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"hmac.js","sourceRoot":"","sources":["../../src.ts/crypto/hmac.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAKtD,IAAI,MAAM,GAAG,KAAK,CAAC;AAEnB,MAAM,YAAY,GAAG,UAAS,SAA8B,EAAE,GAAe,EAAE,IAAgB;IAC3F,OAAO,UAAU,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;AAC5D,CAAC,CAAA;AAED,IAAI,aAAa,GAAG,YAAY,CAAC;AAEjC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,WAAW,CAAC,SAA8B,EAAE,IAAe,EAAE,KAAgB;IACzF,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAClC,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACrC,OAAO,OAAO,CAAC,aAAa,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;AACxD,CAAC;AACD,WAAW,CAAC,CAAC,GAAG,YAAY,CAAC;AAC7B,WAAW,CAAC,IAAI,GAAI,cAAa,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;AACjD,WAAW,CAAC,QAAQ,GAAG,UAAS,IAAsF;IAClH,IAAI,MAAM,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;KAAE;IACzD,aAAa,GAAG,IAAI,CAAC;AACzB,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC"}
|
||||
25
dev/env/node_modules/ethers/lib.esm/crypto/index.d.ts
generated
vendored
Executable file
25
dev/env/node_modules/ethers/lib.esm/crypto/index.d.ts
generated
vendored
Executable file
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* A fundamental building block of Ethereum is the underlying
|
||||
* cryptographic primitives.
|
||||
*
|
||||
* @_section: api/crypto:Cryptographic Functions [about-crypto]
|
||||
*/
|
||||
import { computeHmac } from "./hmac.js";
|
||||
import { keccak256 } from "./keccak.js";
|
||||
import { ripemd160 } from "./ripemd160.js";
|
||||
import { pbkdf2 } from "./pbkdf2.js";
|
||||
import { randomBytes } from "./random.js";
|
||||
import { scrypt, scryptSync } from "./scrypt.js";
|
||||
import { sha256, sha512 } from "./sha2.js";
|
||||
export { computeHmac, randomBytes, keccak256, ripemd160, sha256, sha512, pbkdf2, scrypt, scryptSync };
|
||||
export { SigningKey } from "./signing-key.js";
|
||||
export { Signature } from "./signature.js";
|
||||
/**
|
||||
* Once called, prevents any future change to the underlying cryptographic
|
||||
* primitives using the ``.register`` feature for hooks.
|
||||
*/
|
||||
declare function lock(): void;
|
||||
export { lock };
|
||||
export type { ProgressCallback } from "./scrypt.js";
|
||||
export type { SignatureLike } from "./signature.js";
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
dev/env/node_modules/ethers/lib.esm/crypto/index.d.ts.map
generated
vendored
Executable file
1
dev/env/node_modules/ethers/lib.esm/crypto/index.d.ts.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,EACH,WAAW,EAEX,WAAW,EAEX,SAAS,EACT,SAAS,EACT,MAAM,EAAE,MAAM,EAEd,MAAM,EACN,MAAM,EAAE,UAAU,EACrB,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;;GAGG;AACH,iBAAS,IAAI,IAAI,IAAI,CAWpB;AAED,OAAO,EAAE,IAAI,EAAE,CAAC;AAKhB,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC"}
|
||||
36
dev/env/node_modules/ethers/lib.esm/crypto/index.js
generated
vendored
Executable file
36
dev/env/node_modules/ethers/lib.esm/crypto/index.js
generated
vendored
Executable file
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* A fundamental building block of Ethereum is the underlying
|
||||
* cryptographic primitives.
|
||||
*
|
||||
* @_section: api/crypto:Cryptographic Functions [about-crypto]
|
||||
*/
|
||||
null;
|
||||
// We import all these so we can export lock()
|
||||
import { computeHmac } from "./hmac.js";
|
||||
import { keccak256 } from "./keccak.js";
|
||||
import { ripemd160 } from "./ripemd160.js";
|
||||
import { pbkdf2 } from "./pbkdf2.js";
|
||||
import { randomBytes } from "./random.js";
|
||||
import { scrypt, scryptSync } from "./scrypt.js";
|
||||
import { sha256, sha512 } from "./sha2.js";
|
||||
export { computeHmac, randomBytes, keccak256, ripemd160, sha256, sha512, pbkdf2, scrypt, scryptSync };
|
||||
export { SigningKey } from "./signing-key.js";
|
||||
export { Signature } from "./signature.js";
|
||||
/**
|
||||
* Once called, prevents any future change to the underlying cryptographic
|
||||
* primitives using the ``.register`` feature for hooks.
|
||||
*/
|
||||
function lock() {
|
||||
computeHmac.lock();
|
||||
keccak256.lock();
|
||||
pbkdf2.lock();
|
||||
randomBytes.lock();
|
||||
ripemd160.lock();
|
||||
scrypt.lock();
|
||||
scryptSync.lock();
|
||||
sha256.lock();
|
||||
sha512.lock();
|
||||
randomBytes.lock();
|
||||
}
|
||||
export { lock };
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
dev/env/node_modules/ethers/lib.esm/crypto/index.js.map
generated
vendored
Executable file
1
dev/env/node_modules/ethers/lib.esm/crypto/index.js.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src.ts/crypto/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,IAAI,CAAA;AAEJ,8CAA8C;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,EACH,WAAW,EAEX,WAAW,EAEX,SAAS,EACT,SAAS,EACT,MAAM,EAAE,MAAM,EAEd,MAAM,EACN,MAAM,EAAE,UAAU,EACrB,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;;GAGG;AACH,SAAS,IAAI;IACT,WAAW,CAAC,IAAI,EAAE,CAAC;IACnB,SAAS,CAAC,IAAI,EAAE,CAAC;IACjB,MAAM,CAAC,IAAI,EAAE,CAAC;IACd,WAAW,CAAC,IAAI,EAAE,CAAC;IACnB,SAAS,CAAC,IAAI,EAAE,CAAC;IACjB,MAAM,CAAC,IAAI,EAAE,CAAC;IACd,UAAU,CAAC,IAAI,EAAE,CAAC;IAClB,MAAM,CAAC,IAAI,EAAE,CAAC;IACd,MAAM,CAAC,IAAI,EAAE,CAAC;IACd,WAAW,CAAC,IAAI,EAAE,CAAC;AACvB,CAAC;AAED,OAAO,EAAE,IAAI,EAAE,CAAC"}
|
||||
35
dev/env/node_modules/ethers/lib.esm/crypto/keccak.d.ts
generated
vendored
Executable file
35
dev/env/node_modules/ethers/lib.esm/crypto/keccak.d.ts
generated
vendored
Executable file
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* Cryptographic hashing functions
|
||||
*
|
||||
* @_subsection: api/crypto:Hash Functions [about-crypto-hashing]
|
||||
*/
|
||||
import type { BytesLike } from "../utils/index.js";
|
||||
/**
|
||||
* Compute the cryptographic KECCAK256 hash of %%data%%.
|
||||
*
|
||||
* The %%data%% **must** be a data representation, to compute the
|
||||
* hash of UTF-8 data use the [[id]] function.
|
||||
*
|
||||
* @returns DataHexstring
|
||||
* @example:
|
||||
* keccak256("0x")
|
||||
* //_result:
|
||||
*
|
||||
* keccak256("0x1337")
|
||||
* //_result:
|
||||
*
|
||||
* keccak256(new Uint8Array([ 0x13, 0x37 ]))
|
||||
* //_result:
|
||||
*
|
||||
* // Strings are assumed to be DataHexString, otherwise it will
|
||||
* // throw. To hash UTF-8 data, see the note above.
|
||||
* keccak256("Hello World")
|
||||
* //_error:
|
||||
*/
|
||||
export declare function keccak256(_data: BytesLike): string;
|
||||
export declare namespace keccak256 {
|
||||
var _: (data: Uint8Array) => Uint8Array;
|
||||
var lock: () => void;
|
||||
var register: (func: (data: Uint8Array) => BytesLike) => void;
|
||||
}
|
||||
//# sourceMappingURL=keccak.d.ts.map
|
||||
1
dev/env/node_modules/ethers/lib.esm/crypto/keccak.d.ts.map
generated
vendored
Executable file
1
dev/env/node_modules/ethers/lib.esm/crypto/keccak.d.ts.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"keccak.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/keccak.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAWnD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAGlD;yBAHe,SAAS"}
|
||||
48
dev/env/node_modules/ethers/lib.esm/crypto/keccak.js
generated
vendored
Executable file
48
dev/env/node_modules/ethers/lib.esm/crypto/keccak.js
generated
vendored
Executable file
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* Cryptographic hashing functions
|
||||
*
|
||||
* @_subsection: api/crypto:Hash Functions [about-crypto-hashing]
|
||||
*/
|
||||
import { keccak_256 } from "@noble/hashes/sha3";
|
||||
import { getBytes, hexlify } from "../utils/index.js";
|
||||
let locked = false;
|
||||
const _keccak256 = function (data) {
|
||||
return keccak_256(data);
|
||||
};
|
||||
let __keccak256 = _keccak256;
|
||||
/**
|
||||
* Compute the cryptographic KECCAK256 hash of %%data%%.
|
||||
*
|
||||
* The %%data%% **must** be a data representation, to compute the
|
||||
* hash of UTF-8 data use the [[id]] function.
|
||||
*
|
||||
* @returns DataHexstring
|
||||
* @example:
|
||||
* keccak256("0x")
|
||||
* //_result:
|
||||
*
|
||||
* keccak256("0x1337")
|
||||
* //_result:
|
||||
*
|
||||
* keccak256(new Uint8Array([ 0x13, 0x37 ]))
|
||||
* //_result:
|
||||
*
|
||||
* // Strings are assumed to be DataHexString, otherwise it will
|
||||
* // throw. To hash UTF-8 data, see the note above.
|
||||
* keccak256("Hello World")
|
||||
* //_error:
|
||||
*/
|
||||
export function keccak256(_data) {
|
||||
const data = getBytes(_data, "data");
|
||||
return hexlify(__keccak256(data));
|
||||
}
|
||||
keccak256._ = _keccak256;
|
||||
keccak256.lock = function () { locked = true; };
|
||||
keccak256.register = function (func) {
|
||||
if (locked) {
|
||||
throw new TypeError("keccak256 is locked");
|
||||
}
|
||||
__keccak256 = func;
|
||||
};
|
||||
Object.freeze(keccak256);
|
||||
//# sourceMappingURL=keccak.js.map
|
||||
1
dev/env/node_modules/ethers/lib.esm/crypto/keccak.js.map
generated
vendored
Executable file
1
dev/env/node_modules/ethers/lib.esm/crypto/keccak.js.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"keccak.js","sourceRoot":"","sources":["../../src.ts/crypto/keccak.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAKtD,IAAI,MAAM,GAAG,KAAK,CAAC;AAEnB,MAAM,UAAU,GAAG,UAAS,IAAgB;IACxC,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC;AAC5B,CAAC,CAAA;AAED,IAAI,WAAW,GAAoC,UAAU,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,SAAS,CAAC,KAAgB;IACtC,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACrC,OAAO,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;AACtC,CAAC;AACD,SAAS,CAAC,CAAC,GAAG,UAAU,CAAC;AACzB,SAAS,CAAC,IAAI,GAAG,cAAmB,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;AACpD,SAAS,CAAC,QAAQ,GAAG,UAAS,IAAqC;IAC/D,IAAI,MAAM,EAAE;QAAE,MAAM,IAAI,SAAS,CAAC,qBAAqB,CAAC,CAAC;KAAE;IAC3D,WAAW,GAAG,IAAI,CAAC;AACvB,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC"}
|
||||
35
dev/env/node_modules/ethers/lib.esm/crypto/pbkdf2.d.ts
generated
vendored
Executable file
35
dev/env/node_modules/ethers/lib.esm/crypto/pbkdf2.d.ts
generated
vendored
Executable file
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* A **Password-Based Key-Derivation Function** is designed to create
|
||||
* a sequence of bytes suitible as a **key** from a human-rememberable
|
||||
* password.
|
||||
*
|
||||
* @_subsection: api/crypto:Passwords [about-pbkdf]
|
||||
*/
|
||||
import type { BytesLike } from "../utils/index.js";
|
||||
/**
|
||||
* Return the [[link-pbkdf2]] for %%keylen%% bytes for %%password%% using
|
||||
* the %%salt%% and using %%iterations%% of %%algo%%.
|
||||
*
|
||||
* This PBKDF is outdated and should not be used in new projects, but is
|
||||
* required to decrypt older files.
|
||||
*
|
||||
* @example:
|
||||
* // The password must be converted to bytes, and it is generally
|
||||
* // best practices to ensure the string has been normalized. Many
|
||||
* // formats explicitly indicate the normalization form to use.
|
||||
* password = "hello"
|
||||
* passwordBytes = toUtf8Bytes(password, "NFKC")
|
||||
*
|
||||
* salt = id("some-salt")
|
||||
*
|
||||
* // Compute the PBKDF2
|
||||
* pbkdf2(passwordBytes, salt, 1024, 16, "sha256")
|
||||
* //_result:
|
||||
*/
|
||||
export declare function pbkdf2(_password: BytesLike, _salt: BytesLike, iterations: number, keylen: number, algo: "sha256" | "sha512"): string;
|
||||
export declare namespace pbkdf2 {
|
||||
var _: (password: Uint8Array, salt: Uint8Array, iterations: number, keylen: number, algo: "sha256" | "sha512") => BytesLike;
|
||||
var lock: () => void;
|
||||
var register: (func: (password: Uint8Array, salt: Uint8Array, iterations: number, keylen: number, algo: "sha256" | "sha512") => BytesLike) => void;
|
||||
}
|
||||
//# sourceMappingURL=pbkdf2.d.ts.map
|
||||
1
dev/env/node_modules/ethers/lib.esm/crypto/pbkdf2.d.ts.map
generated
vendored
Executable file
1
dev/env/node_modules/ethers/lib.esm/crypto/pbkdf2.d.ts.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"pbkdf2.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/pbkdf2.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAWnD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAIpI;yBAJe,MAAM"}
|
||||
49
dev/env/node_modules/ethers/lib.esm/crypto/pbkdf2.js
generated
vendored
Executable file
49
dev/env/node_modules/ethers/lib.esm/crypto/pbkdf2.js
generated
vendored
Executable file
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* A **Password-Based Key-Derivation Function** is designed to create
|
||||
* a sequence of bytes suitible as a **key** from a human-rememberable
|
||||
* password.
|
||||
*
|
||||
* @_subsection: api/crypto:Passwords [about-pbkdf]
|
||||
*/
|
||||
import { pbkdf2Sync } from "./crypto.js";
|
||||
import { getBytes, hexlify } from "../utils/index.js";
|
||||
let locked = false;
|
||||
const _pbkdf2 = function (password, salt, iterations, keylen, algo) {
|
||||
return pbkdf2Sync(password, salt, iterations, keylen, algo);
|
||||
};
|
||||
let __pbkdf2 = _pbkdf2;
|
||||
/**
|
||||
* Return the [[link-pbkdf2]] for %%keylen%% bytes for %%password%% using
|
||||
* the %%salt%% and using %%iterations%% of %%algo%%.
|
||||
*
|
||||
* This PBKDF is outdated and should not be used in new projects, but is
|
||||
* required to decrypt older files.
|
||||
*
|
||||
* @example:
|
||||
* // The password must be converted to bytes, and it is generally
|
||||
* // best practices to ensure the string has been normalized. Many
|
||||
* // formats explicitly indicate the normalization form to use.
|
||||
* password = "hello"
|
||||
* passwordBytes = toUtf8Bytes(password, "NFKC")
|
||||
*
|
||||
* salt = id("some-salt")
|
||||
*
|
||||
* // Compute the PBKDF2
|
||||
* pbkdf2(passwordBytes, salt, 1024, 16, "sha256")
|
||||
* //_result:
|
||||
*/
|
||||
export function pbkdf2(_password, _salt, iterations, keylen, algo) {
|
||||
const password = getBytes(_password, "password");
|
||||
const salt = getBytes(_salt, "salt");
|
||||
return hexlify(__pbkdf2(password, salt, iterations, keylen, algo));
|
||||
}
|
||||
pbkdf2._ = _pbkdf2;
|
||||
pbkdf2.lock = function () { locked = true; };
|
||||
pbkdf2.register = function (func) {
|
||||
if (locked) {
|
||||
throw new Error("pbkdf2 is locked");
|
||||
}
|
||||
__pbkdf2 = func;
|
||||
};
|
||||
Object.freeze(pbkdf2);
|
||||
//# sourceMappingURL=pbkdf2.js.map
|
||||
1
dev/env/node_modules/ethers/lib.esm/crypto/pbkdf2.js.map
generated
vendored
Executable file
1
dev/env/node_modules/ethers/lib.esm/crypto/pbkdf2.js.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":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/crypto/random.d.ts
generated
vendored
Executable file
14
dev/env/node_modules/ethers/lib.esm/crypto/random.d.ts
generated
vendored
Executable file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* Return %%length%% bytes of cryptographically secure random data.
|
||||
*
|
||||
* @example:
|
||||
* randomBytes(8)
|
||||
* //_result:
|
||||
*/
|
||||
export declare function randomBytes(length: number): Uint8Array;
|
||||
export declare namespace randomBytes {
|
||||
var _: (length: number) => Uint8Array;
|
||||
var lock: () => void;
|
||||
var register: (func: (length: number) => Uint8Array) => void;
|
||||
}
|
||||
//# sourceMappingURL=random.d.ts.map
|
||||
1
dev/env/node_modules/ethers/lib.esm/crypto/random.d.ts.map
generated
vendored
Executable file
1
dev/env/node_modules/ethers/lib.esm/crypto/random.d.ts.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"random.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/random.ts"],"names":[],"mappings":"AAkBA;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAEtD;yBAFe,WAAW"}
|
||||
34
dev/env/node_modules/ethers/lib.esm/crypto/random.js
generated
vendored
Executable file
34
dev/env/node_modules/ethers/lib.esm/crypto/random.js
generated
vendored
Executable file
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* A **Cryptographically Secure Random Value** is one that has been
|
||||
* generated with additional care take to prevent side-channels
|
||||
* from allowing others to detect it and prevent others from through
|
||||
* coincidence generate the same values.
|
||||
*
|
||||
* @_subsection: api/crypto:Random Values [about-crypto-random]
|
||||
*/
|
||||
import { randomBytes as crypto_random } from "./crypto.js";
|
||||
let locked = false;
|
||||
const _randomBytes = function (length) {
|
||||
return new Uint8Array(crypto_random(length));
|
||||
};
|
||||
let __randomBytes = _randomBytes;
|
||||
/**
|
||||
* Return %%length%% bytes of cryptographically secure random data.
|
||||
*
|
||||
* @example:
|
||||
* randomBytes(8)
|
||||
* //_result:
|
||||
*/
|
||||
export function randomBytes(length) {
|
||||
return __randomBytes(length);
|
||||
}
|
||||
randomBytes._ = _randomBytes;
|
||||
randomBytes.lock = function () { locked = true; };
|
||||
randomBytes.register = function (func) {
|
||||
if (locked) {
|
||||
throw new Error("randomBytes is locked");
|
||||
}
|
||||
__randomBytes = func;
|
||||
};
|
||||
Object.freeze(randomBytes);
|
||||
//# sourceMappingURL=random.js.map
|
||||
1
dev/env/node_modules/ethers/lib.esm/crypto/random.js.map
generated
vendored
Executable file
1
dev/env/node_modules/ethers/lib.esm/crypto/random.js.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"random.js","sourceRoot":"","sources":["../../src.ts/crypto/random.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,WAAW,IAAI,aAAa,EAAE,MAAM,aAAa,CAAC;AAE3D,IAAI,MAAM,GAAG,KAAK,CAAC;AAEnB,MAAM,YAAY,GAAG,UAAS,MAAc;IACxC,OAAO,IAAI,UAAU,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;AACjD,CAAC,CAAA;AAED,IAAI,aAAa,GAAG,YAAY,CAAC;AAEjC;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,MAAc;IACtC,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC;AACjC,CAAC;AAED,WAAW,CAAC,CAAC,GAAG,YAAY,CAAC;AAC7B,WAAW,CAAC,IAAI,GAAG,cAAmB,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;AACtD,WAAW,CAAC,QAAQ,GAAG,UAAS,IAAoC;IAChE,IAAI,MAAM,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;KAAE;IACzD,aAAa,GAAG,IAAI,CAAC;AACzB,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC"}
|
||||
25
dev/env/node_modules/ethers/lib.esm/crypto/ripemd160.d.ts
generated
vendored
Executable file
25
dev/env/node_modules/ethers/lib.esm/crypto/ripemd160.d.ts
generated
vendored
Executable file
@@ -0,0 +1,25 @@
|
||||
import type { BytesLike } from "../utils/index.js";
|
||||
/**
|
||||
* Compute the cryptographic RIPEMD-160 hash of %%data%%.
|
||||
*
|
||||
* @_docloc: api/crypto:Hash Functions
|
||||
* @returns DataHexstring
|
||||
*
|
||||
* @example:
|
||||
* ripemd160("0x")
|
||||
* //_result:
|
||||
*
|
||||
* ripemd160("0x1337")
|
||||
* //_result:
|
||||
*
|
||||
* ripemd160(new Uint8Array([ 0x13, 0x37 ]))
|
||||
* //_result:
|
||||
*
|
||||
*/
|
||||
export declare function ripemd160(_data: BytesLike): string;
|
||||
export declare namespace ripemd160 {
|
||||
var _: (data: Uint8Array) => Uint8Array;
|
||||
var lock: () => void;
|
||||
var register: (func: (data: Uint8Array) => BytesLike) => void;
|
||||
}
|
||||
//# sourceMappingURL=ripemd160.d.ts.map
|
||||
1
dev/env/node_modules/ethers/lib.esm/crypto/ripemd160.d.ts.map
generated
vendored
Executable file
1
dev/env/node_modules/ethers/lib.esm/crypto/ripemd160.d.ts.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ripemd160.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/ripemd160.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAWnD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAGlD;yBAHe,SAAS"}
|
||||
38
dev/env/node_modules/ethers/lib.esm/crypto/ripemd160.js
generated
vendored
Executable file
38
dev/env/node_modules/ethers/lib.esm/crypto/ripemd160.js
generated
vendored
Executable file
@@ -0,0 +1,38 @@
|
||||
import { ripemd160 as noble_ripemd160 } from "@noble/hashes/ripemd160";
|
||||
import { getBytes, hexlify } from "../utils/index.js";
|
||||
let locked = false;
|
||||
const _ripemd160 = function (data) {
|
||||
return noble_ripemd160(data);
|
||||
};
|
||||
let __ripemd160 = _ripemd160;
|
||||
/**
|
||||
* Compute the cryptographic RIPEMD-160 hash of %%data%%.
|
||||
*
|
||||
* @_docloc: api/crypto:Hash Functions
|
||||
* @returns DataHexstring
|
||||
*
|
||||
* @example:
|
||||
* ripemd160("0x")
|
||||
* //_result:
|
||||
*
|
||||
* ripemd160("0x1337")
|
||||
* //_result:
|
||||
*
|
||||
* ripemd160(new Uint8Array([ 0x13, 0x37 ]))
|
||||
* //_result:
|
||||
*
|
||||
*/
|
||||
export function ripemd160(_data) {
|
||||
const data = getBytes(_data, "data");
|
||||
return hexlify(__ripemd160(data));
|
||||
}
|
||||
ripemd160._ = _ripemd160;
|
||||
ripemd160.lock = function () { locked = true; };
|
||||
ripemd160.register = function (func) {
|
||||
if (locked) {
|
||||
throw new TypeError("ripemd160 is locked");
|
||||
}
|
||||
__ripemd160 = func;
|
||||
};
|
||||
Object.freeze(ripemd160);
|
||||
//# sourceMappingURL=ripemd160.js.map
|
||||
1
dev/env/node_modules/ethers/lib.esm/crypto/ripemd160.js.map
generated
vendored
Executable file
1
dev/env/node_modules/ethers/lib.esm/crypto/ripemd160.js.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ripemd160.js","sourceRoot":"","sources":["../../src.ts/crypto/ripemd160.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAEvE,OAAO,EAAE,QAAQ,EAAG,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAKvD,IAAI,MAAM,GAAG,KAAK,CAAC;AAEnB,MAAM,UAAU,GAAG,UAAS,IAAgB;IACxC,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC;AACjC,CAAC,CAAA;AAED,IAAI,WAAW,GAAoC,UAAU,CAAC;AAE9D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,SAAS,CAAC,KAAgB;IACtC,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACrC,OAAO,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;AACtC,CAAC;AACD,SAAS,CAAC,CAAC,GAAG,UAAU,CAAC;AACzB,SAAS,CAAC,IAAI,GAAG,cAAmB,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;AACpD,SAAS,CAAC,QAAQ,GAAG,UAAS,IAAqC;IAC/D,IAAI,MAAM,EAAE;QAAE,MAAM,IAAI,SAAS,CAAC,qBAAqB,CAAC,CAAC;KAAE;IAC3D,WAAW,GAAG,IAAI,CAAC;AACvB,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC"}
|
||||
82
dev/env/node_modules/ethers/lib.esm/crypto/scrypt.d.ts
generated
vendored
Executable file
82
dev/env/node_modules/ethers/lib.esm/crypto/scrypt.d.ts
generated
vendored
Executable file
@@ -0,0 +1,82 @@
|
||||
import type { BytesLike } from "../utils/index.js";
|
||||
/**
|
||||
* A callback during long-running operations to update any
|
||||
* UI or provide programatic access to the progress.
|
||||
*
|
||||
* The %%percent%% is a value between ``0`` and ``1``.
|
||||
*
|
||||
* @_docloc: api/crypto:Passwords
|
||||
*/
|
||||
export type ProgressCallback = (percent: number) => void;
|
||||
/**
|
||||
* The [[link-wiki-scrypt]] uses a memory and cpu hard method of
|
||||
* derivation to increase the resource cost to brute-force a password
|
||||
* for a given key.
|
||||
*
|
||||
* This means this algorithm is intentionally slow, and can be tuned to
|
||||
* become slower. As computation and memory speed improve over time,
|
||||
* increasing the difficulty maintains the cost of an attacker.
|
||||
*
|
||||
* For example, if a target time of 5 seconds is used, a legitimate user
|
||||
* which knows their password requires only 5 seconds to unlock their
|
||||
* account. A 6 character password has 68 billion possibilities, which
|
||||
* would require an attacker to invest over 10,000 years of CPU time. This
|
||||
* is of course a crude example (as password generally aren't random),
|
||||
* but demonstrates to value of imposing large costs to decryption.
|
||||
*
|
||||
* For this reason, if building a UI which involved decrypting or
|
||||
* encrypting datsa using scrypt, it is recommended to use a
|
||||
* [[ProgressCallback]] (as event short periods can seem lik an eternity
|
||||
* if the UI freezes). Including the phrase //"decrypting"// in the UI
|
||||
* can also help, assuring the user their waiting is for a good reason.
|
||||
*
|
||||
* @_docloc: api/crypto:Passwords
|
||||
*
|
||||
* @example:
|
||||
* // The password must be converted to bytes, and it is generally
|
||||
* // best practices to ensure the string has been normalized. Many
|
||||
* // formats explicitly indicate the normalization form to use.
|
||||
* password = "hello"
|
||||
* passwordBytes = toUtf8Bytes(password, "NFKC")
|
||||
*
|
||||
* salt = id("some-salt")
|
||||
*
|
||||
* // Compute the scrypt
|
||||
* scrypt(passwordBytes, salt, 1024, 8, 1, 16)
|
||||
* //_result:
|
||||
*/
|
||||
export declare function scrypt(_passwd: BytesLike, _salt: BytesLike, N: number, r: number, p: number, dkLen: number, progress?: ProgressCallback): Promise<string>;
|
||||
export declare namespace scrypt {
|
||||
var _: (passwd: Uint8Array, salt: Uint8Array, N: number, r: number, p: number, dkLen: number, onProgress?: ProgressCallback | undefined) => Promise<Uint8Array>;
|
||||
var lock: () => void;
|
||||
var register: (func: (passwd: Uint8Array, salt: Uint8Array, N: number, r: number, p: number, dkLen: number, progress?: ProgressCallback | undefined) => Promise<BytesLike>) => void;
|
||||
}
|
||||
/**
|
||||
* Provides a synchronous variant of [[scrypt]].
|
||||
*
|
||||
* This will completely lock up and freeze the UI in a browser and will
|
||||
* prevent any event loop from progressing. For this reason, it is
|
||||
* preferred to use the [async variant](scrypt).
|
||||
*
|
||||
* @_docloc: api/crypto:Passwords
|
||||
*
|
||||
* @example:
|
||||
* // The password must be converted to bytes, and it is generally
|
||||
* // best practices to ensure the string has been normalized. Many
|
||||
* // formats explicitly indicate the normalization form to use.
|
||||
* password = "hello"
|
||||
* passwordBytes = toUtf8Bytes(password, "NFKC")
|
||||
*
|
||||
* salt = id("some-salt")
|
||||
*
|
||||
* // Compute the scrypt
|
||||
* scryptSync(passwordBytes, salt, 1024, 8, 1, 16)
|
||||
* //_result:
|
||||
*/
|
||||
export declare function scryptSync(_passwd: BytesLike, _salt: BytesLike, N: number, r: number, p: number, dkLen: number): string;
|
||||
export declare namespace scryptSync {
|
||||
var _: (passwd: Uint8Array, salt: Uint8Array, N: number, r: number, p: number, dkLen: number) => Uint8Array;
|
||||
var lock: () => void;
|
||||
var register: (func: (passwd: Uint8Array, salt: Uint8Array, N: number, r: number, p: number, dkLen: number) => BytesLike) => void;
|
||||
}
|
||||
//# sourceMappingURL=scrypt.d.ts.map
|
||||
1
dev/env/node_modules/ethers/lib.esm/crypto/scrypt.d.ts.map
generated
vendored
Executable file
1
dev/env/node_modules/ethers/lib.esm/crypto/scrypt.d.ts.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"scrypt.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/scrypt.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;AAgBzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAsB,MAAM,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CAI/J;yBAJqB,MAAM;;;;;AAa5B;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAIvH;yBAJe,UAAU"}
|
||||
99
dev/env/node_modules/ethers/lib.esm/crypto/scrypt.js
generated
vendored
Executable file
99
dev/env/node_modules/ethers/lib.esm/crypto/scrypt.js
generated
vendored
Executable file
@@ -0,0 +1,99 @@
|
||||
import { scrypt as _nobleSync, scryptAsync as _nobleAsync } from "@noble/hashes/scrypt";
|
||||
import { getBytes, hexlify as H } from "../utils/index.js";
|
||||
let lockedSync = false, lockedAsync = false;
|
||||
const _scryptAsync = async function (passwd, salt, N, r, p, dkLen, onProgress) {
|
||||
return await _nobleAsync(passwd, salt, { N, r, p, dkLen, onProgress });
|
||||
};
|
||||
const _scryptSync = function (passwd, salt, N, r, p, dkLen) {
|
||||
return _nobleSync(passwd, salt, { N, r, p, dkLen });
|
||||
};
|
||||
let __scryptAsync = _scryptAsync;
|
||||
let __scryptSync = _scryptSync;
|
||||
/**
|
||||
* The [[link-wiki-scrypt]] uses a memory and cpu hard method of
|
||||
* derivation to increase the resource cost to brute-force a password
|
||||
* for a given key.
|
||||
*
|
||||
* This means this algorithm is intentionally slow, and can be tuned to
|
||||
* become slower. As computation and memory speed improve over time,
|
||||
* increasing the difficulty maintains the cost of an attacker.
|
||||
*
|
||||
* For example, if a target time of 5 seconds is used, a legitimate user
|
||||
* which knows their password requires only 5 seconds to unlock their
|
||||
* account. A 6 character password has 68 billion possibilities, which
|
||||
* would require an attacker to invest over 10,000 years of CPU time. This
|
||||
* is of course a crude example (as password generally aren't random),
|
||||
* but demonstrates to value of imposing large costs to decryption.
|
||||
*
|
||||
* For this reason, if building a UI which involved decrypting or
|
||||
* encrypting datsa using scrypt, it is recommended to use a
|
||||
* [[ProgressCallback]] (as event short periods can seem lik an eternity
|
||||
* if the UI freezes). Including the phrase //"decrypting"// in the UI
|
||||
* can also help, assuring the user their waiting is for a good reason.
|
||||
*
|
||||
* @_docloc: api/crypto:Passwords
|
||||
*
|
||||
* @example:
|
||||
* // The password must be converted to bytes, and it is generally
|
||||
* // best practices to ensure the string has been normalized. Many
|
||||
* // formats explicitly indicate the normalization form to use.
|
||||
* password = "hello"
|
||||
* passwordBytes = toUtf8Bytes(password, "NFKC")
|
||||
*
|
||||
* salt = id("some-salt")
|
||||
*
|
||||
* // Compute the scrypt
|
||||
* scrypt(passwordBytes, salt, 1024, 8, 1, 16)
|
||||
* //_result:
|
||||
*/
|
||||
export async function scrypt(_passwd, _salt, N, r, p, dkLen, progress) {
|
||||
const passwd = getBytes(_passwd, "passwd");
|
||||
const salt = getBytes(_salt, "salt");
|
||||
return H(await __scryptAsync(passwd, salt, N, r, p, dkLen, progress));
|
||||
}
|
||||
scrypt._ = _scryptAsync;
|
||||
scrypt.lock = function () { lockedAsync = true; };
|
||||
scrypt.register = function (func) {
|
||||
if (lockedAsync) {
|
||||
throw new Error("scrypt is locked");
|
||||
}
|
||||
__scryptAsync = func;
|
||||
};
|
||||
Object.freeze(scrypt);
|
||||
/**
|
||||
* Provides a synchronous variant of [[scrypt]].
|
||||
*
|
||||
* This will completely lock up and freeze the UI in a browser and will
|
||||
* prevent any event loop from progressing. For this reason, it is
|
||||
* preferred to use the [async variant](scrypt).
|
||||
*
|
||||
* @_docloc: api/crypto:Passwords
|
||||
*
|
||||
* @example:
|
||||
* // The password must be converted to bytes, and it is generally
|
||||
* // best practices to ensure the string has been normalized. Many
|
||||
* // formats explicitly indicate the normalization form to use.
|
||||
* password = "hello"
|
||||
* passwordBytes = toUtf8Bytes(password, "NFKC")
|
||||
*
|
||||
* salt = id("some-salt")
|
||||
*
|
||||
* // Compute the scrypt
|
||||
* scryptSync(passwordBytes, salt, 1024, 8, 1, 16)
|
||||
* //_result:
|
||||
*/
|
||||
export function scryptSync(_passwd, _salt, N, r, p, dkLen) {
|
||||
const passwd = getBytes(_passwd, "passwd");
|
||||
const salt = getBytes(_salt, "salt");
|
||||
return H(__scryptSync(passwd, salt, N, r, p, dkLen));
|
||||
}
|
||||
scryptSync._ = _scryptSync;
|
||||
scryptSync.lock = function () { lockedSync = true; };
|
||||
scryptSync.register = function (func) {
|
||||
if (lockedSync) {
|
||||
throw new Error("scryptSync is locked");
|
||||
}
|
||||
__scryptSync = func;
|
||||
};
|
||||
Object.freeze(scryptSync);
|
||||
//# sourceMappingURL=scrypt.js.map
|
||||
1
dev/env/node_modules/ethers/lib.esm/crypto/scrypt.js.map
generated
vendored
Executable file
1
dev/env/node_modules/ethers/lib.esm/crypto/scrypt.js.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"scrypt.js","sourceRoot":"","sources":["../../src.ts/crypto/scrypt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,WAAW,IAAI,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExF,OAAO,EAAE,QAAQ,EAAE,OAAO,IAAI,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAe3D,IAAI,UAAU,GAAG,KAAK,EAAE,WAAW,GAAG,KAAK,CAAC;AAE5C,MAAM,YAAY,GAAG,KAAK,WAAU,MAAkB,EAAE,IAAgB,EAAE,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,KAAa,EAAE,UAA6B;IACnJ,OAAO,MAAM,WAAW,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC;AAC3E,CAAC,CAAA;AACD,MAAM,WAAW,GAAG,UAAS,MAAkB,EAAE,IAAgB,EAAE,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,KAAa;IAC7G,OAAO,UAAU,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AACxD,CAAC,CAAA;AAED,IAAI,aAAa,GAAgJ,YAAY,CAAC;AAC9K,IAAI,YAAY,GAAwG,WAAW,CAAA;AAGnI;;;;;;;;;;;;;;;;;;;;;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B,UAAU,CAAC,IAAI,GAAG,cAAmB,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;AACzD,UAAU,CAAC,QAAQ,GAAG,UAAS,IAAyG;IACpI,IAAI,UAAU,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;KAAE;IAC5D,YAAY,GAAG,IAAI,CAAC;AACxB,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC"}
|
||||
47
dev/env/node_modules/ethers/lib.esm/crypto/sha2.d.ts
generated
vendored
Executable file
47
dev/env/node_modules/ethers/lib.esm/crypto/sha2.d.ts
generated
vendored
Executable file
@@ -0,0 +1,47 @@
|
||||
import type { BytesLike } from "../utils/index.js";
|
||||
/**
|
||||
* Compute the cryptographic SHA2-256 hash of %%data%%.
|
||||
*
|
||||
* @_docloc: api/crypto:Hash Functions
|
||||
* @returns DataHexstring
|
||||
*
|
||||
* @example:
|
||||
* sha256("0x")
|
||||
* //_result:
|
||||
*
|
||||
* sha256("0x1337")
|
||||
* //_result:
|
||||
*
|
||||
* sha256(new Uint8Array([ 0x13, 0x37 ]))
|
||||
* //_result:
|
||||
*
|
||||
*/
|
||||
export declare function sha256(_data: BytesLike): string;
|
||||
export declare namespace sha256 {
|
||||
var _: (data: Uint8Array) => Uint8Array;
|
||||
var lock: () => void;
|
||||
var register: (func: (data: Uint8Array) => BytesLike) => void;
|
||||
}
|
||||
/**
|
||||
* Compute the cryptographic SHA2-512 hash of %%data%%.
|
||||
*
|
||||
* @_docloc: api/crypto:Hash Functions
|
||||
* @returns DataHexstring
|
||||
*
|
||||
* @example:
|
||||
* sha512("0x")
|
||||
* //_result:
|
||||
*
|
||||
* sha512("0x1337")
|
||||
* //_result:
|
||||
*
|
||||
* sha512(new Uint8Array([ 0x13, 0x37 ]))
|
||||
* //_result:
|
||||
*/
|
||||
export declare function sha512(_data: BytesLike): string;
|
||||
export declare namespace sha512 {
|
||||
var _: (data: Uint8Array) => Uint8Array;
|
||||
var lock: () => void;
|
||||
var register: (func: (data: Uint8Array) => BytesLike) => void;
|
||||
}
|
||||
//# sourceMappingURL=sha2.d.ts.map
|
||||
1
dev/env/node_modules/ethers/lib.esm/crypto/sha2.d.ts.map
generated
vendored
Executable file
1
dev/env/node_modules/ethers/lib.esm/crypto/sha2.d.ts.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"sha2.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/sha2.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAiBnD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAG/C;yBAHe,MAAM;;;;;AAatB;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAG/C;yBAHe,MAAM"}
|
||||
71
dev/env/node_modules/ethers/lib.esm/crypto/sha2.js
generated
vendored
Executable file
71
dev/env/node_modules/ethers/lib.esm/crypto/sha2.js
generated
vendored
Executable file
@@ -0,0 +1,71 @@
|
||||
import { createHash } from "./crypto.js";
|
||||
import { getBytes, hexlify } from "../utils/index.js";
|
||||
const _sha256 = function (data) {
|
||||
return createHash("sha256").update(data).digest();
|
||||
};
|
||||
const _sha512 = function (data) {
|
||||
return createHash("sha512").update(data).digest();
|
||||
};
|
||||
let __sha256 = _sha256;
|
||||
let __sha512 = _sha512;
|
||||
let locked256 = false, locked512 = false;
|
||||
/**
|
||||
* Compute the cryptographic SHA2-256 hash of %%data%%.
|
||||
*
|
||||
* @_docloc: api/crypto:Hash Functions
|
||||
* @returns DataHexstring
|
||||
*
|
||||
* @example:
|
||||
* sha256("0x")
|
||||
* //_result:
|
||||
*
|
||||
* sha256("0x1337")
|
||||
* //_result:
|
||||
*
|
||||
* sha256(new Uint8Array([ 0x13, 0x37 ]))
|
||||
* //_result:
|
||||
*
|
||||
*/
|
||||
export function sha256(_data) {
|
||||
const data = getBytes(_data, "data");
|
||||
return hexlify(__sha256(data));
|
||||
}
|
||||
sha256._ = _sha256;
|
||||
sha256.lock = function () { locked256 = true; };
|
||||
sha256.register = function (func) {
|
||||
if (locked256) {
|
||||
throw new Error("sha256 is locked");
|
||||
}
|
||||
__sha256 = func;
|
||||
};
|
||||
Object.freeze(sha256);
|
||||
/**
|
||||
* Compute the cryptographic SHA2-512 hash of %%data%%.
|
||||
*
|
||||
* @_docloc: api/crypto:Hash Functions
|
||||
* @returns DataHexstring
|
||||
*
|
||||
* @example:
|
||||
* sha512("0x")
|
||||
* //_result:
|
||||
*
|
||||
* sha512("0x1337")
|
||||
* //_result:
|
||||
*
|
||||
* sha512(new Uint8Array([ 0x13, 0x37 ]))
|
||||
* //_result:
|
||||
*/
|
||||
export function sha512(_data) {
|
||||
const data = getBytes(_data, "data");
|
||||
return hexlify(__sha512(data));
|
||||
}
|
||||
sha512._ = _sha512;
|
||||
sha512.lock = function () { locked512 = true; };
|
||||
sha512.register = function (func) {
|
||||
if (locked512) {
|
||||
throw new Error("sha512 is locked");
|
||||
}
|
||||
__sha512 = func;
|
||||
};
|
||||
Object.freeze(sha256);
|
||||
//# sourceMappingURL=sha2.js.map
|
||||
1
dev/env/node_modules/ethers/lib.esm/crypto/sha2.js.map
generated
vendored
Executable file
1
dev/env/node_modules/ethers/lib.esm/crypto/sha2.js.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"sha2.js","sourceRoot":"","sources":["../../src.ts/crypto/sha2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAKtD,MAAM,OAAO,GAAG,UAAS,IAAgB;IACrC,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,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S,IAAqC;IAC5D,IAAI,SAAS,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;KAAE;IACvD,QAAQ,GAAG,IAAI,CAAC;AACpB,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC"}
|
||||
183
dev/env/node_modules/ethers/lib.esm/crypto/signature.d.ts
generated
vendored
Executable file
183
dev/env/node_modules/ethers/lib.esm/crypto/signature.d.ts
generated
vendored
Executable file
@@ -0,0 +1,183 @@
|
||||
import type { BigNumberish, BytesLike } from "../utils/index.js";
|
||||
declare const inspect: unique symbol;
|
||||
/**
|
||||
* A SignatureLike
|
||||
*
|
||||
* @_docloc: api/crypto:Signing
|
||||
*/
|
||||
export type SignatureLike = Signature | string | {
|
||||
r: string;
|
||||
s: string;
|
||||
v: BigNumberish;
|
||||
yParity?: 0 | 1;
|
||||
yParityAndS?: string;
|
||||
} | {
|
||||
r: string;
|
||||
yParityAndS: string;
|
||||
yParity?: 0 | 1;
|
||||
s?: string;
|
||||
v?: number;
|
||||
} | {
|
||||
r: string;
|
||||
s: string;
|
||||
yParity: 0 | 1;
|
||||
v?: BigNumberish;
|
||||
yParityAndS?: string;
|
||||
};
|
||||
/**
|
||||
* A Signature @TODO
|
||||
*
|
||||
*
|
||||
* @_docloc: api/crypto:Signing
|
||||
*/
|
||||
export declare class Signature {
|
||||
#private;
|
||||
/**
|
||||
* The ``r`` value for a signature.
|
||||
*
|
||||
* This represents the ``x`` coordinate of a "reference" or
|
||||
* challenge point, from which the ``y`` can be computed.
|
||||
*/
|
||||
get r(): string;
|
||||
set r(value: BytesLike);
|
||||
/**
|
||||
* The ``s`` value for a signature.
|
||||
*/
|
||||
get s(): string;
|
||||
set s(_value: BytesLike);
|
||||
/**
|
||||
* Return the s value, unchecked for EIP-2 compliance.
|
||||
*
|
||||
* This should generally not be used and is for situations where
|
||||
* a non-canonical S value might be relevant, such as Frontier blocks
|
||||
* that were mined prior to EIP-2 or invalid Authorization List
|
||||
* signatures.
|
||||
*/
|
||||
get _s(): string;
|
||||
/**
|
||||
* Returns true if the Signature is valid for [[link-eip-2]] signatures.
|
||||
*/
|
||||
isValid(): boolean;
|
||||
/**
|
||||
* The ``v`` value for a signature.
|
||||
*
|
||||
* Since a given ``x`` value for ``r`` has two possible values for
|
||||
* its correspondin ``y``, the ``v`` indicates which of the two ``y``
|
||||
* values to use.
|
||||
*
|
||||
* It is normalized to the values ``27`` or ``28`` for legacy
|
||||
* purposes.
|
||||
*/
|
||||
get v(): 27 | 28;
|
||||
set v(value: BigNumberish);
|
||||
/**
|
||||
* The EIP-155 ``v`` for legacy transactions. For non-legacy
|
||||
* transactions, this value is ``null``.
|
||||
*/
|
||||
get networkV(): null | bigint;
|
||||
/**
|
||||
* The chain ID for EIP-155 legacy transactions. For non-legacy
|
||||
* transactions, this value is ``null``.
|
||||
*/
|
||||
get legacyChainId(): null | bigint;
|
||||
/**
|
||||
* The ``yParity`` for the signature.
|
||||
*
|
||||
* See ``v`` for more details on how this value is used.
|
||||
*/
|
||||
get yParity(): 0 | 1;
|
||||
/**
|
||||
* The [[link-eip-2098]] compact representation of the ``yParity``
|
||||
* and ``s`` compacted into a single ``bytes32``.
|
||||
*/
|
||||
get yParityAndS(): string;
|
||||
/**
|
||||
* The [[link-eip-2098]] compact representation.
|
||||
*/
|
||||
get compactSerialized(): string;
|
||||
/**
|
||||
* The serialized representation.
|
||||
*/
|
||||
get serialized(): string;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
constructor(guard: any, r: string, s: string, v: 27 | 28);
|
||||
/**
|
||||
* Returns the canonical signature.
|
||||
*
|
||||
* This is only necessary when dealing with legacy transaction which
|
||||
* did not enforce canonical S values (i.e. [[link-eip-2]]. Most
|
||||
* developers should never require this.
|
||||
*/
|
||||
getCanonical(): Signature;
|
||||
/**
|
||||
* Returns a new identical [[Signature]].
|
||||
*/
|
||||
clone(): Signature;
|
||||
/**
|
||||
* Returns a representation that is compatible with ``JSON.stringify``.
|
||||
*/
|
||||
toJSON(): any;
|
||||
[inspect](): string;
|
||||
toString(): string;
|
||||
/**
|
||||
* Compute the chain ID from the ``v`` in a legacy EIP-155 transactions.
|
||||
*
|
||||
* @example:
|
||||
* Signature.getChainId(45)
|
||||
* //_result:
|
||||
*
|
||||
* Signature.getChainId(46)
|
||||
* //_result:
|
||||
*/
|
||||
static getChainId(v: BigNumberish): bigint;
|
||||
/**
|
||||
* Compute the ``v`` for a chain ID for a legacy EIP-155 transactions.
|
||||
*
|
||||
* Legacy transactions which use [[link-eip-155]] hijack the ``v``
|
||||
* property to include the chain ID.
|
||||
*
|
||||
* @example:
|
||||
* Signature.getChainIdV(5, 27)
|
||||
* //_result:
|
||||
*
|
||||
* Signature.getChainIdV(5, 28)
|
||||
* //_result:
|
||||
*
|
||||
*/
|
||||
static getChainIdV(chainId: BigNumberish, v: 27 | 28): bigint;
|
||||
/**
|
||||
* Compute the normalized legacy transaction ``v`` from a ``yParirty``,
|
||||
* a legacy transaction ``v`` or a legacy [[link-eip-155]] transaction.
|
||||
*
|
||||
* @example:
|
||||
* // The values 0 and 1 imply v is actually yParity
|
||||
* Signature.getNormalizedV(0)
|
||||
* //_result:
|
||||
*
|
||||
* // Legacy non-EIP-1559 transaction (i.e. 27 or 28)
|
||||
* Signature.getNormalizedV(27)
|
||||
* //_result:
|
||||
*
|
||||
* // Legacy EIP-155 transaction (i.e. >= 35)
|
||||
* Signature.getNormalizedV(46)
|
||||
* //_result:
|
||||
*
|
||||
* // Invalid values throw
|
||||
* Signature.getNormalizedV(5)
|
||||
* //_error:
|
||||
*/
|
||||
static getNormalizedV(v: BigNumberish): 27 | 28;
|
||||
/**
|
||||
* Creates a new [[Signature]].
|
||||
*
|
||||
* If no %%sig%% is provided, a new [[Signature]] is created
|
||||
* with default values.
|
||||
*
|
||||
* If %%sig%% is a string, it is parsed.
|
||||
*/
|
||||
static from(sig?: SignatureLike): Signature;
|
||||
}
|
||||
export {};
|
||||
//# sourceMappingURL=signature.d.ts.map
|
||||
1
dev/env/node_modules/ethers/lib.esm/crypto/signature.d.ts.map
generated
vendored
Executable file
1
dev/env/node_modules/ethers/lib.esm/crypto/signature.d.ts.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"signature.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/signature.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACR,YAAY,EAAE,SAAS,EAC1B,MAAM,mBAAmB,CAAC;AAa3B,QAAA,MAAM,OAAO,eAA2C,CAAC;AAMzD;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,MAAM,GAAG;IAC7C,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,YAAY,CAAC;IAChB,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB,GAAG;IACA,CAAC,EAAE,MAAM,CAAC;IACV,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IAChB,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;CACd,GAAG;IACA,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,OAAO,EAAE,CAAC,GAAG,CAAC,CAAC;IACf,CAAC,CAAC,EAAE,YAAY,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAMF;;;;;GAKG;AACH,qBAAa,SAAS;;IAMlB;;;;;OAKG;IACH,IAAI,CAAC,IAAI,MAAM,CAAoB;IACnC,IAAI,CAAC,CAAC,KAAK,EAAE,SAAS,EAGrB;IAED;;OAEG;IACH,IAAI,CAAC,IAAI,MAAM,CAGd;IACD,IAAI,CAAC,CAAC,MAAM,EAAE,SAAS,EAGtB;IAED;;;;;;;OAOG;IACH,IAAI,EAAE,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modules/ethers/lib.esm/crypto/signature.js
generated
vendored
Executable file
346
dev/env/node_modules/ethers/lib.esm/crypto/signature.js
generated
vendored
Executable file
@@ -0,0 +1,346 @@
|
||||
import { ZeroHash } from "../constants/index.js";
|
||||
import { concat, dataLength, getBigInt, getBytes, getNumber, hexlify, toBeArray, isHexString, zeroPadValue, assertArgument, assertPrivate } from "../utils/index.js";
|
||||
// Constants
|
||||
const BN_0 = BigInt(0);
|
||||
const BN_1 = BigInt(1);
|
||||
const BN_2 = BigInt(2);
|
||||
const BN_27 = BigInt(27);
|
||||
const BN_28 = BigInt(28);
|
||||
const BN_35 = BigInt(35);
|
||||
const BN_N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");
|
||||
const BN_N_2 = BN_N / BN_2; // Must be integer (floor) division; do NOT shifts
|
||||
const inspect = Symbol.for("nodejs.util.inspect.custom");
|
||||
const _guard = {};
|
||||
function toUint256(value) {
|
||||
return zeroPadValue(toBeArray(value), 32);
|
||||
}
|
||||
/**
|
||||
* A Signature @TODO
|
||||
*
|
||||
*
|
||||
* @_docloc: api/crypto:Signing
|
||||
*/
|
||||
export class Signature {
|
||||
#r;
|
||||
#s;
|
||||
#v;
|
||||
#networkV;
|
||||
/**
|
||||
* The ``r`` value for a signature.
|
||||
*
|
||||
* This represents the ``x`` coordinate of a "reference" or
|
||||
* challenge point, from which the ``y`` can be computed.
|
||||
*/
|
||||
get r() { return this.#r; }
|
||||
set r(value) {
|
||||
assertArgument(dataLength(value) === 32, "invalid r", "value", value);
|
||||
this.#r = hexlify(value);
|
||||
}
|
||||
/**
|
||||
* The ``s`` value for a signature.
|
||||
*/
|
||||
get s() {
|
||||
assertArgument(parseInt(this.#s.substring(0, 3)) < 8, "non-canonical s; use ._s", "s", this.#s);
|
||||
return this.#s;
|
||||
}
|
||||
set s(_value) {
|
||||
assertArgument(dataLength(_value) === 32, "invalid s", "value", _value);
|
||||
this.#s = hexlify(_value);
|
||||
}
|
||||
/**
|
||||
* Return the s value, unchecked for EIP-2 compliance.
|
||||
*
|
||||
* This should generally not be used and is for situations where
|
||||
* a non-canonical S value might be relevant, such as Frontier blocks
|
||||
* that were mined prior to EIP-2 or invalid Authorization List
|
||||
* signatures.
|
||||
*/
|
||||
get _s() { return this.#s; }
|
||||
/**
|
||||
* Returns true if the Signature is valid for [[link-eip-2]] signatures.
|
||||
*/
|
||||
isValid() {
|
||||
const s = BigInt(this.#s);
|
||||
return (s <= BN_N_2);
|
||||
}
|
||||
/**
|
||||
* The ``v`` value for a signature.
|
||||
*
|
||||
* Since a given ``x`` value for ``r`` has two possible values for
|
||||
* its correspondin ``y``, the ``v`` indicates which of the two ``y``
|
||||
* values to use.
|
||||
*
|
||||
* It is normalized to the values ``27`` or ``28`` for legacy
|
||||
* purposes.
|
||||
*/
|
||||
get v() { return this.#v; }
|
||||
set v(value) {
|
||||
const v = getNumber(value, "value");
|
||||
assertArgument(v === 27 || v === 28, "invalid v", "v", value);
|
||||
this.#v = v;
|
||||
}
|
||||
/**
|
||||
* The EIP-155 ``v`` for legacy transactions. For non-legacy
|
||||
* transactions, this value is ``null``.
|
||||
*/
|
||||
get networkV() { return this.#networkV; }
|
||||
/**
|
||||
* The chain ID for EIP-155 legacy transactions. For non-legacy
|
||||
* transactions, this value is ``null``.
|
||||
*/
|
||||
get legacyChainId() {
|
||||
const v = this.networkV;
|
||||
if (v == null) {
|
||||
return null;
|
||||
}
|
||||
return Signature.getChainId(v);
|
||||
}
|
||||
/**
|
||||
* The ``yParity`` for the signature.
|
||||
*
|
||||
* See ``v`` for more details on how this value is used.
|
||||
*/
|
||||
get yParity() {
|
||||
return (this.v === 27) ? 0 : 1;
|
||||
}
|
||||
/**
|
||||
* The [[link-eip-2098]] compact representation of the ``yParity``
|
||||
* and ``s`` compacted into a single ``bytes32``.
|
||||
*/
|
||||
get yParityAndS() {
|
||||
// The EIP-2098 compact representation
|
||||
const yParityAndS = getBytes(this.s);
|
||||
if (this.yParity) {
|
||||
yParityAndS[0] |= 0x80;
|
||||
}
|
||||
return hexlify(yParityAndS);
|
||||
}
|
||||
/**
|
||||
* The [[link-eip-2098]] compact representation.
|
||||
*/
|
||||
get compactSerialized() {
|
||||
return concat([this.r, this.yParityAndS]);
|
||||
}
|
||||
/**
|
||||
* The serialized representation.
|
||||
*/
|
||||
get serialized() {
|
||||
return concat([this.r, this.s, (this.yParity ? "0x1c" : "0x1b")]);
|
||||
}
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
constructor(guard, r, s, v) {
|
||||
assertPrivate(guard, _guard, "Signature");
|
||||
this.#r = r;
|
||||
this.#s = s;
|
||||
this.#v = v;
|
||||
this.#networkV = null;
|
||||
}
|
||||
/**
|
||||
* Returns the canonical signature.
|
||||
*
|
||||
* This is only necessary when dealing with legacy transaction which
|
||||
* did not enforce canonical S values (i.e. [[link-eip-2]]. Most
|
||||
* developers should never require this.
|
||||
*/
|
||||
getCanonical() {
|
||||
if (this.isValid()) {
|
||||
return this;
|
||||
}
|
||||
// Compute the canonical signature; s' = N - s, v = !v
|
||||
const s = BN_N - BigInt(this._s);
|
||||
const v = (55 - this.v);
|
||||
const result = new Signature(_guard, this.r, toUint256(s), v);
|
||||
// Populate the networkV if necessary
|
||||
if (this.networkV) {
|
||||
result.#networkV = this.networkV;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Returns a new identical [[Signature]].
|
||||
*/
|
||||
clone() {
|
||||
const clone = new Signature(_guard, this.r, this._s, this.v);
|
||||
if (this.networkV) {
|
||||
clone.#networkV = this.networkV;
|
||||
}
|
||||
return clone;
|
||||
}
|
||||
/**
|
||||
* Returns a representation that is compatible with ``JSON.stringify``.
|
||||
*/
|
||||
toJSON() {
|
||||
const networkV = this.networkV;
|
||||
return {
|
||||
_type: "signature",
|
||||
networkV: ((networkV != null) ? networkV.toString() : null),
|
||||
r: this.r, s: this._s, v: this.v,
|
||||
};
|
||||
}
|
||||
[inspect]() {
|
||||
return this.toString();
|
||||
}
|
||||
toString() {
|
||||
if (this.isValid()) {
|
||||
return `Signature { r: ${this.r}, s: ${this._s}, v: ${this.v} }`;
|
||||
}
|
||||
return `Signature { r: ${this.r}, s: ${this._s}, v: ${this.v}, valid: false }`;
|
||||
}
|
||||
/**
|
||||
* Compute the chain ID from the ``v`` in a legacy EIP-155 transactions.
|
||||
*
|
||||
* @example:
|
||||
* Signature.getChainId(45)
|
||||
* //_result:
|
||||
*
|
||||
* Signature.getChainId(46)
|
||||
* //_result:
|
||||
*/
|
||||
static getChainId(v) {
|
||||
const bv = getBigInt(v, "v");
|
||||
// The v is not an EIP-155 v, so it is the unspecified chain ID
|
||||
if ((bv == BN_27) || (bv == BN_28)) {
|
||||
return BN_0;
|
||||
}
|
||||
// Bad value for an EIP-155 v
|
||||
assertArgument(bv >= BN_35, "invalid EIP-155 v", "v", v);
|
||||
return (bv - BN_35) / BN_2;
|
||||
}
|
||||
/**
|
||||
* Compute the ``v`` for a chain ID for a legacy EIP-155 transactions.
|
||||
*
|
||||
* Legacy transactions which use [[link-eip-155]] hijack the ``v``
|
||||
* property to include the chain ID.
|
||||
*
|
||||
* @example:
|
||||
* Signature.getChainIdV(5, 27)
|
||||
* //_result:
|
||||
*
|
||||
* Signature.getChainIdV(5, 28)
|
||||
* //_result:
|
||||
*
|
||||
*/
|
||||
static getChainIdV(chainId, v) {
|
||||
return (getBigInt(chainId) * BN_2) + BigInt(35 + v - 27);
|
||||
}
|
||||
/**
|
||||
* Compute the normalized legacy transaction ``v`` from a ``yParirty``,
|
||||
* a legacy transaction ``v`` or a legacy [[link-eip-155]] transaction.
|
||||
*
|
||||
* @example:
|
||||
* // The values 0 and 1 imply v is actually yParity
|
||||
* Signature.getNormalizedV(0)
|
||||
* //_result:
|
||||
*
|
||||
* // Legacy non-EIP-1559 transaction (i.e. 27 or 28)
|
||||
* Signature.getNormalizedV(27)
|
||||
* //_result:
|
||||
*
|
||||
* // Legacy EIP-155 transaction (i.e. >= 35)
|
||||
* Signature.getNormalizedV(46)
|
||||
* //_result:
|
||||
*
|
||||
* // Invalid values throw
|
||||
* Signature.getNormalizedV(5)
|
||||
* //_error:
|
||||
*/
|
||||
static getNormalizedV(v) {
|
||||
const bv = getBigInt(v);
|
||||
if (bv === BN_0 || bv === BN_27) {
|
||||
return 27;
|
||||
}
|
||||
if (bv === BN_1 || bv === BN_28) {
|
||||
return 28;
|
||||
}
|
||||
assertArgument(bv >= BN_35, "invalid v", "v", v);
|
||||
// Otherwise, EIP-155 v means odd is 27 and even is 28
|
||||
return (bv & BN_1) ? 27 : 28;
|
||||
}
|
||||
/**
|
||||
* Creates a new [[Signature]].
|
||||
*
|
||||
* If no %%sig%% is provided, a new [[Signature]] is created
|
||||
* with default values.
|
||||
*
|
||||
* If %%sig%% is a string, it is parsed.
|
||||
*/
|
||||
static from(sig) {
|
||||
function assertError(check, message) {
|
||||
assertArgument(check, message, "signature", sig);
|
||||
}
|
||||
;
|
||||
if (sig == null) {
|
||||
return new Signature(_guard, ZeroHash, ZeroHash, 27);
|
||||
}
|
||||
if (typeof (sig) === "string") {
|
||||
const bytes = getBytes(sig, "signature");
|
||||
if (bytes.length === 64) {
|
||||
const r = hexlify(bytes.slice(0, 32));
|
||||
const s = bytes.slice(32, 64);
|
||||
const v = (s[0] & 0x80) ? 28 : 27;
|
||||
s[0] &= 0x7f;
|
||||
return new Signature(_guard, r, hexlify(s), v);
|
||||
}
|
||||
if (bytes.length === 65) {
|
||||
const r = hexlify(bytes.slice(0, 32));
|
||||
const s = hexlify(bytes.slice(32, 64));
|
||||
const v = Signature.getNormalizedV(bytes[64]);
|
||||
return new Signature(_guard, r, s, v);
|
||||
}
|
||||
assertError(false, "invalid raw signature length");
|
||||
}
|
||||
if (sig instanceof Signature) {
|
||||
return sig.clone();
|
||||
}
|
||||
// Get r
|
||||
const _r = sig.r;
|
||||
assertError(_r != null, "missing r");
|
||||
const r = toUint256(_r);
|
||||
// Get s; by any means necessary (we check consistency below)
|
||||
const s = (function (s, yParityAndS) {
|
||||
if (s != null) {
|
||||
return toUint256(s);
|
||||
}
|
||||
if (yParityAndS != null) {
|
||||
assertError(isHexString(yParityAndS, 32), "invalid yParityAndS");
|
||||
const bytes = getBytes(yParityAndS);
|
||||
bytes[0] &= 0x7f;
|
||||
return hexlify(bytes);
|
||||
}
|
||||
assertError(false, "missing s");
|
||||
})(sig.s, sig.yParityAndS);
|
||||
// Get v; by any means necessary (we check consistency below)
|
||||
const { networkV, v } = (function (_v, yParityAndS, yParity) {
|
||||
if (_v != null) {
|
||||
const v = getBigInt(_v);
|
||||
return {
|
||||
networkV: ((v >= BN_35) ? v : undefined),
|
||||
v: Signature.getNormalizedV(v)
|
||||
};
|
||||
}
|
||||
if (yParityAndS != null) {
|
||||
assertError(isHexString(yParityAndS, 32), "invalid yParityAndS");
|
||||
return { v: ((getBytes(yParityAndS)[0] & 0x80) ? 28 : 27) };
|
||||
}
|
||||
if (yParity != null) {
|
||||
switch (getNumber(yParity, "sig.yParity")) {
|
||||
case 0: return { v: 27 };
|
||||
case 1: return { v: 28 };
|
||||
}
|
||||
assertError(false, "invalid yParity");
|
||||
}
|
||||
assertError(false, "missing v");
|
||||
})(sig.v, sig.yParityAndS, sig.yParity);
|
||||
const result = new Signature(_guard, r, s, v);
|
||||
if (networkV) {
|
||||
result.#networkV = networkV;
|
||||
}
|
||||
// If multiple of v, yParity, yParityAndS we given, check they match
|
||||
assertError(sig.yParity == null || getNumber(sig.yParity, "sig.yParity") === result.yParity, "yParity mismatch");
|
||||
assertError(sig.yParityAndS == null || sig.yParityAndS === result.yParityAndS, "yParityAndS mismatch");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=signature.js.map
|
||||
1
dev/env/node_modules/ethers/lib.esm/crypto/signature.js.map
generated
vendored
Executable file
1
dev/env/node_modules/ethers/lib.esm/crypto/signature.js.map
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
122
dev/env/node_modules/ethers/lib.esm/crypto/signing-key.d.ts
generated
vendored
Executable file
122
dev/env/node_modules/ethers/lib.esm/crypto/signing-key.d.ts
generated
vendored
Executable file
@@ -0,0 +1,122 @@
|
||||
/**
|
||||
* Add details about signing here.
|
||||
*
|
||||
* @_subsection: api/crypto:Signing [about-signing]
|
||||
*/
|
||||
import { Signature } from "./signature.js";
|
||||
import type { BytesLike } from "../utils/index.js";
|
||||
import type { SignatureLike } from "./index.js";
|
||||
/**
|
||||
* A **SigningKey** provides high-level access to the elliptic curve
|
||||
* cryptography (ECC) operations and key management.
|
||||
*/
|
||||
export declare class SigningKey {
|
||||
#private;
|
||||
/**
|
||||
* Creates a new **SigningKey** for %%privateKey%%.
|
||||
*/
|
||||
constructor(privateKey: BytesLike);
|
||||
/**
|
||||
* The private key.
|
||||
*/
|
||||
get privateKey(): string;
|
||||
/**
|
||||
* The uncompressed public key.
|
||||
*
|
||||
* This will always begin with the prefix ``0x04`` and be 132
|
||||
* characters long (the ``0x`` prefix and 130 hexadecimal nibbles).
|
||||
*/
|
||||
get publicKey(): string;
|
||||
/**
|
||||
* The compressed public key.
|
||||
*
|
||||
* This will always begin with either the prefix ``0x02`` or ``0x03``
|
||||
* and be 68 characters long (the ``0x`` prefix and 33 hexadecimal
|
||||
* nibbles)
|
||||
*/
|
||||
get compressedPublicKey(): string;
|
||||
/**
|
||||
* Return the signature of the signed %%digest%%.
|
||||
*/
|
||||
sign(digest: BytesLike): Signature;
|
||||
/**
|
||||
* Returns the [[link-wiki-ecdh]] shared secret between this
|
||||
* private key and the %%other%% key.
|
||||
*
|
||||
* The %%other%% key may be any type of key, a raw public key,
|
||||
* a compressed/uncompressed pubic key or aprivate key.
|
||||
*
|
||||
* Best practice is usually to use a cryptographic hash on the
|
||||
* returned value before using it as a symetric secret.
|
||||
*
|
||||
* @example:
|
||||
* sign1 = new SigningKey(id("some-secret-1"))
|
||||
* sign2 = new SigningKey(id("some-secret-2"))
|
||||
*
|
||||
* // Notice that privA.computeSharedSecret(pubB)...
|
||||
* sign1.computeSharedSecret(sign2.publicKey)
|
||||
* //_result:
|
||||
*
|
||||
* // ...is equal to privB.computeSharedSecret(pubA).
|
||||
* sign2.computeSharedSecret(sign1.publicKey)
|
||||
* //_result:
|
||||
*/
|
||||
computeSharedSecret(other: BytesLike): string;
|
||||
/**
|
||||
* Compute the public key for %%key%%, optionally %%compressed%%.
|
||||
*
|
||||
* The %%key%% may be any type of key, a raw public key, a
|
||||
* compressed/uncompressed public key or private key.
|
||||
*
|
||||
* @example:
|
||||
* sign = new SigningKey(id("some-secret"));
|
||||
*
|
||||
* // Compute the uncompressed public key for a private key
|
||||
* SigningKey.computePublicKey(sign.privateKey)
|
||||
* //_result:
|
||||
*
|
||||
* // Compute the compressed public key for a private key
|
||||
* SigningKey.computePublicKey(sign.privateKey, true)
|
||||
* //_result:
|
||||
*
|
||||
* // Compute the uncompressed public key
|
||||
* SigningKey.computePublicKey(sign.publicKey, false);
|
||||
* //_result:
|
||||
*
|
||||
* // Compute the Compressed a public key
|
||||
* SigningKey.computePublicKey(sign.publicKey, true);
|
||||
* //_result:
|
||||
*/
|
||||
static computePublicKey(key: BytesLike, compressed?: boolean): string;
|
||||
/**
|
||||
* Returns the public key for the private key which produced the
|
||||
* %%signature%% for the given %%digest%%.
|
||||
*
|
||||
* @example:
|
||||
* key = new SigningKey(id("some-secret"))
|
||||
* digest = id("hello world")
|
||||
* sig = key.sign(digest)
|
||||
*
|
||||
* // Notice the signer public key...
|
||||
* key.publicKey
|
||||
* //_result:
|
||||
*
|
||||
* // ...is equal to the recovered public key
|
||||
* SigningKey.recoverPublicKey(digest, sig)
|
||||
* //_result:
|
||||
*
|
||||
*/
|
||||
static recoverPublicKey(digest: BytesLike, signature: SignatureLike): string;
|
||||
/**
|
||||
* Returns the point resulting from adding the ellipic curve points
|
||||
* %%p0%% and %%p1%%.
|
||||
*
|
||||
* This is not a common function most developers should require, but
|
||||
* can be useful for certain privacy-specific techniques.
|
||||
*
|
||||
* For example, it is used by [[HDNodeWallet]] to compute child
|
||||
* addresses from parent public keys and chain codes.
|
||||
*/
|
||||
static addPoints(p0: BytesLike, p1: BytesLike, compressed?: boolean): string;
|
||||
}
|
||||
//# sourceMappingURL=signing-key.d.ts.map
|
||||
1
dev/env/node_modules/ethers/lib.esm/crypto/signing-key.d.ts.map
generated
vendored
Executable file
1
dev/env/node_modules/ethers/lib.esm/crypto/signing-key.d.ts.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"signing-key.d.ts","sourceRoot":"","sources":["../../src.ts/crypto/signing-key.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGhD;;;GAGG;AACH,qBAAa,UAAU;;IAGnB;;OAEG;gBACS,UAAU,EAAE,SAAS;IAKjC;;OAEG;IACH,IAAI,UAAU,IAAI,MAAM,CAA6B;IAErD;;;;;OAKG;IACH,IAAI,SAAS,IAAI,MAAM,CAA0D;IAEjF;;;;;;OAMG;IACH,IAAI,mBAAmB,IAAI,MAAM,CAAgE;IAEjG;;OAEG;IACH,IAAI,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS;IAclC;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,mBAAmB,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM;IAK7C;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,MAAM,CAAC,gBAAgB,CAAC,GAAG,EAAE,SAAS,EAAE,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM;IAqBrE;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,GAAG,MAAM;IAc5E;;;;;;;;;OASG;IACH,MAAM,CAAC,SAAS,CAAC,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM;CAK/E"}
|
||||
166
dev/env/node_modules/ethers/lib.esm/crypto/signing-key.js
generated
vendored
Executable file
166
dev/env/node_modules/ethers/lib.esm/crypto/signing-key.js
generated
vendored
Executable file
@@ -0,0 +1,166 @@
|
||||
/**
|
||||
* Add details about signing here.
|
||||
*
|
||||
* @_subsection: api/crypto:Signing [about-signing]
|
||||
*/
|
||||
import { secp256k1 } from "@noble/curves/secp256k1";
|
||||
import { concat, dataLength, getBytes, getBytesCopy, hexlify, toBeHex, assertArgument } from "../utils/index.js";
|
||||
import { Signature } from "./signature.js";
|
||||
/**
|
||||
* A **SigningKey** provides high-level access to the elliptic curve
|
||||
* cryptography (ECC) operations and key management.
|
||||
*/
|
||||
export class SigningKey {
|
||||
#privateKey;
|
||||
/**
|
||||
* Creates a new **SigningKey** for %%privateKey%%.
|
||||
*/
|
||||
constructor(privateKey) {
|
||||
assertArgument(dataLength(privateKey) === 32, "invalid private key", "privateKey", "[REDACTED]");
|
||||
this.#privateKey = hexlify(privateKey);
|
||||
}
|
||||
/**
|
||||
* The private key.
|
||||
*/
|
||||
get privateKey() { return this.#privateKey; }
|
||||
/**
|
||||
* The uncompressed public key.
|
||||
*
|
||||
* This will always begin with the prefix ``0x04`` and be 132
|
||||
* characters long (the ``0x`` prefix and 130 hexadecimal nibbles).
|
||||
*/
|
||||
get publicKey() { return SigningKey.computePublicKey(this.#privateKey); }
|
||||
/**
|
||||
* The compressed public key.
|
||||
*
|
||||
* This will always begin with either the prefix ``0x02`` or ``0x03``
|
||||
* and be 68 characters long (the ``0x`` prefix and 33 hexadecimal
|
||||
* nibbles)
|
||||
*/
|
||||
get compressedPublicKey() { return SigningKey.computePublicKey(this.#privateKey, true); }
|
||||
/**
|
||||
* Return the signature of the signed %%digest%%.
|
||||
*/
|
||||
sign(digest) {
|
||||
assertArgument(dataLength(digest) === 32, "invalid digest length", "digest", digest);
|
||||
const sig = secp256k1.sign(getBytesCopy(digest), getBytesCopy(this.#privateKey), {
|
||||
lowS: true
|
||||
});
|
||||
return Signature.from({
|
||||
r: toBeHex(sig.r, 32),
|
||||
s: toBeHex(sig.s, 32),
|
||||
v: (sig.recovery ? 0x1c : 0x1b)
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Returns the [[link-wiki-ecdh]] shared secret between this
|
||||
* private key and the %%other%% key.
|
||||
*
|
||||
* The %%other%% key may be any type of key, a raw public key,
|
||||
* a compressed/uncompressed pubic key or aprivate key.
|
||||
*
|
||||
* Best practice is usually to use a cryptographic hash on the
|
||||
* returned value before using it as a symetric secret.
|
||||
*
|
||||
* @example:
|
||||
* sign1 = new SigningKey(id("some-secret-1"))
|
||||
* sign2 = new SigningKey(id("some-secret-2"))
|
||||
*
|
||||
* // Notice that privA.computeSharedSecret(pubB)...
|
||||
* sign1.computeSharedSecret(sign2.publicKey)
|
||||
* //_result:
|
||||
*
|
||||
* // ...is equal to privB.computeSharedSecret(pubA).
|
||||
* sign2.computeSharedSecret(sign1.publicKey)
|
||||
* //_result:
|
||||
*/
|
||||
computeSharedSecret(other) {
|
||||
const pubKey = SigningKey.computePublicKey(other);
|
||||
return hexlify(secp256k1.getSharedSecret(getBytesCopy(this.#privateKey), getBytes(pubKey), false));
|
||||
}
|
||||
/**
|
||||
* Compute the public key for %%key%%, optionally %%compressed%%.
|
||||
*
|
||||
* The %%key%% may be any type of key, a raw public key, a
|
||||
* compressed/uncompressed public key or private key.
|
||||
*
|
||||
* @example:
|
||||
* sign = new SigningKey(id("some-secret"));
|
||||
*
|
||||
* // Compute the uncompressed public key for a private key
|
||||
* SigningKey.computePublicKey(sign.privateKey)
|
||||
* //_result:
|
||||
*
|
||||
* // Compute the compressed public key for a private key
|
||||
* SigningKey.computePublicKey(sign.privateKey, true)
|
||||
* //_result:
|
||||
*
|
||||
* // Compute the uncompressed public key
|
||||
* SigningKey.computePublicKey(sign.publicKey, false);
|
||||
* //_result:
|
||||
*
|
||||
* // Compute the Compressed a public key
|
||||
* SigningKey.computePublicKey(sign.publicKey, true);
|
||||
* //_result:
|
||||
*/
|
||||
static computePublicKey(key, compressed) {
|
||||
let bytes = getBytes(key, "key");
|
||||
// private key
|
||||
if (bytes.length === 32) {
|
||||
const pubKey = secp256k1.getPublicKey(bytes, !!compressed);
|
||||
return hexlify(pubKey);
|
||||
}
|
||||
// raw public key; use uncompressed key with 0x04 prefix
|
||||
if (bytes.length === 64) {
|
||||
const pub = new Uint8Array(65);
|
||||
pub[0] = 0x04;
|
||||
pub.set(bytes, 1);
|
||||
bytes = pub;
|
||||
}
|
||||
const point = secp256k1.ProjectivePoint.fromHex(bytes);
|
||||
return hexlify(point.toRawBytes(compressed));
|
||||
}
|
||||
/**
|
||||
* Returns the public key for the private key which produced the
|
||||
* %%signature%% for the given %%digest%%.
|
||||
*
|
||||
* @example:
|
||||
* key = new SigningKey(id("some-secret"))
|
||||
* digest = id("hello world")
|
||||
* sig = key.sign(digest)
|
||||
*
|
||||
* // Notice the signer public key...
|
||||
* key.publicKey
|
||||
* //_result:
|
||||
*
|
||||
* // ...is equal to the recovered public key
|
||||
* SigningKey.recoverPublicKey(digest, sig)
|
||||
* //_result:
|
||||
*
|
||||
*/
|
||||
static recoverPublicKey(digest, signature) {
|
||||
assertArgument(dataLength(digest) === 32, "invalid digest length", "digest", digest);
|
||||
const sig = Signature.from(signature);
|
||||
let secpSig = secp256k1.Signature.fromCompact(getBytesCopy(concat([sig.r, sig.s])));
|
||||
secpSig = secpSig.addRecoveryBit(sig.yParity);
|
||||
const pubKey = secpSig.recoverPublicKey(getBytesCopy(digest));
|
||||
assertArgument(pubKey != null, "invalid signature for digest", "signature", signature);
|
||||
return "0x" + pubKey.toHex(false);
|
||||
}
|
||||
/**
|
||||
* Returns the point resulting from adding the ellipic curve points
|
||||
* %%p0%% and %%p1%%.
|
||||
*
|
||||
* This is not a common function most developers should require, but
|
||||
* can be useful for certain privacy-specific techniques.
|
||||
*
|
||||
* For example, it is used by [[HDNodeWallet]] to compute child
|
||||
* addresses from parent public keys and chain codes.
|
||||
*/
|
||||
static addPoints(p0, p1, compressed) {
|
||||
const pub0 = secp256k1.ProjectivePoint.fromHex(SigningKey.computePublicKey(p0).substring(2));
|
||||
const pub1 = secp256k1.ProjectivePoint.fromHex(SigningKey.computePublicKey(p1).substring(2));
|
||||
return "0x" + pub0.add(pub1).toHex(!!compressed);
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=signing-key.js.map
|
||||
1
dev/env/node_modules/ethers/lib.esm/crypto/signing-key.js.map
generated
vendored
Executable file
1
dev/env/node_modules/ethers/lib.esm/crypto/signing-key.js.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"signing-key.js","sourceRoot":"","sources":["../../src.ts/crypto/signing-key.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EACH,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,EAC5D,cAAc,EACjB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAO3C;;;GAGG;AACH,MAAM,OAAO,UAAU;IACnB,WAAW,CAAS;IAEpB;;OAEG;IACH,YAAY,UAAqB;QAC7B,cAAc,CAAC,UAAU,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,qBAAqB,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;QACjG,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC3C,CAAC;IAED;;OAEG;IACH,IAAI,UAAU,KAAa,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;IAErD;;;;;OAKG;IACH,IAAI,SAAS,KAAa,OAAO,UAAU,CAAC,gBAAgB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAEjF;;;;;;OAMG;IACH,IA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