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/wif.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/wif.js')
| -rw-r--r-- | vanilla/node_modules/@exodus/bytes/wif.js | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/vanilla/node_modules/@exodus/bytes/wif.js b/vanilla/node_modules/@exodus/bytes/wif.js deleted file mode 100644 index 690477e..0000000 --- a/vanilla/node_modules/@exodus/bytes/wif.js +++ /dev/null @@ -1,41 +0,0 @@ -import { toBase58checkSync, fromBase58checkSync } from '@exodus/bytes/base58check.js' -import { assertUint8 } from './assert.js' - -// Mostly matches npmjs.com/wif, but with extra checks + using our base58check -// Also no inconsistent behavior on Buffer/Uint8Array input - -function from(arr, expectedVersion) { - assertUint8(arr) - if (arr.length !== 33 && arr.length !== 34) throw new Error('Invalid WIF length') - const version = arr[0] - if (expectedVersion !== undefined && version !== expectedVersion) { - throw new Error('Invalid network version') - } - - // Makes a copy, regardless of input being a Buffer or a Uint8Array (unlike .slice) - const privateKey = Uint8Array.from(arr.subarray(1, 33)) - if (arr.length === 33) return { version, privateKey, compressed: false } - if (arr[33] !== 1) throw new Error('Invalid compression flag') - return { version, privateKey, compressed: true } -} - -function to({ version: v, privateKey, compressed }) { - if (!Number.isSafeInteger(v) || v < 0 || v > 0xff) throw new Error('Missing or invalid version') - assertUint8(privateKey, { length: 32, name: 'privateKey' }) - const out = new Uint8Array(compressed ? 34 : 33) - out[0] = v - out.set(privateKey, 1) - if (compressed) out[33] = 1 - return out -} - -// Async performance is worse here, so expose the same internal methods as sync for now -// ./base58check is sync internally anyway for now, so doesn't matter until that is changed - -export const fromWifStringSync = (string, version) => from(fromBase58checkSync(string), version) -// export const fromWifString = async (string, version) => from(await fromBase58check(string), version) -export const fromWifString = async (string, version) => from(fromBase58checkSync(string), version) - -export const toWifStringSync = (wif) => toBase58checkSync(to(wif)) -// export const toWifString = async (wif) => toBase58check(to(wif)) -export const toWifString = async (wif) => toBase58checkSync(to(wif)) |
