]> git.codecow.com Git - libnemo.git/commitdiff
Remove redundant argument validation.
authorChris Duncan <chris@codecow.com>
Mon, 18 May 2026 13:56:27 +0000 (06:56 -0700)
committerChris Duncan <chris@codecow.com>
Mon, 18 May 2026 13:56:27 +0000 (06:56 -0700)
src/lib/ledger/sign.ts

index f10ec9cd876b83e353c34d131f398642e9a0d01e..db1d98cd0b4645e2abe307fbbc3b58ede58455d9 100644 (file)
@@ -1,7 +1,7 @@
 //! SPDX-FileCopyrightText: 2025 Chris Duncan <chris@codecow.com>
 //! SPDX-License-Identifier: GPL-3.0-or-later
 
-import { APDU_CODES, DERIVATION_PATH, LedgerSignResponse, LedgerTransport, STATUS_CODES, LISTEN_TIMEOUT, OPEN_TIMEOUT } from '.'
+import { APDU_CODES, DERIVATION_PATH, LedgerSignResponse, LedgerTransport, LISTEN_TIMEOUT, OPEN_TIMEOUT, STATUS_CODES } from '.'
 import { Account } from '../account'
 import { Block } from '../block'
 import { HARDENED_OFFSET } from '../constants'
@@ -59,9 +59,6 @@ async function signBlock (transport: LedgerTransport, index: number, block: Bloc
        }
        return queue<LedgerSignResponse>(async () => {
                try {
-                       if (typeof index !== 'number' || index < 0 || index >= HARDENED_OFFSET) {
-                               throw new TypeError('Invalid account index')
-                       }
                        if (!(block.link instanceof Uint8Array)) {
                                throw new TypeError('Invalid block link')
                        }
@@ -111,9 +108,6 @@ async function signBlock (transport: LedgerTransport, index: number, block: Bloc
  */
 async function signNonce (transport: LedgerTransport, index: number, nonce: Uint8Array<ArrayBuffer>): Promise<LedgerSignResponse> {
        return queue<LedgerSignResponse>(async () => {
-               if (typeof index !== 'number' || index < 0 || index >= HARDENED_OFFSET) {
-                       throw new TypeError('Invalid account index')
-               }
                if (nonce.byteLength !== 16) {
                        throw new RangeError('Nonce must be 16-byte string')
                }