]> git.codecow.com Git - libnemo.git/commitdiff
Align tsc libs with esbuild targets and remove unsupported functions.
authorChris Duncan <chris@zoso.dev>
Tue, 31 Mar 2026 10:16:14 +0000 (03:16 -0700)
committerChris Duncan <chris@zoso.dev>
Tue, 31 Mar 2026 10:16:14 +0000 (03:16 -0700)
src/lib/convert.ts
src/lib/crypto/bip39.ts
src/lib/vault/passkey.ts
src/lib/vault/vault-worker.ts
src/lib/wallet/index.ts
tsconfig.json

index af1c3d79e144fe63ec270296f2629b84fcd89400..cd1db658a88b03d85c5239cd93f9c497c61269fc 100644 (file)
@@ -81,10 +81,10 @@ export class bytes {
        */\r
        static erase (bytes?: ArrayBuffer | Uint8Array<ArrayBuffer> | null): void {\r
                if (bytes == null) return\r
-               if (bytes instanceof ArrayBuffer && bytes.detached) return\r
-               if (bytes instanceof Uint8Array && bytes.buffer.detached) return\r
+               if (bytes instanceof ArrayBuffer && bytes.byteLength === 0) return\r
+               if (bytes instanceof Uint8Array && bytes.buffer.byteLength === 0) return\r
                bytes = bytes instanceof ArrayBuffer ? new Uint8Array(bytes) : bytes\r
-               bytes.fill(0).buffer.transfer?.()\r
+               bytes.fill(0)\r
        }\r
 \r
        /**\r
@@ -153,7 +153,7 @@ export class bytes {
        */\r
        static toHex (bytes: ArrayBuffer | Uint8Array): string {\r
                if (bytes instanceof ArrayBuffer) bytes = new Uint8Array(bytes)\r
-               if (bytes.buffer instanceof ArrayBuffer && bytes.buffer.detached) return ''\r
+               if (bytes.buffer instanceof ArrayBuffer && bytes.buffer.byteLength === 0) return ''\r
                return [...bytes]\r
                        .map(byte => byte.toString(16).padStart(2, '0'))\r
                        .join('')\r
index 2843821dd70151f7d6fde2a87dd2a52f8a5bc41f..ba10bf181346eaf764f43eb5101f1bdfb0d8eae0 100644 (file)
@@ -157,8 +157,8 @@ export class Bip39 {
        * Erases seed bytes and releases variable references.\r
        */\r
        destroy () {\r
-               this.#bip39Seed?.fill(0).buffer.transfer?.()\r
-               this.#blake2bSeed?.fill(0).buffer.transfer?.()\r
+               this.#bip39Seed?.fill(0)\r
+               this.#blake2bSeed?.fill(0)\r
                this.#bip39Seed = undefined\r
                this.#blake2bSeed = undefined\r
                this.#phrase = undefined\r
index 97d9e98168ec95b125ef5aae70de21858158fbc6..90a70b8774a6752d70aa68c8f7e6c1ba663317ad 100644 (file)
@@ -22,7 +22,7 @@ export class Passkey {
                        return crypto.subtle
                                .importKey('raw', password, 'PBKDF2', false, ['deriveKey'])
                                .then(derivationKey => {
-                                       new Uint8Array(password).fill(0).buffer.transfer?.()
+                                       new Uint8Array(password).fill(0)
                                        const derivationAlgorithm: Pbkdf2Params = {
                                                name: 'PBKDF2',
                                                hash: 'SHA-512',
index b740c52a59eb72ab61ca11561a66d99c90f5bc59..c980c2d1e8459665c8c568a7f72ccd687fd14259 100644 (file)
@@ -87,8 +87,8 @@ const listener = (event: MessageEvent<any>): void => {
                })
                .catch((err: any) => {
                        for (let data of Object.values(event.data)) {
-                               if (data instanceof ArrayBuffer && !data.detached) {
-                                       new Uint8Array(data).fill(0).buffer.transfer?.()
+                               if (data instanceof ArrayBuffer && data.byteLength !== 0) {
+                                       new Uint8Array(data).fill(0)
                                }
                                data = undefined
                        }
index fce75baf2d0e109848ec33ca11d889e3a3268027..877433f37ff87a14022608a5c803c782b1d92a96 100644 (file)
@@ -192,7 +192,7 @@ export class Wallet {
                        const b = new Uint8Array(this.#mnemonic)\r
                        this.#mnemonic = undefined\r
                        const m = bytes.toUtf8(b)\r
-                       b.fill(0).buffer.transfer?.()\r
+                       b.fill(0)\r
                        return m\r
                } catch {\r
                        this.#mnemonic = undefined\r
@@ -210,7 +210,7 @@ export class Wallet {
                        const b = new Uint8Array(this.#seed)\r
                        this.#seed = undefined\r
                        const s = bytes.toHex(b)\r
-                       b.fill(0).buffer.transfer?.()\r
+                       b.fill(0)\r
                        return s\r
                } catch {\r
                        this.#seed = undefined\r
index 38369a77dc2632e22d75e3be3fb90142c2cea00c..9839a273b2983b03e37925c7c0257421197530f9 100644 (file)
@@ -16,7 +16,7 @@
                "target": "es2024",
                "lib": [
                        "DOM",
-                       "ES2024"
+                       "ES2022"
                ],
                "types": [
                        "node",