2022-09-05 23:57:11 +03:00
|
|
|
|
function number(n) {
|
|
|
|
|
if (!Number.isSafeInteger(n) || n < 0)
|
|
|
|
|
throw new Error(`Wrong positive integer: ${n}`);
|
|
|
|
|
}
|
|
|
|
|
function bytes(b, ...lengths) {
|
|
|
|
|
if (!(b instanceof Uint8Array))
|
2023-10-10 03:27:56 +03:00
|
|
|
|
throw new Error('Expected Uint8Array');
|
2022-09-05 23:57:11 +03:00
|
|
|
|
if (lengths.length > 0 && !lengths.includes(b.length))
|
2023-10-10 03:27:56 +03:00
|
|
|
|
throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`);
|
2022-09-05 23:57:11 +03:00
|
|
|
|
}
|
|
|
|
|
function exists(instance, checkFinished = true) {
|
|
|
|
|
if (instance.destroyed)
|
|
|
|
|
throw new Error('Hash instance has been destroyed');
|
|
|
|
|
if (checkFinished && instance.finished)
|
|
|
|
|
throw new Error('Hash#digest() has already been called');
|
|
|
|
|
}
|
|
|
|
|
function output(out, instance) {
|
|
|
|
|
bytes(out);
|
|
|
|
|
const min = instance.outputLen;
|
|
|
|
|
if (out.length < min) {
|
|
|
|
|
throw new Error(`digestInto() expects output buffer of length at least ${min}`);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-16 05:58:45 +03:00
|
|
|
|
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
2023-10-10 03:27:56 +03:00
|
|
|
|
// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+.
|
|
|
|
|
// node.js versions earlier than v19 don't declare it in global scope.
|
|
|
|
|
// For node.js, package.json#exports field mapping rewrites import
|
|
|
|
|
// from `crypto` to `cryptoNode`, which imports native module.
|
|
|
|
|
// Makes the utils un-importable in browsers without a bundler.
|
|
|
|
|
// Once node.js 18 is deprecated, we can just drop the import.
|
|
|
|
|
const u8a = (a) => a instanceof Uint8Array;
|
2022-09-16 05:58:45 +03:00
|
|
|
|
const u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
|
2023-10-10 03:27:56 +03:00
|
|
|
|
// big-endian hardware is rare. Just in case someone still decides to run hashes:
|
|
|
|
|
// early-throw an error because we don't support BE yet.
|
2022-09-16 05:58:45 +03:00
|
|
|
|
const isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44;
|
|
|
|
|
if (!isLE)
|
|
|
|
|
throw new Error('Non little-endian hardware is not supported');
|
2023-10-10 03:27:56 +03:00
|
|
|
|
/**
|
|
|
|
|
* @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])
|
|
|
|
|
*/
|
2022-09-16 05:58:45 +03:00
|
|
|
|
function utf8ToBytes(str) {
|
2023-10-10 03:27:56 +03:00
|
|
|
|
if (typeof str !== 'string')
|
|
|
|
|
throw new Error(`utf8ToBytes expected string, got ${typeof str}`);
|
|
|
|
|
return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809
|
2022-09-16 05:58:45 +03:00
|
|
|
|
}
|
2023-10-10 03:27:56 +03:00
|
|
|
|
/**
|
|
|
|
|
* Normalizes (non-hex) string or Uint8Array to Uint8Array.
|
|
|
|
|
* Warning: when Uint8Array is passed, it would NOT get copied.
|
|
|
|
|
* Keep in mind for future mutable operations.
|
|
|
|
|
*/
|
2022-09-16 05:58:45 +03:00
|
|
|
|
function toBytes(data) {
|
|
|
|
|
if (typeof data === 'string')
|
|
|
|
|
data = utf8ToBytes(data);
|
2023-10-10 03:27:56 +03:00
|
|
|
|
if (!u8a(data))
|
|
|
|
|
throw new Error(`expected Uint8Array, got ${typeof data}`);
|
2022-09-16 05:58:45 +03:00
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
// For runtime check if class implements interface
|
|
|
|
|
class Hash {
|
|
|
|
|
// Safe version that clones internal state
|
|
|
|
|
clone() {
|
|
|
|
|
return this._cloneInto();
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-10-10 03:27:56 +03:00
|
|
|
|
function wrapConstructor(hashCons) {
|
|
|
|
|
const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
|
|
|
|
|
const tmp = hashCons();
|
2022-09-16 05:58:45 +03:00
|
|
|
|
hashC.outputLen = tmp.outputLen;
|
|
|
|
|
hashC.blockLen = tmp.blockLen;
|
2023-10-10 03:27:56 +03:00
|
|
|
|
hashC.create = () => hashCons();
|
2022-09-16 05:58:45 +03:00
|
|
|
|
return hashC;
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-10 03:27:56 +03:00
|
|
|
|
const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
|
|
|
|
|
const _32n = /* @__PURE__ */ BigInt(32);
|
2022-09-05 23:57:11 +03:00
|
|
|
|
// We are not using BigUint64Array, because they are extremely slow as per 2022
|
|
|
|
|
function fromBig(n, le = false) {
|
|
|
|
|
if (le)
|
|
|
|
|
return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) };
|
|
|
|
|
return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
|
|
|
|
|
}
|
|
|
|
|
function split(lst, le = false) {
|
|
|
|
|
let Ah = new Uint32Array(lst.length);
|
|
|
|
|
let Al = new Uint32Array(lst.length);
|
|
|
|
|
for (let i = 0; i < lst.length; i++) {
|
|
|
|
|
const { h, l } = fromBig(lst[i], le);
|
|
|
|
|
[Ah[i], Al[i]] = [h, l];
|
|
|
|
|
}
|
|
|
|
|
return [Ah, Al];
|
|
|
|
|
}
|
|
|
|
|
// Left rotate for Shift in [1, 32)
|
|
|
|
|
const rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s));
|
|
|
|
|
const rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s));
|
|
|
|
|
// Left rotate for Shift in (32, 64), NOTE: 32 is special case.
|
|
|
|
|
const rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s));
|
|
|
|
|
const rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s));
|
|
|
|
|
|
2023-02-16 16:19:59 +03:00
|
|
|
|
/* Do NOT modify this file; see /src.ts/_admin/update-version.ts */
|
|
|
|
|
/**
|
|
|
|
|
* The current version of Ethers.
|
|
|
|
|
*/
|
2024-02-02 11:25:03 +03:00
|
|
|
|
const version = "6.11.0";
|
2022-09-05 23:57:11 +03:00
|
|
|
|
|
2022-12-04 01:01:29 +03:00
|
|
|
|
/**
|
|
|
|
|
* Property helper functions.
|
|
|
|
|
*
|
|
|
|
|
* @_subsection api/utils:Properties [about-properties]
|
|
|
|
|
*/
|
|
|
|
|
function checkType(value, type, name) {
|
2022-09-16 05:58:45 +03:00
|
|
|
|
const types = type.split("|").map(t => t.trim());
|
|
|
|
|
for (let i = 0; i < types.length; i++) {
|
|
|
|
|
switch (type) {
|
|
|
|
|
case "any":
|
|
|
|
|
return;
|
2022-12-04 01:01:29 +03:00
|
|
|
|
case "bigint":
|
2022-09-16 05:58:45 +03:00
|
|
|
|
case "boolean":
|
|
|
|
|
case "number":
|
|
|
|
|
case "string":
|
|
|
|
|
if (typeof (value) === type) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-12-04 01:01:29 +03:00
|
|
|
|
const error = new Error(`invalid value for type ${type}`);
|
|
|
|
|
error.code = "INVALID_ARGUMENT";
|
|
|
|
|
error.argument = `value.${name}`;
|
|
|
|
|
error.value = value;
|
|
|
|
|
throw error;
|
2022-09-16 05:58:45 +03:00
|
|
|
|
}
|
2022-12-04 01:01:29 +03:00
|
|
|
|
/**
|
|
|
|
|
* Assigns the %%values%% to %%target%% as read-only values.
|
|
|
|
|
*
|
|
|
|
|
* It %%types%% is specified, the values are checked.
|
|
|
|
|
*/
|
|
|
|
|
function defineProperties(target, values, types) {
|
2022-09-16 05:58:45 +03:00
|
|
|
|
for (let key in values) {
|
|
|
|
|
let value = values[key];
|
2022-12-04 01:01:29 +03:00
|
|
|
|
const type = (types ? types[key] : null);
|
|
|
|
|
if (type) {
|
|
|
|
|
checkType(value, type, key);
|
2022-09-16 05:58:45 +03:00
|
|
|
|
}
|
|
|
|
|
Object.defineProperty(target, key, { enumerable: true, value, writable: false });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-04 01:01:29 +03:00
|
|
|
|
/**
|
2023-06-02 00:52:58 +03:00
|
|
|
|
* All errors in ethers include properties to ensure they are both
|
|
|
|
|
* human-readable (i.e. ``.message``) and machine-readable (i.e. ``.code``).
|
|
|
|
|
*
|
|
|
|
|
* The [[isError]] function can be used to check the error ``code`` and
|
|
|
|
|
* provide a type guard for the properties present on that error interface.
|
2022-12-04 01:01:29 +03:00
|
|
|
|
*
|
|
|
|
|
* @_section: api/utils/errors:Errors [about-errors]
|
|
|
|
|
*/
|
|
|
|
|
function stringify(value) {
|
|
|
|
|
if (value == null) {
|
|
|
|
|
return "null";
|
|
|
|
|
}
|
|
|
|
|
if (Array.isArray(value)) {
|
|
|
|
|
return "[ " + (value.map(stringify)).join(", ") + " ]";
|
|
|
|
|
}
|
|
|
|
|
if (value instanceof Uint8Array) {
|
|
|
|
|
const HEX = "0123456789abcdef";
|
|
|
|
|
let result = "0x";
|
|
|
|
|
for (let i = 0; i < value.length; i++) {
|
|
|
|
|
result += HEX[value[i] >> 4];
|
|
|
|
|
result += HEX[value[i] & 0xf];
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
if (typeof (value) === "object" && typeof (value.toJSON) === "function") {
|
|
|
|
|
return stringify(value.toJSON());
|
|
|
|
|
}
|
|
|
|
|
switch (typeof (value)) {
|
|
|
|
|
case "boolean":
|
|
|
|
|
case "symbol":
|
|
|
|
|
return value.toString();
|
|
|
|
|
case "bigint":
|
|
|
|
|
return BigInt(value).toString();
|
|
|
|
|
case "number":
|
|
|
|
|
return (value).toString();
|
|
|
|
|
case "string":
|
|
|
|
|
return JSON.stringify(value);
|
|
|
|
|
case "object": {
|
|
|
|
|
const keys = Object.keys(value);
|
|
|
|
|
keys.sort();
|
|
|
|
|
return "{ " + keys.map((k) => `${stringify(k)}: ${stringify(value[k])}`).join(", ") + " }";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return `[ COULD NOT SERIALIZE ]`;
|
|
|
|
|
}
|
2022-09-16 05:58:45 +03:00
|
|
|
|
/**
|
|
|
|
|
* Returns a new Error configured to the format ethers emits errors, with
|
2023-11-12 02:00:39 +03:00
|
|
|
|
* the %%message%%, [[api:ErrorCode]] %%code%% and additional properties
|
2022-09-16 05:58:45 +03:00
|
|
|
|
* for the corresponding EthersError.
|
|
|
|
|
*
|
|
|
|
|
* Each error in ethers includes the version of ethers, a
|
2023-11-12 02:00:39 +03:00
|
|
|
|
* machine-readable [[ErrorCode]], and depending on %%code%%, additional
|
|
|
|
|
* required properties. The error message will also include the %%message%%,
|
|
|
|
|
* ethers version, %%code%% and all additional properties, serialized.
|
2022-09-16 05:58:45 +03:00
|
|
|
|
*/
|
|
|
|
|
function makeError(message, code, info) {
|
2023-10-10 03:27:56 +03:00
|
|
|
|
let shortMessage = message;
|
2022-09-16 05:58:45 +03:00
|
|
|
|
{
|
|
|
|
|
const details = [];
|
|
|
|
|
if (info) {
|
|
|
|
|
if ("message" in info || "code" in info || "name" in info) {
|
2022-12-04 01:01:29 +03:00
|
|
|
|
throw new Error(`value will overwrite populated values: ${stringify(info)}`);
|
2022-09-16 05:58:45 +03:00
|
|
|
|
}
|
|
|
|
|
for (const key in info) {
|
2023-10-10 03:27:56 +03:00
|
|
|
|
if (key === "shortMessage") {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2022-09-16 05:58:45 +03:00
|
|
|
|
const value = (info[key]);
|
2022-12-04 01:01:29 +03:00
|
|
|
|
// try {
|
|
|
|
|
details.push(key + "=" + stringify(value));
|
|
|
|
|
// } catch (error: any) {
|
|
|
|
|
// console.log("MMM", error.message);
|
|
|
|
|
// details.push(key + "=[could not serialize object]");
|
|
|
|
|
// }
|
2022-09-16 05:58:45 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
details.push(`code=${code}`);
|
|
|
|
|
details.push(`version=${version}`);
|
|
|
|
|
if (details.length) {
|
|
|
|
|
message += " (" + details.join(", ") + ")";
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-12-04 01:01:29 +03:00
|
|
|
|
let error;
|
|
|
|
|
switch (code) {
|
|
|
|
|
case "INVALID_ARGUMENT":
|
|
|
|
|
error = new TypeError(message);
|
|
|
|
|
break;
|
|
|
|
|
case "NUMERIC_FAULT":
|
|
|
|
|
case "BUFFER_OVERRUN":
|
|
|
|
|
error = new RangeError(message);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
error = new Error(message);
|
|
|
|
|
}
|
|
|
|
|
defineProperties(error, { code });
|
2022-09-16 05:58:45 +03:00
|
|
|
|
if (info) {
|
2023-02-16 16:19:59 +03:00
|
|
|
|
Object.assign(error, info);
|
2022-09-16 05:58:45 +03:00
|
|
|
|
}
|
2023-10-10 03:27:56 +03:00
|
|
|
|
if (error.shortMessage == null) {
|
|
|
|
|
defineProperties(error, { shortMessage });
|
|
|
|
|
}
|
2022-09-16 05:58:45 +03:00
|
|
|
|
return error;
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* Throws an EthersError with %%message%%, %%code%% and additional error
|
2022-11-10 06:45:17 +03:00
|
|
|
|
* %%info%% when %%check%% is falsish..
|
2022-09-16 05:58:45 +03:00
|
|
|
|
*
|
|
|
|
|
* @see [[api:makeError]]
|
|
|
|
|
*/
|
2022-11-10 06:45:17 +03:00
|
|
|
|
function assert(check, message, code, info) {
|
|
|
|
|
if (!check) {
|
|
|
|
|
throw makeError(message, code, info);
|
|
|
|
|
}
|
2022-09-16 05:58:45 +03:00
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* A simple helper to simply ensuring provided arguments match expected
|
|
|
|
|
* constraints, throwing if not.
|
|
|
|
|
*
|
|
|
|
|
* In TypeScript environments, the %%check%% has been asserted true, so
|
|
|
|
|
* any further code does not need additional compile-time checks.
|
|
|
|
|
*/
|
|
|
|
|
function assertArgument(check, message, name, value) {
|
2022-11-10 06:45:17 +03:00
|
|
|
|
assert(check, message, "INVALID_ARGUMENT", { argument: name, value: value });
|
2022-09-16 05:58:45 +03:00
|
|
|
|
}
|
|
|
|
|
const _normalizeForms = ["NFD", "NFC", "NFKD", "NFKC"].reduce((accum, form) => {
|
|
|
|
|
try {
|
|
|
|
|
// General test for normalize
|
|
|
|
|
/* c8 ignore start */
|
|
|
|
|
if ("test".normalize(form) !== "test") {
|
|
|
|
|
throw new Error("bad");
|
|
|
|
|
}
|
|
|
|
|
;
|
|
|
|
|
/* c8 ignore stop */
|
|
|
|
|
if (form === "NFD") {
|
|
|
|
|
const check = String.fromCharCode(0xe9).normalize("NFD");
|
|
|
|
|
const expected = String.fromCharCode(0x65, 0x0301);
|
|
|
|
|
/* c8 ignore start */
|
|
|
|
|
if (check !== expected) {
|
|
|
|
|
throw new Error("broken");
|
|
|
|
|
}
|
|
|
|
|
/* c8 ignore stop */
|
|
|
|
|
}
|
|
|
|
|
accum.push(form);
|
|
|
|
|
}
|
|
|
|
|
catch (error) { }
|
|
|
|
|
return accum;
|
|
|
|
|
}, []);
|
|
|
|
|
/**
|
|
|
|
|
* Throws if the normalization %%form%% is not supported.
|
|
|
|
|
*/
|
|
|
|
|
function assertNormalize(form) {
|
2022-11-10 06:45:17 +03:00
|
|
|
|
assert(_normalizeForms.indexOf(form) >= 0, "platform missing String.prototype.normalize", "UNSUPPORTED_OPERATION", {
|
|
|
|
|
operation: "String.prototype.normalize", info: { form }
|
|
|
|
|
});
|
2022-09-16 05:58:45 +03:00
|
|
|
|
}
|
|
|
|
|
|
2022-12-04 01:01:29 +03:00
|
|
|
|
/**
|
|
|
|
|
* Some data helpers.
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* @_subsection api/utils:Data Helpers [about-data]
|
|
|
|
|
*/
|
2022-09-16 05:58:45 +03:00
|
|
|
|
function _getBytes(value, name, copy) {
|
|
|
|
|
if (value instanceof Uint8Array) {
|
|
|
|
|
if (copy) {
|
|
|
|
|
return new Uint8Array(value);
|
2022-09-05 23:57:11 +03:00
|
|
|
|
}
|
2022-09-16 05:58:45 +03:00
|
|
|
|
return value;
|
|
|
|
|
}
|
|
|
|
|
if (typeof (value) === "string" && value.match(/^0x([0-9a-f][0-9a-f])*$/i)) {
|
|
|
|
|
const result = new Uint8Array((value.length - 2) / 2);
|
|
|
|
|
let offset = 2;
|
|
|
|
|
for (let i = 0; i < result.length; i++) {
|
|
|
|
|
result[i] = parseInt(value.substring(offset, offset + 2), 16);
|
|
|
|
|
offset += 2;
|
|
|
|
|
}
|
|
|
|
|
return result;
|
2022-09-05 23:57:11 +03:00
|
|
|
|
}
|
2022-11-10 06:45:17 +03:00
|
|
|
|
assertArgument(false, "invalid BytesLike value", name || "value", value);
|
2022-09-05 23:57:11 +03:00
|
|
|
|
}
|
2022-09-16 05:58:45 +03:00
|
|
|
|
/**
|
|
|
|
|
* Get a typed Uint8Array for %%value%%. If already a Uint8Array
|
|
|
|
|
* the original %%value%% is returned; if a copy is required use
|
|
|
|
|
* [[getBytesCopy]].
|
|
|
|
|
*
|
|
|
|
|
* @see: getBytesCopy
|
|
|
|
|
*/
|
|
|
|
|
function getBytes(value, name) {
|
|
|
|
|
return _getBytes(value, name, false);
|
|
|
|
|
}
|
|
|
|
|
const HexCharacters = "0123456789abcdef";
|
|
|
|
|
/**
|
2022-12-04 01:01:29 +03:00
|
|
|
|
* Returns a [[DataHexString]] representation of %%data%%.
|
2022-09-16 05:58:45 +03:00
|
|
|
|
*/
|
|
|
|
|
function hexlify(data) {
|
|
|
|
|
const bytes = getBytes(data);
|
|
|
|
|
let result = "0x";
|
|
|
|
|
for (let i = 0; i < bytes.length; i++) {
|
|
|
|
|
const v = bytes[i];
|
|
|
|
|
result += HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f];
|
2022-09-05 23:57:11 +03:00
|
|
|
|
}
|
2022-09-16 05:58:45 +03:00
|
|
|
|
return result;
|
2022-09-05 23:57:11 +03:00
|
|
|
|
}
|
|
|
|
|
|
2022-12-04 01:01:29 +03:00
|
|
|
|
/**
|
|
|
|
|
* Using strings in Ethereum (or any security-basd system) requires
|
|
|
|
|
* additional care. These utilities attempt to mitigate some of the
|
|
|
|
|
* safety issues as well as provide the ability to recover and analyse
|
|
|
|
|
* strings.
|
|
|
|
|
*
|
|
|
|
|
* @_subsection api/utils:Strings and UTF-8 [about-strings]
|
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
|
function errorFunc(reason, offset, bytes, output, badCodepoint) {
|
2022-11-10 06:45:17 +03:00
|
|
|
|
assertArgument(false, `invalid codepoint at offset ${offset}; ${reason}`, "bytes", bytes);
|
2022-09-05 23:57:11 +03:00
|
|
|
|
}
|
|
|
|
|
function ignoreFunc(reason, offset, bytes, output, badCodepoint) {
|
|
|
|
|
// If there is an invalid prefix (including stray continuation), skip any additional continuation bytes
|
|
|
|
|
if (reason === "BAD_PREFIX" || reason === "UNEXPECTED_CONTINUE") {
|
|
|
|
|
let i = 0;
|
|
|
|
|
for (let o = offset + 1; o < bytes.length; o++) {
|
|
|
|
|
if (bytes[o] >> 6 !== 0x02) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
return i;
|
|
|
|
|
}
|
|
|
|
|
// This byte runs us past the end of the string, so just jump to the end
|
|
|
|
|
// (but the first byte was read already read and therefore skipped)
|
|
|
|
|
if (reason === "OVERRUN") {
|
|
|
|
|
return bytes.length - offset - 1;
|
|
|
|
|
}
|
|
|
|
|
// Nothing to skip
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
function replaceFunc(reason, offset, bytes, output, badCodepoint) {
|
|
|
|
|
// Overlong representations are otherwise "valid" code points; just non-deistingtished
|
|
|
|
|
if (reason === "OVERLONG") {
|
2022-12-04 01:01:29 +03:00
|
|
|
|
assertArgument(typeof (badCodepoint) === "number", "invalid bad code point for replacement", "badCodepoint", badCodepoint);
|
|
|
|
|
output.push(badCodepoint);
|
2022-09-05 23:57:11 +03:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
// Put the replacement character into the output
|
|
|
|
|
output.push(0xfffd);
|
|
|
|
|
// Otherwise, process as if ignoring errors
|
|
|
|
|
return ignoreFunc(reason, offset, bytes);
|
|
|
|
|
}
|
2023-02-13 06:14:26 +03:00
|
|
|
|
/**
|
|
|
|
|
* A handful of popular, built-in UTF-8 error handling strategies.
|
|
|
|
|
*
|
|
|
|
|
* **``"error"``** - throws on ANY illegal UTF-8 sequence or
|
|
|
|
|
* non-canonical (overlong) codepoints (this is the default)
|
|
|
|
|
*
|
|
|
|
|
* **``"ignore"``** - silently drops any illegal UTF-8 sequence
|
|
|
|
|
* and accepts non-canonical (overlong) codepoints
|
|
|
|
|
*
|
|
|
|
|
* **``"replace"``** - replace any illegal UTF-8 sequence with the
|
2023-02-23 05:53:56 +03:00
|
|
|
|
* UTF-8 replacement character (i.e. ``"\\ufffd"``) and accepts
|
2023-02-13 06:14:26 +03:00
|
|
|
|
* non-canonical (overlong) codepoints
|
|
|
|
|
*
|
|
|
|
|
* @returns: Record<"error" | "ignore" | "replace", Utf8ErrorFunc>
|
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
|
const Utf8ErrorFuncs = Object.freeze({
|
|
|
|
|
error: errorFunc,
|
|
|
|
|
ignore: ignoreFunc,
|
|
|
|
|
replace: replaceFunc
|
|
|
|
|
});
|
|
|
|
|
// http://stackoverflow.com/questions/13356493/decode-utf-8-with-javascript#13691499
|
|
|
|
|
function getUtf8CodePoints(_bytes, onError) {
|
|
|
|
|
if (onError == null) {
|
|
|
|
|
onError = Utf8ErrorFuncs.error;
|
|
|
|
|
}
|
2022-09-16 05:58:45 +03:00
|
|
|
|
const bytes = getBytes(_bytes, "bytes");
|
2022-09-05 23:57:11 +03:00
|
|
|
|
const result = [];
|
|
|
|
|
let i = 0;
|
|
|
|
|
// Invalid bytes are ignored
|
|
|
|
|
while (i < bytes.length) {
|
|
|
|
|
const c = bytes[i++];
|
|
|
|
|
// 0xxx xxxx
|
|
|
|
|
if (c >> 7 === 0) {
|
|
|
|
|
result.push(c);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
// Multibyte; how many bytes left for this character?
|
|
|
|
|
let extraLength = null;
|
|
|
|
|
let overlongMask = null;
|
|
|
|
|
// 110x xxxx 10xx xxxx
|
|
|
|
|
if ((c & 0xe0) === 0xc0) {
|
|
|
|
|
extraLength = 1;
|
|
|
|
|
overlongMask = 0x7f;
|
|
|
|
|
// 1110 xxxx 10xx xxxx 10xx xxxx
|
|
|
|
|
}
|
|
|
|
|
else if ((c & 0xf0) === 0xe0) {
|
|
|
|
|
extraLength = 2;
|
|
|
|
|
overlongMask = 0x7ff;
|
|
|
|
|
// 1111 0xxx 10xx xxxx 10xx xxxx 10xx xxxx
|
|
|
|
|
}
|
|
|
|
|
else if ((c & 0xf8) === 0xf0) {
|
|
|
|
|
extraLength = 3;
|
|
|
|
|
overlongMask = 0xffff;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if ((c & 0xc0) === 0x80) {
|
|
|
|
|
i += onError("UNEXPECTED_CONTINUE", i - 1, bytes, result);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
i += onError("BAD_PREFIX", i - 1, bytes, result);
|
|
|
|
|
}
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
// Do we have enough bytes in our data?
|
|
|
|
|
if (i - 1 + extraLength >= bytes.length) {
|
|
|
|
|
i += onError("OVERRUN", i - 1, bytes, result);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
// Remove the length prefix from the char
|
|
|
|
|
let res = c & ((1 << (8 - extraLength - 1)) - 1);
|
|
|
|
|
for (let j = 0; j < extraLength; j++) {
|
|
|
|
|
let nextChar = bytes[i];
|
|
|
|
|
// Invalid continuation byte
|
|
|
|
|
if ((nextChar & 0xc0) != 0x80) {
|
|
|
|
|
i += onError("MISSING_CONTINUE", i, bytes, result);
|
|
|
|
|
res = null;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
res = (res << 6) | (nextChar & 0x3f);
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
// See above loop for invalid continuation byte
|
|
|
|
|
if (res === null) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
// Maximum code point
|
|
|
|
|
if (res > 0x10ffff) {
|
|
|
|
|
i += onError("OUT_OF_RANGE", i - 1 - extraLength, bytes, result, res);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
// Reserved for UTF-16 surrogate halves
|
|
|
|
|
if (res >= 0xd800 && res <= 0xdfff) {
|
|
|
|
|
i += onError("UTF16_SURROGATE", i - 1 - extraLength, bytes, result, res);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
// Check for overlong sequences (more bytes than needed)
|
|
|
|
|
if (res <= overlongMask) {
|
|
|
|
|
i += onError("OVERLONG", i - 1 - extraLength, bytes, result, res);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
result.push(res);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
// http://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array
|
2022-12-04 01:01:29 +03:00
|
|
|
|
/**
|
|
|
|
|
* Returns the UTF-8 byte representation of %%str%%.
|
|
|
|
|
*
|
|
|
|
|
* If %%form%% is specified, the string is normalized.
|
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
|
function toUtf8Bytes(str, form) {
|
|
|
|
|
if (form != null) {
|
2022-09-16 05:58:45 +03:00
|
|
|
|
assertNormalize(form);
|
2022-09-05 23:57:11 +03:00
|
|
|
|
str = str.normalize(form);
|
|
|
|
|
}
|
|
|
|
|
let result = [];
|
|
|
|
|
for (let i = 0; i < str.length; i++) {
|
|
|
|
|
const c = str.charCodeAt(i);
|
|
|
|
|
if (c < 0x80) {
|
|
|
|
|
result.push(c);
|
|
|
|
|
}
|
|
|
|
|
else if (c < 0x800) {
|
|
|
|
|
result.push((c >> 6) | 0xc0);
|
|
|
|
|
result.push((c & 0x3f) | 0x80);
|
|
|
|
|
}
|
|
|
|
|
else if ((c & 0xfc00) == 0xd800) {
|
|
|
|
|
i++;
|
|
|
|
|
const c2 = str.charCodeAt(i);
|
2022-11-10 06:45:17 +03:00
|
|
|
|
assertArgument(i < str.length && ((c2 & 0xfc00) === 0xdc00), "invalid surrogate pair", "str", str);
|
2022-09-05 23:57:11 +03:00
|
|
|
|
// Surrogate Pair
|
|
|
|
|
const pair = 0x10000 + ((c & 0x03ff) << 10) + (c2 & 0x03ff);
|
|
|
|
|
result.push((pair >> 18) | 0xf0);
|
|
|
|
|
result.push(((pair >> 12) & 0x3f) | 0x80);
|
|
|
|
|
result.push(((pair >> 6) & 0x3f) | 0x80);
|
|
|
|
|
result.push((pair & 0x3f) | 0x80);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
result.push((c >> 12) | 0xe0);
|
|
|
|
|
result.push(((c >> 6) & 0x3f) | 0x80);
|
|
|
|
|
result.push((c & 0x3f) | 0x80);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return new Uint8Array(result);
|
|
|
|
|
}
|
2022-12-04 01:01:29 +03:00
|
|
|
|
//export
|
2022-09-05 23:57:11 +03:00
|
|
|
|
function _toUtf8String(codePoints) {
|
|
|
|
|
return codePoints.map((codePoint) => {
|
|
|
|
|
if (codePoint <= 0xffff) {
|
|
|
|
|
return String.fromCharCode(codePoint);
|
|
|
|
|
}
|
|
|
|
|
codePoint -= 0x10000;
|
|
|
|
|
return String.fromCharCode((((codePoint >> 10) & 0x3ff) + 0xd800), ((codePoint & 0x3ff) + 0xdc00));
|
|
|
|
|
}).join("");
|
|
|
|
|
}
|
2022-12-04 01:01:29 +03:00
|
|
|
|
/**
|
|
|
|
|
* Returns the string represented by the UTF-8 data %%bytes%%.
|
|
|
|
|
*
|
|
|
|
|
* When %%onError%% function is specified, it is called on UTF-8
|
|
|
|
|
* errors allowing recovery using the [[Utf8ErrorFunc]] API.
|
2023-02-13 06:14:26 +03:00
|
|
|
|
* (default: [error](Utf8ErrorFuncs))
|
2022-12-04 01:01:29 +03:00
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
|
function toUtf8String(bytes, onError) {
|
|
|
|
|
return _toUtf8String(getUtf8CodePoints(bytes, onError));
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-10 03:27:56 +03:00
|
|
|
|
// SHA3 (keccak) is based on a new design: basically, the internal state is bigger than output size.
|
|
|
|
|
// It's called a sponge function.
|
2022-09-16 05:58:45 +03:00
|
|
|
|
// Various per round constants calculations
|
|
|
|
|
const [SHA3_PI, SHA3_ROTL, _SHA3_IOTA] = [[], [], []];
|
2023-10-10 03:27:56 +03:00
|
|
|
|
const _0n = /* @__PURE__ */ BigInt(0);
|
|
|
|
|
const _1n = /* @__PURE__ */ BigInt(1);
|
|
|
|
|
const _2n = /* @__PURE__ */ BigInt(2);
|
|
|
|
|
const _7n = /* @__PURE__ */ BigInt(7);
|
|
|
|
|
const _256n = /* @__PURE__ */ BigInt(256);
|
|
|
|
|
const _0x71n = /* @__PURE__ */ BigInt(0x71);
|
2022-09-16 05:58:45 +03:00
|
|
|
|
for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {
|
|
|
|
|
// Pi
|
|
|
|
|
[x, y] = [y, (2 * x + 3 * y) % 5];
|
|
|
|
|
SHA3_PI.push(2 * (5 * y + x));
|
|
|
|
|
// Rotational
|
|
|
|
|
SHA3_ROTL.push((((round + 1) * (round + 2)) / 2) % 64);
|
|
|
|
|
// Iota
|
|
|
|
|
let t = _0n;
|
|
|
|
|
for (let j = 0; j < 7; j++) {
|
|
|
|
|
R = ((R << _1n) ^ ((R >> _7n) * _0x71n)) % _256n;
|
|
|
|
|
if (R & _2n)
|
2023-10-10 03:27:56 +03:00
|
|
|
|
t ^= _1n << ((_1n << /* @__PURE__ */ BigInt(j)) - _1n);
|
2022-09-16 05:58:45 +03:00
|
|
|
|
}
|
|
|
|
|
_SHA3_IOTA.push(t);
|
|
|
|
|
}
|
2023-10-10 03:27:56 +03:00
|
|
|
|
const [SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ split(_SHA3_IOTA, true);
|
2022-09-16 05:58:45 +03:00
|
|
|
|
// Left rotation (without 0, 32, 64)
|
2023-10-10 03:27:56 +03:00
|
|
|
|
const rotlH = (h, l, s) => (s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s));
|
|
|
|
|
const rotlL = (h, l, s) => (s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s));
|
2022-09-16 05:58:45 +03:00
|
|
|
|
// Same as keccakf1600, but allows to skip some rounds
|
|
|
|
|
function keccakP(s, rounds = 24) {
|
|
|
|
|
const B = new Uint32Array(5 * 2);
|
|
|
|
|
// NOTE: all indices are x2 since we store state as u32 instead of u64 (bigints to slow in js)
|
|
|
|
|
for (let round = 24 - rounds; round < 24; round++) {
|
|
|
|
|
// Theta θ
|
|
|
|
|
for (let x = 0; x < 10; x++)
|
|
|
|
|
B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];
|
|
|
|
|
for (let x = 0; x < 10; x += 2) {
|
|
|
|
|
const idx1 = (x + 8) % 10;
|
|
|
|
|
const idx0 = (x + 2) % 10;
|
|
|
|
|
const B0 = B[idx0];
|
|
|
|
|
const B1 = B[idx0 + 1];
|
|
|
|
|
const Th = rotlH(B0, B1, 1) ^ B[idx1];
|
|
|
|
|
const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];
|
|
|
|
|
for (let y = 0; y < 50; y += 10) {
|
|
|
|
|
s[x + y] ^= Th;
|
|
|
|
|
s[x + y + 1] ^= Tl;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// Rho (ρ) and Pi (π)
|
|
|
|
|
let curH = s[2];
|
|
|
|
|
let curL = s[3];
|
|
|
|
|
for (let t = 0; t < 24; t++) {
|
|
|
|
|
const shift = SHA3_ROTL[t];
|
|
|
|
|
const Th = rotlH(curH, curL, shift);
|
|
|
|
|
const Tl = rotlL(curH, curL, shift);
|
|
|
|
|
const PI = SHA3_PI[t];
|
|
|
|
|
curH = s[PI];
|
|
|
|
|
curL = s[PI + 1];
|
|
|
|
|
s[PI] = Th;
|
|
|
|
|
s[PI + 1] = Tl;
|
|
|
|
|
}
|
|
|
|
|
// Chi (χ)
|
|
|
|
|
for (let y = 0; y < 50; y += 10) {
|
|
|
|
|
for (let x = 0; x < 10; x++)
|
|
|
|
|
B[x] = s[y + x];
|
|
|
|
|
for (let x = 0; x < 10; x++)
|
|
|
|
|
s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];
|
|
|
|
|
}
|
|
|
|
|
// Iota (ι)
|
|
|
|
|
s[0] ^= SHA3_IOTA_H[round];
|
|
|
|
|
s[1] ^= SHA3_IOTA_L[round];
|
|
|
|
|
}
|
|
|
|
|
B.fill(0);
|
|
|
|
|
}
|
|
|
|
|
class Keccak extends Hash {
|
|
|
|
|
// NOTE: we accept arguments in bytes instead of bits here.
|
|
|
|
|
constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {
|
|
|
|
|
super();
|
|
|
|
|
this.blockLen = blockLen;
|
|
|
|
|
this.suffix = suffix;
|
|
|
|
|
this.outputLen = outputLen;
|
|
|
|
|
this.enableXOF = enableXOF;
|
|
|
|
|
this.rounds = rounds;
|
|
|
|
|
this.pos = 0;
|
|
|
|
|
this.posOut = 0;
|
|
|
|
|
this.finished = false;
|
|
|
|
|
this.destroyed = false;
|
|
|
|
|
// Can be passed from user as dkLen
|
2023-10-10 03:27:56 +03:00
|
|
|
|
number(outputLen);
|
2022-09-16 05:58:45 +03:00
|
|
|
|
// 1600 = 5x5 matrix of 64bit. 1600 bits === 200 bytes
|
|
|
|
|
if (0 >= this.blockLen || this.blockLen >= 200)
|
|
|
|
|
throw new Error('Sha3 supports only keccak-f1600 function');
|
|
|
|
|
this.state = new Uint8Array(200);
|
|
|
|
|
this.state32 = u32(this.state);
|
|
|
|
|
}
|
|
|
|
|
keccak() {
|
|
|
|
|
keccakP(this.state32, this.rounds);
|
|
|
|
|
this.posOut = 0;
|
|
|
|
|
this.pos = 0;
|
|
|
|
|
}
|
|
|
|
|
update(data) {
|
2023-10-10 03:27:56 +03:00
|
|
|
|
exists(this);
|
2022-09-16 05:58:45 +03:00
|
|
|
|
const { blockLen, state } = this;
|
|
|
|
|
data = toBytes(data);
|
|
|
|
|
const len = data.length;
|
|
|
|
|
for (let pos = 0; pos < len;) {
|
|
|
|
|
const take = Math.min(blockLen - this.pos, len - pos);
|
|
|
|
|
for (let i = 0; i < take; i++)
|
|
|
|
|
state[this.pos++] ^= data[pos++];
|
|
|
|
|
if (this.pos === blockLen)
|
|
|
|
|
this.keccak();
|
|
|
|
|
}
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
finish() {
|
|
|
|
|
if (this.finished)
|
|
|
|
|
return;
|
|
|
|
|
this.finished = true;
|
|
|
|
|
const { state, suffix, pos, blockLen } = this;
|
|
|
|
|
// Do the padding
|
|
|
|
|
state[pos] ^= suffix;
|
|
|
|
|
if ((suffix & 0x80) !== 0 && pos === blockLen - 1)
|
|
|
|
|
this.keccak();
|
|
|
|
|
state[blockLen - 1] ^= 0x80;
|
|
|
|
|
this.keccak();
|
|
|
|
|
}
|
|
|
|
|
writeInto(out) {
|
2023-10-10 03:27:56 +03:00
|
|
|
|
exists(this, false);
|
|
|
|
|
bytes(out);
|
2022-09-16 05:58:45 +03:00
|
|
|
|
this.finish();
|
|
|
|
|
const bufferOut = this.state;
|
|
|
|
|
const { blockLen } = this;
|
|
|
|
|
for (let pos = 0, len = out.length; pos < len;) {
|
|
|
|
|
if (this.posOut >= blockLen)
|
|
|
|
|
this.keccak();
|
|
|
|
|
const take = Math.min(blockLen - this.posOut, len - pos);
|
|
|
|
|
out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);
|
|
|
|
|
this.posOut += take;
|
|
|
|
|
pos += take;
|
|
|
|
|
}
|
|
|
|
|
return out;
|
|
|
|
|
}
|
|
|
|
|
xofInto(out) {
|
|
|
|
|
// Sha3/Keccak usage with XOF is probably mistake, only SHAKE instances can do XOF
|
|
|
|
|
if (!this.enableXOF)
|
|
|
|
|
throw new Error('XOF is not possible for this instance');
|
|
|
|
|
return this.writeInto(out);
|
|
|
|
|
}
|
|
|
|
|
xof(bytes) {
|
2023-10-10 03:27:56 +03:00
|
|
|
|
number(bytes);
|
2022-09-16 05:58:45 +03:00
|
|
|
|
return this.xofInto(new Uint8Array(bytes));
|
|
|
|
|
}
|
|
|
|
|
digestInto(out) {
|
2023-10-10 03:27:56 +03:00
|
|
|
|
output(out, this);
|
2022-09-16 05:58:45 +03:00
|
|
|
|
if (this.finished)
|
|
|
|
|
throw new Error('digest() was already called');
|
|
|
|
|
this.writeInto(out);
|
|
|
|
|
this.destroy();
|
|
|
|
|
return out;
|
|
|
|
|
}
|
|
|
|
|
digest() {
|
|
|
|
|
return this.digestInto(new Uint8Array(this.outputLen));
|
|
|
|
|
}
|
|
|
|
|
destroy() {
|
|
|
|
|
this.destroyed = true;
|
|
|
|
|
this.state.fill(0);
|
|
|
|
|
}
|
|
|
|
|
_cloneInto(to) {
|
|
|
|
|
const { blockLen, suffix, outputLen, rounds, enableXOF } = this;
|
|
|
|
|
to || (to = new Keccak(blockLen, suffix, outputLen, enableXOF, rounds));
|
|
|
|
|
to.state32.set(this.state32);
|
|
|
|
|
to.pos = this.pos;
|
|
|
|
|
to.posOut = this.posOut;
|
|
|
|
|
to.finished = this.finished;
|
|
|
|
|
to.rounds = rounds;
|
|
|
|
|
// Suffix can change in cSHAKE
|
|
|
|
|
to.suffix = suffix;
|
|
|
|
|
to.outputLen = outputLen;
|
|
|
|
|
to.enableXOF = enableXOF;
|
|
|
|
|
to.destroyed = this.destroyed;
|
|
|
|
|
return to;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
const gen = (suffix, blockLen, outputLen) => wrapConstructor(() => new Keccak(blockLen, suffix, outputLen));
|
|
|
|
|
/**
|
|
|
|
|
* keccak-256 hash function. Different from SHA3-256.
|
|
|
|
|
* @param message - that would be hashed
|
|
|
|
|
*/
|
2023-10-10 03:27:56 +03:00
|
|
|
|
const keccak_256 = /* @__PURE__ */ gen(0x01, 136, 256 / 8);
|
2022-09-16 05:58:45 +03:00
|
|
|
|
|
2022-12-04 01:01:29 +03:00
|
|
|
|
/**
|
|
|
|
|
* Cryptographic hashing functions
|
|
|
|
|
*
|
|
|
|
|
* @_subsection: api/crypto:Hash Functions [about-crypto-hashing]
|
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
|
let locked = false;
|
|
|
|
|
const _keccak256 = function (data) {
|
|
|
|
|
return keccak_256(data);
|
|
|
|
|
};
|
|
|
|
|
let __keccak256 = _keccak256;
|
2022-12-04 01:01:29 +03:00
|
|
|
|
/**
|
|
|
|
|
* Compute the cryptographic KECCAK256 hash of %%data%%.
|
|
|
|
|
*
|
2022-12-10 09:31:42 +03:00
|
|
|
|
* The %%data%% **must** be a data representation, to compute the
|
|
|
|
|
* hash of UTF-8 data use the [[id]] function.
|
|
|
|
|
*
|
2022-12-04 01:01:29 +03:00
|
|
|
|
* @returns DataHexstring
|
2022-12-10 09:31:42 +03:00
|
|
|
|
* @example:
|
|
|
|
|
* keccak256("0x")
|
|
|
|
|
* //_result:
|
|
|
|
|
*
|
|
|
|
|
* keccak256("0x1337")
|
|
|
|
|
* //_result:
|
|
|
|
|
*
|
|
|
|
|
* keccak256(new Uint8Array([ 0x13, 0x37 ]))
|
|
|
|
|
* //_result:
|
|
|
|
|
*
|
2022-12-30 19:30:03 +03:00
|
|
|
|
* // Strings are assumed to be DataHexString, otherwise it will
|
|
|
|
|
* // throw. To hash UTF-8 data, see the note above.
|
|
|
|
|
* keccak256("Hello World")
|
|
|
|
|
* //_error:
|
2022-12-04 01:01:29 +03:00
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
|
function keccak256(_data) {
|
2022-09-16 05:58:45 +03:00
|
|
|
|
const data = getBytes(_data, "data");
|
2022-09-05 23:57:11 +03:00
|
|
|
|
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);
|
|
|
|
|
|
2022-12-10 09:31:42 +03:00
|
|
|
|
/**
|
|
|
|
|
* A simple hashing function which operates on UTF-8 strings to
|
2023-04-19 11:30:37 +03:00
|
|
|
|
* compute an 32-byte identifier.
|
2022-12-10 09:31:42 +03:00
|
|
|
|
*
|
|
|
|
|
* This simply computes the [UTF-8 bytes](toUtf8Bytes) and computes
|
|
|
|
|
* the [[keccak256]].
|
|
|
|
|
*
|
|
|
|
|
* @example:
|
|
|
|
|
* id("hello world")
|
|
|
|
|
* //_result:
|
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
|
function id(value) {
|
|
|
|
|
return keccak256(toUtf8Bytes(value));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const subsChrs = " !#$%&'()*+,-./<=>?@[]^_`{|}~";
|
|
|
|
|
const Word = /^[a-z]*$/i;
|
|
|
|
|
function unfold(words, sep) {
|
|
|
|
|
let initial = 97;
|
|
|
|
|
return words.reduce((accum, word) => {
|
|
|
|
|
if (word === sep) {
|
|
|
|
|
initial++;
|
|
|
|
|
}
|
|
|
|
|
else if (word.match(Word)) {
|
|
|
|
|
accum.push(String.fromCharCode(initial) + word);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
initial = 97;
|
|
|
|
|
accum.push(word);
|
|
|
|
|
}
|
|
|
|
|
return accum;
|
|
|
|
|
}, []);
|
|
|
|
|
}
|
2022-12-04 01:01:29 +03:00
|
|
|
|
/**
|
|
|
|
|
* @_ignore
|
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
|
function decode(data, subs) {
|
|
|
|
|
// Replace all the substitutions with their expanded form
|
|
|
|
|
for (let i = subsChrs.length - 1; i >= 0; i--) {
|
|
|
|
|
data = data.split(subsChrs[i]).join(subs.substring(2 * i, 2 * i + 2));
|
|
|
|
|
}
|
|
|
|
|
// Get all tle clumps; each suffix, first-increment and second-increment
|
|
|
|
|
const clumps = [];
|
|
|
|
|
const leftover = data.replace(/(:|([0-9])|([A-Z][a-z]*))/g, (all, item, semi, word) => {
|
|
|
|
|
if (semi) {
|
|
|
|
|
for (let i = parseInt(semi); i >= 0; i--) {
|
|
|
|
|
clumps.push(";");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
clumps.push(item.toLowerCase());
|
|
|
|
|
}
|
|
|
|
|
return "";
|
|
|
|
|
});
|
|
|
|
|
/* c8 ignore start */
|
|
|
|
|
if (leftover) {
|
|
|
|
|
throw new Error(`leftovers: ${JSON.stringify(leftover)}`);
|
|
|
|
|
}
|
|
|
|
|
/* c8 ignore stop */
|
|
|
|
|
return unfold(unfold(clumps, ";"), ":");
|
|
|
|
|
}
|
2022-12-04 01:01:29 +03:00
|
|
|
|
/**
|
|
|
|
|
* @_ignore
|
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
|
function decodeOwl(data) {
|
|
|
|
|
assertArgument(data[0] === "0", "unsupported auwl data", "data", data);
|
|
|
|
|
return decode(data.substring(1 + 2 * subsChrs.length), data.substring(1, 1 + 2 * subsChrs.length));
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-04 01:01:29 +03:00
|
|
|
|
/**
|
|
|
|
|
* A Wordlist represents a collection of language-specific
|
2023-02-13 06:14:26 +03:00
|
|
|
|
* words used to encode and devoce [[link-bip-39]] encoded data
|
2022-12-04 01:01:29 +03:00
|
|
|
|
* by mapping words to 11-bit values and vice versa.
|
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
|
class Wordlist {
|
|
|
|
|
locale;
|
2022-12-04 01:01:29 +03:00
|
|
|
|
/**
|
|
|
|
|
* Creates a new Wordlist instance.
|
|
|
|
|
*
|
|
|
|
|
* Sub-classes MUST call this if they provide their own constructor,
|
|
|
|
|
* passing in the locale string of the language.
|
|
|
|
|
*
|
|
|
|
|
* Generally there is no need to create instances of a Wordlist,
|
|
|
|
|
* since each language-specific Wordlist creates an instance and
|
|
|
|
|
* there is no state kept internally, so they are safe to share.
|
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
|
constructor(locale) {
|
|
|
|
|
defineProperties(this, { locale });
|
|
|
|
|
}
|
2022-12-04 01:01:29 +03:00
|
|
|
|
/**
|
|
|
|
|
* Sub-classes may override this to provide a language-specific
|
|
|
|
|
* method for spliting %%phrase%% into individual words.
|
|
|
|
|
*
|
|
|
|
|
* By default, %%phrase%% is split using any sequences of
|
|
|
|
|
* white-space as defined by regular expressions (i.e. ``/\s+/``).
|
|
|
|
|
*/
|
|
|
|
|
split(phrase) {
|
|
|
|
|
return phrase.toLowerCase().split(/\s+/g);
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* Sub-classes may override this to provider a language-specific
|
|
|
|
|
* method for joining %%words%% into a phrase.
|
|
|
|
|
*
|
|
|
|
|
* By default, %%words%% are joined by a single space.
|
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
|
join(words) {
|
|
|
|
|
return words.join(" ");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Use the encode-latin.js script to create the necessary
|
2023-05-19 00:26:59 +03:00
|
|
|
|
// data files to be consumed by this class
|
2022-12-04 01:01:29 +03:00
|
|
|
|
/**
|
|
|
|
|
* An OWL format Wordlist is an encoding method that exploits
|
|
|
|
|
* the general locality of alphabetically sorted words to
|
|
|
|
|
* achieve a simple but effective means of compression.
|
|
|
|
|
*
|
|
|
|
|
* This class is generally not useful to most developers as
|
|
|
|
|
* it is used mainly internally to keep Wordlists for languages
|
|
|
|
|
* based on ASCII-7 small.
|
|
|
|
|
*
|
|
|
|
|
* If necessary, there are tools within the ``generation/`` folder
|
2023-06-02 00:52:58 +03:00
|
|
|
|
* to create the necessary data.
|
2022-12-04 01:01:29 +03:00
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
|
class WordlistOwl extends Wordlist {
|
|
|
|
|
#data;
|
|
|
|
|
#checksum;
|
2022-12-04 01:01:29 +03:00
|
|
|
|
/**
|
|
|
|
|
* Creates a new Wordlist for %%locale%% using the OWL %%data%%
|
|
|
|
|
* and validated against the %%checksum%%.
|
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
|
constructor(locale, data, checksum) {
|
|
|
|
|
super(locale);
|
|
|
|
|
this.#data = data;
|
|
|
|
|
this.#checksum = checksum;
|
|
|
|
|
this.#words = null;
|
|
|
|
|
}
|
2023-06-02 00:52:58 +03:00
|
|
|
|
/**
|
|
|
|
|
* The OWL-encoded data.
|
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
|
get _data() { return this.#data; }
|
2023-06-02 00:52:58 +03:00
|
|
|
|
/**
|
|
|
|
|
* Decode all the words for the wordlist.
|
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
|
_decodeWords() {
|
|
|
|
|
return decodeOwl(this.#data);
|
|
|
|
|
}
|
|
|
|
|
#words;
|
|
|
|
|
#loadWords() {
|
|
|
|
|
if (this.#words == null) {
|
|
|
|
|
const words = this._decodeWords();
|
|
|
|
|
// Verify the computed list matches the official list
|
|
|
|
|
const checksum = id(words.join("\n") + "\n");
|
|
|
|
|
/* c8 ignore start */
|
|
|
|
|
if (checksum !== this.#checksum) {
|
|
|
|
|
throw new Error(`BIP39 Wordlist for ${this.locale} FAILED`);
|
|
|
|
|
}
|
|
|
|
|
/* c8 ignore stop */
|
|
|
|
|
this.#words = words;
|
|
|
|
|
}
|
|
|
|
|
return this.#words;
|
|
|
|
|
}
|
|
|
|
|
getWord(index) {
|
|
|
|
|
const words = this.#loadWords();
|
2022-11-10 06:45:17 +03:00
|
|
|
|
assertArgument(index >= 0 && index < words.length, `invalid word index: ${index}`, "index", index);
|
2022-09-05 23:57:11 +03:00
|
|
|
|
return words[index];
|
|
|
|
|
}
|
|
|
|
|
getWordIndex(word) {
|
|
|
|
|
return this.#loadWords().indexOf(word);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const words$4 = "0itatkastcenaovo$taouleraeki&chor*teci%enbalodaeladet'!Chn=0Di#%E%^1Resa2Rese3CeT'#0EjKohol0Pu)%0A&sDul#Ekdo)Ke)Ti#Ul|3}aOgan%0FaltI$@tPi,%TmaTronom0LasL{i#Ol0Tobus4Yl:B#}<CilCul#D!_Ge)GrHnoKterieLa^L{#LkonLon-LvanLzaMbusNkom!R[rR{RmanRokoRvaTer#TohVl&Zal#Zili#Zu#3D&RanSe^StieTonZin#ZmocZ)k3CyklD]Ft-KinyLan%Og,fO]gTvaZon2AhobytAt*/E/aEdu+EskIk!Iz&Ok|Oud Ud2B-BrDl.D~H!(JkotJ|K<ysLe$R>R'?TaUb_U/!U^U+Ur!Xer2A^v#Ambo,An#AtrEp)Ike)KoLohOnzOskevUn{#Usin#Z^Zy2Bl.Bn|})D _D#D'aF{Jar(Kv?LdokLvaN^NkrRzaTikVolZola3D+tL.T'#0Ukot:PartRev&3DrDu+J/JnLaLerLkemLn?N.Nn(N'#NtrumNz<StopisT#2AlupaAp`]Ar aA)E/t!EmieI/otIrurgL`Le[Lub M_Mu,ObotO/olOd[O+,Om=Op Oro[OvRapotRl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V<1A~ArEsLivn O%1Id1Do[:}!_Ci@tD*/H<-KtLan^L>LivoLu[Mf+tMls-N@#Ni#N&N|N$voNtof+Pri#Rke)RodieR
|
|
|
|
|
const checksum$4 = "0x25f44555f4af25b51a711136e1c7d6e50ce9f8917d39d6b1f076b2bb4d2fac1a";
|
2022-12-04 01:01:29 +03:00
|
|
|
|
let wordlist$6 = null;
|
|
|
|
|
/**
|
|
|
|
|
* The [[link-bip39-cz]] for [mnemonic phrases](link-bip-39).
|
|
|
|
|
*
|
|
|
|
|
* @_docloc: api/wordlists
|
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
|
class LangCz extends WordlistOwl {
|
2022-12-04 01:01:29 +03:00
|
|
|
|
/**
|
|
|
|
|
* Creates a new instance of the Czech language Wordlist.
|
|
|
|
|
*
|
|
|
|
|
* Using the constructor should be unnecessary, instead use the
|
|
|
|
|
* [[wordlist]] singleton method.
|
2022-12-30 19:30:03 +03:00
|
|
|
|
*
|
|
|
|
|
* @_ignore:
|
2022-12-04 01:01:29 +03:00
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
|
constructor() { super("cz", words$4, checksum$4); }
|
2022-12-04 01:01:29 +03:00
|
|
|
|
/**
|
|
|
|
|
* Returns a singleton instance of a ``LangCz``, creating it
|
|
|
|
|
* if this is the first time being called.
|
|
|
|
|
*/
|
|
|
|
|
static wordlist() {
|
|
|
|
|
if (wordlist$6 == null) {
|
|
|
|
|
wordlist$6 = new LangCz();
|
|
|
|
|
}
|
|
|
|
|
return wordlist$6;
|
|
|
|
|
}
|
2022-09-05 23:57:11 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const Base64 = ")!@#$%^&*(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_";
|
2022-12-04 01:01:29 +03:00
|
|
|
|
/**
|
|
|
|
|
* @_ignore
|
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
|
function decodeBits(width, data) {
|
|
|
|
|
const maxValue = (1 << width) - 1;
|
|
|
|
|
const result = [];
|
|
|
|
|
let accum = 0, bits = 0, flood = 0;
|
|
|
|
|
for (let i = 0; i < data.length; i++) {
|
|
|
|
|
// Accumulate 6 bits of data
|
|
|
|
|
accum = ((accum << 6) | Base64.indexOf(data[i]));
|
|
|
|
|
bits += 6;
|
|
|
|
|
// While we have enough for a word...
|
|
|
|
|
while (bits >= width) {
|
|
|
|
|
// ...read the word
|
|
|
|
|
const value = (accum >> (bits - width));
|
|
|
|
|
accum &= (1 << (bits - width)) - 1;
|
|
|
|
|
bits -= width;
|
|
|
|
|
// A value of 0 indicates we exceeded maxValue, it
|
|
|
|
|
// floods over into the next value
|
|
|
|
|
if (value === 0) {
|
|
|
|
|
flood += maxValue;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
result.push(value + flood);
|
|
|
|
|
flood = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-04 01:01:29 +03:00
|
|
|
|
/**
|
|
|
|
|
* @_ignore
|
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
|
function decodeOwlA(data, accents) {
|
|
|
|
|
let words = decodeOwl(data).join(",");
|
|
|
|
|
// Inject the accents
|
|
|
|
|
accents.split(/,/g).forEach((accent) => {
|
|
|
|
|
const match = accent.match(/^([a-z]*)([0-9]+)([0-9])(.*)$/);
|
|
|
|
|
assertArgument(match !== null, "internal error parsing accents", "accents", accents);
|
|
|
|
|
let posOffset = 0;
|
|
|
|
|
const positions = decodeBits(parseInt(match[3]), match[4]);
|
|
|
|
|
const charCode = parseInt(match[2]);
|
|
|
|
|
const regex = new RegExp(`([${match[1]}])`, "g");
|
|
|
|
|
words = words.replace(regex, (all, letter) => {
|
|
|
|
|
const rem = --positions[posOffset];
|
|
|
|
|
if (rem === 0) {
|
|
|
|
|
letter = String.fromCharCode(letter.charCodeAt(0), charCode);
|
|
|
|
|
posOffset++;
|
|
|
|
|
}
|
|
|
|
|
return letter;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
return words.split(",");
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-04 01:01:29 +03:00
|
|
|
|
/**
|
|
|
|
|
* An OWL-A format Wordlist extends the OWL format to add an
|
|
|
|
|
* overlay onto an OWL format Wordlist to support diacritic
|
|
|
|
|
* marks.
|
|
|
|
|
*
|
|
|
|
|
* This class is generally not useful to most developers as
|
|
|
|
|
* it is used mainly internally to keep Wordlists for languages
|
|
|
|
|
* based on latin-1 small.
|
|
|
|
|
*
|
|
|
|
|
* If necessary, there are tools within the ``generation/`` folder
|
2023-06-02 00:52:58 +03:00
|
|
|
|
* to create the necessary data.
|
2022-12-04 01:01:29 +03:00
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
|
class WordlistOwlA extends WordlistOwl {
|
|
|
|
|
#accent;
|
2023-06-02 00:52:58 +03:00
|
|
|
|
/**
|
|
|
|
|
* Creates a new Wordlist for %%locale%% using the OWLA %%data%%
|
|
|
|
|
* and %%accent%% data and validated against the %%checksum%%.
|
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
|
constructor(locale, data, accent, checksum) {
|
|
|
|
|
super(locale, data, checksum);
|
|
|
|
|
this.#accent = accent;
|
|
|
|
|
}
|
2023-06-02 00:52:58 +03:00
|
|
|
|
/**
|
|
|
|
|
* The OWLA-encoded accent data.
|
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
|
get _accent() { return this.#accent; }
|
2023-06-02 00:52:58 +03:00
|
|
|
|
/**
|
|
|
|
|
* Decode all the words for the wordlist.
|
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
|
_decodeWords() {
|
|
|
|
|
return decodeOwlA(this._data, this._accent);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const words$3 = "0arertoiotadonoaRte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T^LWAZuVWB^W)eTL^x&$WGHW(nKWEMA)#$F$x$Waekqs,n7715)W*HM-$WAcCiu(a))VCZ)GG%(*CWWdW%$D!UCO$M";
|
|
|
|
|
const checksum$3 = "0xf74fb7092aeacdfbf8959557de22098da512207fb9f109cb526994938cf40300";
|
2022-12-04 01:01:29 +03:00
|
|
|
|
let wordlist$5 = null;
|
|
|
|
|
/**
|
|
|
|
|
* The [[link-bip39-es]] for [mnemonic phrases](link-bip-39).
|
|
|
|
|
*
|
|
|
|
|
* @_docloc: api/wordlists
|
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
|
class LangEs extends WordlistOwlA {
|
2022-12-04 01:01:29 +03:00
|
|
|
|
/**
|
|
|
|
|
* Creates a new instance of the Spanish language Wordlist.
|
|
|
|
|
*
|
|
|
|
|
* This should be unnecessary most of the time as the exported
|
|
|
|
|
* [[langEs]] should suffice.
|
2022-12-30 19:30:03 +03:00
|
|
|
|
*
|
|
|
|
|
* @_ignore:
|
2022-12-04 01:01:29 +03:00
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
|
constructor() { super("es", words$3, accents$1, checksum$3); }
|
2022-12-04 01:01:29 +03:00
|
|
|
|
/**
|
|
|
|
|
* Returns a singleton instance of a ``LangEs``, creating it
|
|
|
|
|
* if this is the first time being called.
|
|
|
|
|
*/
|
|
|
|
|
static wordlist() {
|
|
|
|
|
if (wordlist$5 == null) {
|
|
|
|
|
wordlist$5 = new LangEs();
|
|
|
|
|
}
|
|
|
|
|
return wordlist$5;
|
|
|
|
|
}
|
2022-09-05 23:57:11 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const words$2 = "0erreleontiteurinueiriet cegeanseali medenel q)eniluxaus ch0Ais}And$Diqu E`#Ol*Ord Ou%rOy RasifReuv Ri,Rog RuptS_-SoluS'@UsifYss=0A@m+AjouAr+nCab]Cep,Clam Cola@Cro~eCu}ErbeHatHe,Idu]I Omp&Qu *R$y?Te'TifT)l0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`#Udr$Uff!UlotUp`#Urm/dUt&2Ad)lAffi%A(eAndApp(AtuitAv*EnatIffu!Il]Imp Ogn Ond Ot&OupeUg U% Uy e2EpardErr>I@Im|veIta!Sta%f3Mnas&Rostat:Bitu@Cho*L&Me|NgarN[t$RicotRm$+Rp$Sard3LiumMato?RbeRiss$Rm(eR$Si,U!{3B n BouLar/tStoi!V 5MardMma.Mo.[N['Nor N&{R@Riz$Rlo.Rm$eRrib#U#{Us<5BlotI#{Ma(Mb#Mi@Mo'R]3Dro?lG+[M[Pno<:2Yl#2Nor U/e4Lici&Lusi$0A.Bib I,M_<Mobi#Muab#PactP i=Plor Po}Prim Pu,0Carn C_d+Ci@ntCl( Colo!Dex Di-Duc%fEditEp%eExactF(iFlig Form Fusi$G H= Hib Jec,Ju!No-ntOcu]Ond Scri!Sec&Sig[Soli&Sp* S%nctSul,TactT_<Ti?Trig)Tui%fU%#Vasi$V_,Vi,Voqu 3Oni^Rad>ReelRi,0O]2Oi!Res<:Gu
|
|
|
|
|
const accents = "e7693&)U*o&)Ry^)*)W))))#X^))))@@)#Wf)m%)#!))AG)&IIAQIIIBIIHJNAgBIILIDJGo)))HIQIIIIA(IGgJHH(BIIxX#)Ou)@*IAAPIIIJHQJ)&QIQPYI(HYAQC%)!))QHJJ@)#)^f*^AXCJ))$%CP))%&m)u)@e^A#G#))W@!(IKK%!(I%))O@QA))@GG#e))))WHJIWh))my@IIBT^)!)HAYGETHI*))!QnUDG)))nBoKAC*HwyQh))$&)G&)UGO)G)))(BX#v**)%O,e7686)I))@)&)gdMP()))ud)p#L))I^FIHYdWG))D@DFV)QA)o%MyTh%*)Z)%)n(XANc^R)YS";
|
|
|
|
|
const checksum$2 = "0x51deb7ae009149dc61a6bd18a918eb7ac78d2775726c68e598b92d002519b045";
|
2022-12-04 01:01:29 +03:00
|
|
|
|
let wordlist$4 = null;
|
|
|
|
|
/**
|
|
|
|
|
* The [[link-bip39-fr]] for [mnemonic phrases](link-bip-39).
|
|
|
|
|
*
|
|
|
|
|
* @_docloc: api/wordlists
|
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
|
class LangFr extends WordlistOwlA {
|
2022-12-04 01:01:29 +03:00
|
|
|
|
/**
|
|
|
|
|
* Creates a new instance of the French language Wordlist.
|
|
|
|
|
*
|
|
|
|
|
* This should be unnecessary most of the time as the exported
|
|
|
|
|
* [[langFr]] should suffice.
|
2022-12-30 19:30:03 +03:00
|
|
|
|
*
|
|
|
|
|
* @_ignore:
|
2022-12-04 01:01:29 +03:00
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
|
constructor() { super("fr", words$2, accents, checksum$2); }
|
2022-12-04 01:01:29 +03:00
|
|
|
|
/**
|
|
|
|
|
* Returns a singleton instance of a ``LangFr``, creating it
|
|
|
|
|
* if this is the first time being called.
|
|
|
|
|
*/
|
|
|
|
|
static wordlist() {
|
|
|
|
|
if (wordlist$4 == null) {
|
|
|
|
|
wordlist$4 = new LangFr();
|
|
|
|
|
}
|
|
|
|
|
return wordlist$4;
|
|
|
|
|
}
|
2022-09-05 23:57:11 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const data$2 = [
|
|
|
|
|
// 4-kana words
|
|
|
|
|
"AQRASRAGBAGUAIRAHBAghAURAdBAdcAnoAMEAFBAFCBKFBQRBSFBCXBCDBCHBGFBEQBpBBpQBIkBHNBeOBgFBVCBhBBhNBmOBmRBiHBiFBUFBZDBvFBsXBkFBlcBjYBwDBMBBTBBTRBWBBWXXaQXaRXQWXSRXCFXYBXpHXOQXHRXhRXuRXmXXbRXlXXwDXTRXrCXWQXWGaBWaKcaYgasFadQalmaMBacAKaRKKBKKXKKjKQRKDRKCYKCRKIDKeVKHcKlXKjHKrYNAHNBWNaRNKcNIBNIONmXNsXNdXNnBNMBNRBNrXNWDNWMNFOQABQAHQBrQXBQXFQaRQKXQKDQKOQKFQNBQNDQQgQCXQCDQGBQGDQGdQYXQpBQpQQpHQLXQHuQgBQhBQhC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gGQJqXgdQYJEgFMFNBgJFcqDVJwXUJVJFZJchIgJCCxOEJqXxOwXUJyDJBVRuscisciJBiJBieUtqXiJFDJkiFsJXQUGEZJcUJFsJXZtXIrXZDZJDrZJFNJDZJFstXvJFQqXvJFCJEsJXQJqkhkNGBbDJdTRbYJMEBlDwXUJMEFiJFcfXNJDRcNJWMTBLJXC",
|
|
|
|
|
// 8-kana words
|
|
|
|
|
"BraFUtHBFSJFdbNBLJXVJQoYJNEBSJBEJfHSJHwXUJCJdAZJMGjaFVJXEJPNJBlEJfFiJFpFbFEJqIJBVJCrIBdHiJhOPFChvJVJZJNJWxGFNIFLueIBQJqUHEJfUFstOZJDrlXEASJRlXVJXSFwVJNJWD",
|
|
|
|
|
// 9-kana words
|
|
|
|
|
"QJEJNNJDQJEJIBSFQJEJxegBQJEJfHEPSJBmXEJFSJCDEJqXLXNJFQqXIcQsFNJFIFEJqXUJgFsJXIJBUJEJfHNFvJxEqXNJnXUJFQqD",
|
|
|
|
|
// 10-kana words
|
|
|
|
|
"IJBEJqXZJ"
|
|
|
|
|
];
|
|
|
|
|
// Maps each character into its kana value (the index)
|
|
|
|
|
const mapping = "~~AzB~X~a~KN~Q~D~S~C~G~E~Y~p~L~I~O~eH~g~V~hxyumi~~U~~Z~~v~~s~~dkoblPjfnqwMcRTr~W~~~F~~~~~Jt";
|
|
|
|
|
let _wordlist$2 = null;
|
|
|
|
|
function hex(word) {
|
|
|
|
|
return hexlify(toUtf8Bytes(word));
|
|
|
|
|
}
|
|
|
|
|
const KiYoKu = "0xe3818de38284e3818f";
|
|
|
|
|
const KyoKu = "0xe3818de38283e3818f";
|
|
|
|
|
function toString(data) {
|
|
|
|
|
return toUtf8String(new Uint8Array(data));
|
|
|
|
|
}
|
|
|
|
|
function loadWords$2() {
|
|
|
|
|
if (_wordlist$2 !== null) {
|
|
|
|
|
return _wordlist$2;
|
|
|
|
|
}
|
|
|
|
|
const wordlist = [];
|
|
|
|
|
// Transforms for normalizing (sort is a not quite UTF-8)
|
|
|
|
|
const transform = {};
|
|
|
|
|
// Delete the diacritic marks
|
|
|
|
|
transform[toString([227, 130, 154])] = false;
|
|
|
|
|
transform[toString([227, 130, 153])] = false;
|
|
|
|
|
// Some simple transforms that sort out most of the order
|
|
|
|
|
transform[toString([227, 130, 133])] = toString([227, 130, 134]);
|
|
|
|
|
transform[toString([227, 129, 163])] = toString([227, 129, 164]);
|
|
|
|
|
transform[toString([227, 130, 131])] = toString([227, 130, 132]);
|
|
|
|
|
transform[toString([227, 130, 135])] = toString([227, 130, 136]);
|
|
|
|
|
// Normalize words using the transform
|
|
|
|
|
function normalize(word) {
|
|
|
|
|
let result = "";
|
|
|
|
|
for (let i = 0; i < word.length; i++) {
|
|
|
|
|
let kana = word[i];
|
|
|
|
|
const target = transform[kana];
|
|
|
|
|
if (target === false) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (target) {
|
|
|
|
|
kana = target;
|
|
|
|
|
}
|
|
|
|
|
result += kana;
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
// Sort how the Japanese list is sorted
|
|
|
|
|
function sortJapanese(a, b) {
|
|
|
|
|
a = normalize(a);
|
|
|
|
|
b = normalize(b);
|
|
|
|
|
if (a < b) {
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
if (a > b) {
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
// Load all the words
|
|
|
|
|
for (let length = 3; length <= 9; length++) {
|
|
|
|
|
const d = data$2[length - 3];
|
|
|
|
|
for (let offset = 0; offset < d.length; offset += length) {
|
|
|
|
|
const word = [];
|
|
|
|
|
for (let i = 0; i < length; i++) {
|
|
|
|
|
const k = mapping.indexOf(d[offset + i]);
|
|
|
|
|
word.push(227);
|
|
|
|
|
word.push((k & 0x40) ? 130 : 129);
|
|
|
|
|
word.push((k & 0x3f) + 128);
|
|
|
|
|
}
|
|
|
|
|
wordlist.push(toString(word));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
wordlist.sort(sortJapanese);
|
|
|
|
|
// For some reason kyoku and kiyoku are flipped in node (!!).
|
|
|
|
|
// The order SHOULD be:
|
|
|
|
|
// - kyoku
|
|
|
|
|
// - kiyoku
|
|
|
|
|
// This should ignore "if", but that doesn't work here??
|
|
|
|
|
/* c8 ignore start */
|
|
|
|
|
if (hex(wordlist[442]) === KiYoKu && hex(wordlist[443]) === KyoKu) {
|
|
|
|
|
const tmp = wordlist[442];
|
|
|
|
|
wordlist[442] = wordlist[443];
|
|
|
|
|
wordlist[443] = tmp;
|
|
|
|
|
}
|
|
|
|
|
/* c8 ignore stop */
|
|
|
|
|
// Verify the computed list matches the official list
|
|
|
|
|
/* istanbul ignore if */
|
|
|
|
|
const checksum = id(wordlist.join("\n") + "\n");
|
|
|
|
|
/* c8 ignore start */
|
|
|
|
|
if (checksum !== "0xcb36b09e6baa935787fd762ce65e80b0c6a8dabdfbc3a7f86ac0e2c4fd111600") {
|
|
|
|
|
throw new Error("BIP39 Wordlist for ja (Japanese) FAILED");
|
|
|
|
|
}
|
|
|
|
|
/* c8 ignore stop */
|
|
|
|
|
_wordlist$2 = wordlist;
|
|
|
|
|
return wordlist;
|
|
|
|
|
}
|
2022-12-04 01:01:29 +03:00
|
|
|
|
let wordlist$3 = null;
|
|
|
|
|
/**
|
|
|
|
|
* The [[link-bip39-ja]] for [mnemonic phrases](link-bip-39).
|
|
|
|
|
*
|
|
|
|
|
* @_docloc: api/wordlists
|
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
|
class LangJa extends Wordlist {
|
2022-12-04 01:01:29 +03:00
|
|
|
|
/**
|
|
|
|
|
* Creates a new instance of the Japanese language Wordlist.
|
|
|
|
|
*
|
|
|
|
|
* This should be unnecessary most of the time as the exported
|
|
|
|
|
* [[langJa]] should suffice.
|
2022-12-30 19:30:03 +03:00
|
|
|
|
*
|
|
|
|
|
* @_ignore:
|
2022-12-04 01:01:29 +03:00
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
|
constructor() { super("ja"); }
|
|
|
|
|
getWord(index) {
|
|
|
|
|
const words = loadWords$2();
|
2022-11-10 06:45:17 +03:00
|
|
|
|
assertArgument(index >= 0 && index < words.length, `invalid word index: ${index}`, "index", index);
|
2022-09-05 23:57:11 +03:00
|
|
|
|
return words[index];
|
|
|
|
|
}
|
|
|
|
|
getWordIndex(word) {
|
|
|
|
|
return loadWords$2().indexOf(word);
|
|
|
|
|
}
|
2022-12-04 01:01:29 +03:00
|
|
|
|
split(phrase) {
|
2022-09-05 23:57:11 +03:00
|
|
|
|
//logger.assertNormalize();
|
2022-12-04 01:01:29 +03:00
|
|
|
|
return phrase.split(/(?:\u3000| )+/g);
|
2022-09-05 23:57:11 +03:00
|
|
|
|
}
|
|
|
|
|
join(words) {
|
|
|
|
|
return words.join("\u3000");
|
|
|
|
|
}
|
2022-12-04 01:01:29 +03:00
|
|
|
|
/**
|
|
|
|
|
* Returns a singleton instance of a ``LangJa``, creating it
|
|
|
|
|
* if this is the first time being called.
|
|
|
|
|
*/
|
|
|
|
|
static wordlist() {
|
|
|
|
|
if (wordlist$3 == null) {
|
|
|
|
|
wordlist$3 = new LangJa();
|
|
|
|
|
}
|
|
|
|
|
return wordlist$3;
|
|
|
|
|
}
|
2022-09-05 23:57:11 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const data$1 = [
|
|
|
|
|
"OYAa",
|
|
|
|
|
"ATAZoATBl3ATCTrATCl8ATDloATGg3ATHT8ATJT8ATJl3ATLlvATLn4ATMT8ATMX8ATMboATMgoAToLbAToMTATrHgATvHnAT3AnAT3JbAT3MTAT8DbAT8JTAT8LmAT8MYAT8MbAT#LnAUHT8AUHZvAUJXrAUJX8AULnrAXJnvAXLUoAXLgvAXMn6AXRg3AXrMbAX3JTAX3QbAYLn3AZLgvAZrSUAZvAcAZ8AaAZ8AbAZ8AnAZ8Hn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ScvJnvMnvMXoLTCTLgrJXLTJlRTvQlLbRnJlQYvLbrMb8LnvLbvFn3RnoLdCVSTGZrLeSTvGXCnLg3MnoLn3MToLlrETvMT8SToAl3MbrDU6GTvMb8LX4LhrPlrLXGXCnSToLf8Rg3STrDb8LTrSTvLTHXMnSb3RYLnMnSgOg6ATFg",
|
|
|
|
|
"HUDlGnrQXrJTrHgLnrAcJYMb8DULc8LTvFgGnCk3Mg8JbAnLX4QYvFYHnMXrRUoJnGnvFnRlvFTJlQnoSTrBXHXrLYSUJgLfoMT8Se8DTrHbDb",
|
|
|
|
|
"AbDl8SToJU8An3RbAb8ST8DUSTrGnrAgoLbFU6Db8LTrMg8AaHT8Jb8ObDl8SToJU8Pb3RlvFYoJl"
|
|
|
|
|
];
|
|
|
|
|
const codes$1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*";
|
|
|
|
|
function getHangul(code) {
|
|
|
|
|
if (code >= 40) {
|
|
|
|
|
code = code + 168 - 40;
|
|
|
|
|
}
|
|
|
|
|
else if (code >= 19) {
|
|
|
|
|
code = code + 97 - 19;
|
|
|
|
|
}
|
|
|
|
|
return toUtf8String(new Uint8Array([225, (code >> 6) + 132, (code & 0x3f) + 128]));
|
|
|
|
|
}
|
|
|
|
|
let _wordlist$1 = null;
|
|
|
|
|
function loadWords$1() {
|
|
|
|
|
if (_wordlist$1 != null) {
|
|
|
|
|
return _wordlist$1;
|
|
|
|
|
}
|
|
|
|
|
const wordlist = [];
|
|
|
|
|
data$1.forEach((data, length) => {
|
|
|
|
|
length += 4;
|
|
|
|
|
for (let i = 0; i < data.length; i += length) {
|
|
|
|
|
let word = "";
|
|
|
|
|
for (let j = 0; j < length; j++) {
|
|
|
|
|
word += getHangul(codes$1.indexOf(data[i + j]));
|
|
|
|
|
}
|
|
|
|
|
wordlist.push(word);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
wordlist.sort();
|
|
|
|
|
// Verify the computed list matches the official list
|
|
|
|
|
/* istanbul ignore if */
|
|
|
|
|
const checksum = id(wordlist.join("\n") + "\n");
|
|
|
|
|
/* c8 ignore start */
|
|
|
|
|
if (checksum !== "0xf9eddeace9c5d3da9c93cf7d3cd38f6a13ed3affb933259ae865714e8a3ae71a") {
|
|
|
|
|
throw new Error("BIP39 Wordlist for ko (Korean) FAILED");
|
|
|
|
|
}
|
|
|
|
|
/* c8 ignore stop */
|
|
|
|
|
_wordlist$1 = wordlist;
|
|
|
|
|
return wordlist;
|
|
|
|
|
}
|
2022-12-04 01:01:29 +03:00
|
|
|
|
let wordlist$2 = null;
|
|
|
|
|
/**
|
|
|
|
|
* The [[link-bip39-ko]] for [mnemonic phrases](link-bip-39).
|
|
|
|
|
*
|
|
|
|
|
* @_docloc: api/wordlists
|
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
|
class LangKo extends Wordlist {
|
2022-12-04 01:01:29 +03:00
|
|
|
|
/**
|
|
|
|
|
* Creates a new instance of the Korean language Wordlist.
|
|
|
|
|
*
|
|
|
|
|
* This should be unnecessary most of the time as the exported
|
|
|
|
|
* [[langKo]] should suffice.
|
2022-12-30 19:30:03 +03:00
|
|
|
|
*
|
|
|
|
|
* @_ignore:
|
2022-12-04 01:01:29 +03:00
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
|
constructor() {
|
|
|
|
|
super("ko");
|
|
|
|
|
}
|
|
|
|
|
getWord(index) {
|
|
|
|
|
const words = loadWords$1();
|
2022-11-10 06:45:17 +03:00
|
|
|
|
assertArgument(index >= 0 && index < words.length, `invalid word index: ${index}`, "index", index);
|
2022-09-05 23:57:11 +03:00
|
|
|
|
return words[index];
|
|
|
|
|
}
|
|
|
|
|
getWordIndex(word) {
|
|
|
|
|
return loadWords$1().indexOf(word);
|
|
|
|
|
}
|
2022-12-04 01:01:29 +03:00
|
|
|
|
/**
|
|
|
|
|
* Returns a singleton instance of a ``LangKo``, creating it
|
|
|
|
|
* if this is the first time being called.
|
|
|
|
|
*/
|
|
|
|
|
static wordlist() {
|
|
|
|
|
if (wordlist$2 == null) {
|
|
|
|
|
wordlist$2 = new LangKo();
|
|
|
|
|
}
|
|
|
|
|
return wordlist$2;
|
|
|
|
|
}
|
2022-09-05 23:57:11 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const words$1 = "0torea noica!iosorolotaleratelanena%oiadoencotivomai t ca%a0A]Bagl'Bin#E.Is(Oli!Rasi_Rog#0Cade!C[$Cus#E <Hil,I@QuaReRil>Roba+U 0Ag'Deb{DomeEgu#Eri!IpeOtt&Ul&1Fabi,Fe|Fis(F-n Oris`O(R~$0AveEn.E_,Ganc'I!It&OnismoR>*Rume Uzzo4AbardaA Bat)Ber#BoBumeCeCol>E|<FaGeb-Ian.IbiIm[ Lag#Leg)Lie_Lo@/Lusi_Me$Oge$Pa}Pest!Ta,=Ter$T%c'T)veUn$Veo*Z&0Alga`Ani+A!=B{Br#EbaEr~E^s+I]Mas(M[daMir&Mon{O!P'Pli&U, 0A}r@Ag-feAlis+Arch?At-CaCel/Co-D&D!aEl*Ge*Gol&Gus I`Neg&Nid#NoNunc'OnimoT%ipoZi1At>Ertu-OdePari!Pe^ Pogg'P)@Pun Ri,1Ab~AchideAgos+Ald~Anc'Atu-AzzoBit)Chiv'D{Eni,G[ Gi<Gu IaMon?NeseRed#RingaRos S[>SoTef%eZil*0Ciu|Col EpsiEtt>Fal I$O/Pir#P)Sagg'SeSolu Sur@TaT[u T%eT-|0Av>EismoOm>O$TesaTiv&Tor$Tr{Tua,0Sil'Str?Tis+To$moTun$0Anz#E!V[i!Vi(Volge!3Io<O ZimoZur):Be,C}$Ci$CoDessaDi/+Gn#I+L]<L@Le=L/+Lza$Mbi$Ndi!RaondaRba)R}R{$RlumeRoc]Sil>S(Tos+Ttu U,VaVosa3C]FfaLg'LvaNdaNe_,Nig$Nzi=ReRli=Ta3Bi+CiDo<Fi@GaLanc?MboNo]*O*goPedePol&Rban.R-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
|
2022-12-04 01:01:29 +03:00
|
|
|
|
let wordlist$1 = null;
|
|
|
|
|
/**
|
|
|
|
|
* The [[link-bip39-it]] for [mnemonic phrases](link-bip-39).
|
|
|
|
|
*
|
|
|
|
|
* @_docloc: api/wordlists
|
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
|
class LangIt extends WordlistOwl {
|
2022-12-04 01:01:29 +03:00
|
|
|
|
/**
|
|
|
|
|
* Creates a new instance of the Italian language Wordlist.
|
|
|
|
|
*
|
|
|
|
|
* This should be unnecessary most of the time as the exported
|
|
|
|
|
* [[langIt]] should suffice.
|
2022-12-30 19:30:03 +03:00
|
|
|
|
*
|
|
|
|
|
* @_ignore:
|
2022-12-04 01:01:29 +03:00
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
|
constructor() { super("it", words$1, checksum$1); }
|
2022-12-04 01:01:29 +03:00
|
|
|
|
/**
|
|
|
|
|
* Returns a singleton instance of a ``LangIt``, creating it
|
|
|
|
|
* if this is the first time being called.
|
|
|
|
|
*/
|
|
|
|
|
static wordlist() {
|
|
|
|
|
if (wordlist$1 == null) {
|
|
|
|
|
wordlist$1 = new LangIt();
|
|
|
|
|
}
|
|
|
|
|
return wordlist$1;
|
|
|
|
|
}
|
2022-09-05 23:57:11 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const words = "0arad!ototealirertainrasoent hoandoaR#riareha!aroele'oronul0Aca%AixoAl A%rDuz'El]Er$IsmoO$ R<g(Revi Rig Rup$S*$Solu$Sur=Ut[0Ab#Alm Amp Anh A,Ei.El( En ErvoEss E$naHa.IdezImaI}#Irr Lam LiveOlhidaOmod Opl Ord Um~ Us?0Ap.EgaEnt_Ep$Equ Er-%EsivoEusI<%ItivoJetivoJun$M' Or Qu''UboV(,Vog#0R}ave0As.Er'EtivoIn?Iv` Li$Lu-%R}.0Ach Arr As&/Enci Iliz Io)It#O+R! Res%Rup U d Ul]2O`h Ud Us.1AmedaArmeAstr Av<caB(gueB*oCat+De@EcrimEgr@Er.FaceF*e%GumHeioI Ica%I- Inh Ivi Mof^Oc Pis%T( TitudeUc* Ug UnoUsivoVo0Aci A=rA[loAss BasBi-%EixaEniz I=Is$,Iz!eOl?On$ O_,Ost+P Pli Pola0Ag+maAlis Arqu@A$m@DaimeElExoG~ Im JoOm&@Ot#Sio,T(i|Uid!eUnci Zol1Ag?Alp Anh#EgoEli=Ert^Es Eti%I$Lau,Lic^OioOn.Os)R-dizRov 0Uec(0AmeAn]A+C^D-%E@Ej Eni$Es)Gilo,GolaMaQuivoRai&Reba%Risc Rob>um S-&T(i&TigoVo[=0F&.Il#P' S?S* So&/Sun$Tr&0Ac#Adu+Al/A[f E End(Er_EuIng'Ir?IvoOl{oRac Revi=RizU&Um0Di$rM-.R>o+TismoT|@Tu 0Ali An%Ar@Ent&Es,I?Is Ul,1Ila1Ar E=Ei%Ulejo:B BosaC&]uCh `C@GagemI<oIl I}e)Ir_Ixis)J~ Le@LizaLsaN&Nd{aN/N'Nque%Ra$Rb#R}es>+c>~/Se#S)n%Ta)Te=rTidaTomTuc Unil]3B(IjoIr^IsebolLd!eLezaLgaLisc Ndi$Ng&aNz(RimbauRl*d>_Sou_XigaZ(_3CoCu=En&Foc&Furc G|naLhe%Mest[Mo$rOlog@OmboOsf(aPol Rr-$Scoi$Sne$SpoSsex$TolaZ _2Ind#OcoOque 2A$BagemC#CejoChec]Ico.L^LetimL]LoMb{oNdeNecoNi)Rb~h>d>e&R+c]V*oXe?2AncoAsaAvezaEuIgaIl/Inc OaOchu+Onze O$Uxo2C]DismoF LeRacoScaS$Z*a:B<aB`oBideBoBri$CauCet^C/r_CiqueDast_De#Fez&IaqueIp'aIxo%J#JuLafrioLc~ Ld{aLibr Lm<%Lo)M^Mbis)MisaMomilaMp<]Mufl Navi&Nc` Ne)NguruN/$Nive%NoaNs#N.Nu=Pac/P`aP* Po.Pric/Pt?PuzRacolRb}oRde&Rec>imb Rn{oRpe%R['>)zRv&/SacoScaSeb[S%loS~oT a)Tiv UleUs?U%l V&oV(na3BolaDil]G}]Lebr L~ Nou+N,N%ioRc Rr#R%'oRvejaTimV^2Aco)Al{aAm#Ap^ArmeAticeAveEfeEg^E'oEqueIco%If[In`oOc&/Ov(UmboU.Uva0CatrizCl}eD!eD['aEn%G<aM-$N$Nz><d>cui$Rurg@T 2A[zaE_Ic OneUbe2A=Ag'Ba@B($rBr C^El/Ent_E,Gum`oIb'IfaIo%L L{aLh(Lid'Lme@L}oLunaM<=Mb* M-.MitivaMov(MplexoMumNc]N=rNec.Nfu,Ng` Nhec(Njug Nsum'Nt+$Nvi%Op( P{oPi?PoQue%lRagemRdi&Rne)R}h>p|&R[ioR%joRuj>voSs-oS%laT}e%U_UveVilZ*]2A%+AvoEcheE=rEmeErEspoI^Im*&Io~oIseItic Os)UaUz{o2B<oEcaId#JoLat+Lm* Lp Ltu+Mpr'Nh#Pi=RativoRr&Rs R$Sp'S% T`o:MascoT 3Ba%rBi.BocheB~h C&queCim&CliveCo%C[.D&Dic#Duz'FesaFum G`oG+uGus.It#Ix La$rLeg#L*e L}gaM<daMit'Moli=Ntis)P-#Pil PoisP[ssaPur Riv>+m SafioSbo.Sc<,S-/Sfi#Sgas%Sigu&SlizeSmam SovaSpesaS)queSvi T&h T-$rT} Tri$UsaV(Vi=Vot#Z-a3Ag+maAle$Da)Fu,Gi.Lat#Lu-%M*u'Nast@Nh{oOceseRe$Sc[)Sf ceSp oSque%Ssip S)n%T?UrnoV(,Vi,rV~g Z(5Br?L|i=M?M*#NativoNz`>m-%Rs&SagemUr#U$r2EnagemIbleOg @2El EndeE$PloQues><%Vi=,:1Lod'O Olog@0Ific It&Uc#1Ei$Etiv 3E.1Ab| Eg(Ei$rEncoEv?Im* Ogi 0B goBol#Br~/Buti=EndaErg'Is,rPat@P-/P*#Polg P[goPurr Ul?0CaixeC-#Ch-%C}t_Deus Doss Faix Fei%FimGaj#G-/Glob Gom#G+x Gu@Jo La.Qu<$Raiz Rol#Rug Saio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'Pl<%P|Pr-saPuneUniz 0Al?Ap$AtivoC-,Ch Cid'Clu'Col|Deci,D'e$Du$rEficazEr-%F<tilFes.F*i$Flam F|m&F+$rG('Ibi=Ici&ImigoJe.Oc-%O=_Ov?OxQuie$Scri$Se$Sist'Spe$rSt& S~$Tac$Tegr&Tim Toc#TrigaVa,rV(noVic$Voc 0Gur%2Ani<oOniz Re&Rit#0CaEn$Ol#Qu{o0Ali<o:N{oNg^N)R ac>dimR_SmimToV&iZida3
|
|
|
|
|
const checksum = "0x2219000926df7b50d8aa0a3d495826b988287df4657fbd100e6fe596c8f737ac";
|
2022-12-04 01:01:29 +03:00
|
|
|
|
let wordlist = null;
|
|
|
|
|
/**
|
|
|
|
|
* The [[link-bip39-pt]] for [mnemonic phrases](link-bip-39).
|
|
|
|
|
*
|
|
|
|
|
* @_docloc: api/wordlists
|
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
|
class LangPt extends WordlistOwl {
|
2022-12-04 01:01:29 +03:00
|
|
|
|
/**
|
|
|
|
|
* Creates a new instance of the Portuguese language Wordlist.
|
|
|
|
|
*
|
|
|
|
|
* This should be unnecessary most of the time as the exported
|
|
|
|
|
* [[langPt]] should suffice.
|
2022-12-30 19:30:03 +03:00
|
|
|
|
*
|
|
|
|
|
* @_ignore:
|
2022-12-04 01:01:29 +03:00
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
|
constructor() { super("pt", words, checksum); }
|
2022-12-04 01:01:29 +03:00
|
|
|
|
/**
|
|
|
|
|
* Returns a singleton instance of a ``LangPt``, creating it
|
|
|
|
|
* if this is the first time being called.
|
|
|
|
|
*/
|
|
|
|
|
static wordlist() {
|
|
|
|
|
if (wordlist == null) {
|
|
|
|
|
wordlist = new LangPt();
|
|
|
|
|
}
|
|
|
|
|
return wordlist;
|
|
|
|
|
}
|
2022-09-05 23:57:11 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const data = "}aE#4A=Yv&co#4N#6G=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ij8l/VvJDh2oq3hT6EzjTHKFN7ZjZwoTsAZ4Exsko6Fpa6WC+sduz8jyrLpegTv2h1EBeYpLpm2czQW0KoCcS0bCVXCmuWJDBjN1nQNLdF58SFJ0h7i3pC3oEOKy/FjBklL70XvBEEIWp2yZ04xObzAWDDJG7f+DbqBEA7LyiR95j7MDVdDViz2RE5vWlBMv5e4+VfhP3aXNPhvLSynb9O2x4uFBV+3jqu6d5pCG28/sETByvmu/+IJ0L3wb4rj9DNOLBF6XPIODr4L19U9RRofAG6Nxydi8Bki8BhGJbBAJKzbJxkZSlF9Q2Cu8oKqggB9hBArwLLqEBWEtFowy8XK8bEyw9snT+BeyFk1ZCSrdmgfEwFePTgCjELBEnIbjaDDPJm36rG9pztcEzT8dGk23SBhXBB1H4z+OWze0ooFzz8pDBYFvp9j9tvFByf9y4EFdVnz026CGR5qMr7fxMHN8UUdlyJAzlTBDRC28k+L4FB8078ljyD91tUj1ocnTs8vdEf7znbzm+GIjEZnoZE5rnLL700Xc7yHfz05nWxy03vBB9YGHYOWxgMQGBCR24CVYNE1hpfKxN0zKnfJDmmMgMmBWqNbjfSyFCBWSCGCgR8yFXiHyEj+VtD1FB3FpC1zI0kFbzifiKTLm9yq5zFmur+q8FHqjoOBWsBPiDbnCC2ErunV6cJ6TygXFYHYp7MKN9RUlSIS8/xBAGYLzeqUnBF4QbsTuUkUqGs6CaiDWKWjQK9EJkjpkTmNCPYXL";
|
|
|
|
|
const _wordlist = {
|
|
|
|
|
zh_cn: null,
|
|
|
|
|
zh_tw: null
|
|
|
|
|
};
|
|
|
|
|
const Checks = {
|
|
|
|
|
zh_cn: "0x17bcc4d8547e5a7135e365d1ab443aaae95e76d8230c2782c67305d4f21497a1",
|
|
|
|
|
zh_tw: "0x51e720e90c7b87bec1d70eb6e74a21a449bd3ec9c020b01d3a40ed991b60ce5d"
|
|
|
|
|
};
|
|
|
|
|
const codes = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
|
|
|
const style = "~!@#$%^&*_-=[]{}|;:,.()<>?";
|
|
|
|
|
function loadWords(locale) {
|
|
|
|
|
if (_wordlist[locale] != null) {
|
|
|
|
|
return _wordlist[locale];
|
|
|
|
|
}
|
|
|
|
|
const wordlist = [];
|
|
|
|
|
let deltaOffset = 0;
|
|
|
|
|
for (let i = 0; i < 2048; i++) {
|
|
|
|
|
const s = style.indexOf(data[i * 3]);
|
|
|
|
|
const bytes = [
|
|
|
|
|
228 + (s >> 2),
|
|
|
|
|
128 + codes.indexOf(data[i * 3 + 1]),
|
|
|
|
|
128 + codes.indexOf(data[i * 3 + 2]),
|
|
|
|
|
];
|
|
|
|
|
if (locale === "zh_tw") {
|
|
|
|
|
const common = s % 4;
|
|
|
|
|
for (let i = common; i < 3; i++) {
|
|
|
|
|
bytes[i] = codes.indexOf(deltaData[deltaOffset++]) + ((i == 0) ? 228 : 128);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
wordlist.push(toUtf8String(new Uint8Array(bytes)));
|
|
|
|
|
}
|
|
|
|
|
// Verify the computed list matches the official list
|
|
|
|
|
const checksum = id(wordlist.join("\n") + "\n");
|
|
|
|
|
/* c8 ignore start */
|
|
|
|
|
if (checksum !== Checks[locale]) {
|
|
|
|
|
throw new Error(`BIP39 Wordlist for ${locale} (Chinese) FAILED`);
|
|
|
|
|
}
|
|
|
|
|
/* c8 ignore stop */
|
|
|
|
|
_wordlist[locale] = wordlist;
|
|
|
|
|
return wordlist;
|
|
|
|
|
}
|
2022-12-04 01:01:29 +03:00
|
|
|
|
const wordlists = {};
|
|
|
|
|
/**
|
|
|
|
|
* The [[link-bip39-zh_cn]] and [[link-bip39-zh_tw]] for
|
|
|
|
|
* [mnemonic phrases](link-bip-39).
|
|
|
|
|
*
|
|
|
|
|
* @_docloc: api/wordlists
|
|
|
|
|
*/
|
2022-09-05 23:57:11 +03:00
|
|
|
|
class LangZh extends Wordlist {
|
2022-12-04 01:01:29 +03:00
|
|
|
|
/**
|
|
|
|
|
* Creates a new instance of the Chinese language Wordlist for
|
|
|
|
|
* the %%dialect%%, either ``"cn"`` or ``"tw"`` for simplified
|
|
|
|
|
* or traditional, respectively.
|
|
|
|
|
*
|
|
|
|
|
* This should be unnecessary most of the time as the exported
|
|
|
|
|
* [[langZhCn]] and [[langZhTw]] should suffice.
|
2022-12-30 19:30:03 +03:00
|
|
|
|
*
|
|
|
|
|
* @_ignore:
|
2022-12-04 01:01:29 +03:00
|
|
|
|
*/
|
|
|
|
|
constructor(dialect) { super("zh_" + dialect); }
|
2022-09-05 23:57:11 +03:00
|
|
|
|
getWord(index) {
|
|
|
|
|
const words = loadWords(this.locale);
|
2022-11-10 06:45:17 +03:00
|
|
|
|
assertArgument(index >= 0 && index < words.length, `invalid word index: ${index}`, "index", index);
|
2022-09-05 23:57:11 +03:00
|
|
|
|
return words[index];
|
|
|
|
|
}
|
|
|
|
|
getWordIndex(word) {
|
|
|
|
|
return loadWords(this.locale).indexOf(word);
|
|
|
|
|
}
|
2022-12-04 01:01:29 +03:00
|
|
|
|
split(phrase) {
|
|
|
|
|
phrase = phrase.replace(/(?:\u3000| )+/g, "");
|
|
|
|
|
return phrase.split("");
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* Returns a singleton instance of a ``LangZh`` for %%dialect%%,
|
|
|
|
|
* creating it if this is the first time being called.
|
2022-12-30 19:30:03 +03:00
|
|
|
|
*
|
|
|
|
|
* Use the %%dialect%% ``"cn"`` or ``"tw"`` for simplified or
|
|
|
|
|
* traditional, respectively.
|
2022-12-04 01:01:29 +03:00
|
|
|
|
*/
|
|
|
|
|
static wordlist(dialect) {
|
|
|
|
|
if (wordlists[dialect] == null) {
|
|
|
|
|
wordlists[dialect] = new LangZh(dialect);
|
|
|
|
|
}
|
|
|
|
|
return wordlists[dialect];
|
2022-09-05 23:57:11 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-04 01:01:29 +03:00
|
|
|
|
export { LangCz, LangEs, LangFr, LangIt, LangJa, LangKo, LangPt, LangZh };
|
2022-09-05 23:57:11 +03:00
|
|
|
|
//# sourceMappingURL=wordlists-extra.js.map
|