diff options
| author | Adam Mathes <adam@adammathes.com> | 2026-02-14 14:46:37 -0800 |
|---|---|---|
| committer | Adam Mathes <adam@adammathes.com> | 2026-02-14 14:46:37 -0800 |
| commit | afa87af01c79a9baa539f2992d32154d2a4739bd (patch) | |
| tree | 92c7416db734270a2fee1d72ee9cc119379ff8e1 /vanilla/node_modules/@exodus/bytes/fallback/base58check.js | |
| parent | 3b927e84d200402281f68181cd4253bc77e5528d (diff) | |
| download | neko-afa87af01c79a9baa539f2992d32154d2a4739bd.tar.gz neko-afa87af01c79a9baa539f2992d32154d2a4739bd.tar.bz2 neko-afa87af01c79a9baa539f2992d32154d2a4739bd.zip | |
task: delete vanilla js prototype\n\n- Removed vanilla/ directory and web/dist/vanilla directory\n- Updated Makefile, Dockerfile, and CI workflow to remove vanilla references\n- Cleaned up web/web.go to remove vanilla embed and routes\n- Verified build and tests pass\n\nCloses NK-2tcnmq
Diffstat (limited to 'vanilla/node_modules/@exodus/bytes/fallback/base58check.js')
| -rw-r--r-- | vanilla/node_modules/@exodus/bytes/fallback/base58check.js | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/vanilla/node_modules/@exodus/bytes/fallback/base58check.js b/vanilla/node_modules/@exodus/bytes/fallback/base58check.js deleted file mode 100644 index f4ec8cc..0000000 --- a/vanilla/node_modules/@exodus/bytes/fallback/base58check.js +++ /dev/null @@ -1,53 +0,0 @@ -import { typedView } from '@exodus/bytes/array.js' -import { toBase58, fromBase58 } from '@exodus/bytes/base58.js' -import { assertU8 } from './_utils.js' - -const E_CHECKSUM = 'Invalid checksum' - -// checksum length is 4, i.e. only the first 4 bytes of the hash are used - -function encodeWithChecksum(arr, checksum) { - // arr type in already validated in input - const res = new Uint8Array(arr.length + 4) - res.set(arr, 0) - res.set(checksum.subarray(0, 4), arr.length) - return toBase58(res) -} - -function decodeWithChecksum(str) { - const arr = fromBase58(str) // checks input - const payloadSize = arr.length - 4 - if (payloadSize < 0) throw new Error(E_CHECKSUM) - return [arr.subarray(0, payloadSize), arr.subarray(payloadSize)] -} - -function assertChecksum(c, r) { - if ((c[0] ^ r[0]) | (c[1] ^ r[1]) | (c[2] ^ r[2]) | (c[3] ^ r[3])) throw new Error(E_CHECKSUM) -} - -export const makeBase58check = (hashAlgo, hashAlgoSync) => { - const apis = { - async encode(arr) { - assertU8(arr) - return encodeWithChecksum(arr, await hashAlgo(arr)) - }, - async decode(str, format = 'uint8') { - const [payload, checksum] = decodeWithChecksum(str) - assertChecksum(checksum, await hashAlgo(payload)) - return typedView(payload, format) - }, - } - if (!hashAlgoSync) return apis - return { - ...apis, - encodeSync(arr) { - assertU8(arr) - return encodeWithChecksum(arr, hashAlgoSync(arr)) - }, - decodeSync(str, format = 'uint8') { - const [payload, checksum] = decodeWithChecksum(str) - assertChecksum(checksum, hashAlgoSync(payload)) - return typedView(payload, format) - }, - } -} |
