]> git.codecow.com Git - libnemo.git/commitdiff
Move an imported constant used in only one place.
authorChris Duncan <chris@zoso.dev>
Sat, 9 Aug 2025 07:24:35 +0000 (00:24 -0700)
committerChris Duncan <chris@zoso.dev>
Sat, 9 Aug 2025 07:24:35 +0000 (00:24 -0700)
src/lib/constants.ts
src/lib/crypto/bip39.ts

index 8fdc08af83ab6c774e9a9c84639eddce2f877f1e..48c67caf9ae727922e19706c408ba48309071c4d 100644 (file)
@@ -5,7 +5,6 @@ export const ACCOUNT_KEY_BYTE_LENGTH = 32
 export const ACCOUNT_KEY_HEX_LENGTH = 64
 export const ADDRESS_GAP = 20
 export const ALPHABET = '13456789abcdefghijkmnopqrstuwxyz'
-export const BIP39_ITERATIONS = 2048
 export const BIP44_PURPOSE = 44
 export const BIP44_COIN_NANO = 165
 export const BURN_ADDRESS = 'nano_1111111111111111111111111111111111111111111111111111hifc8npp'
@@ -67,7 +66,6 @@ export default `
        const ACCOUNT_KEY_HEX_LENGTH = ${ACCOUNT_KEY_HEX_LENGTH}
        const ADDRESS_GAP = ${ADDRESS_GAP}
        const ALPHABET = '${ALPHABET}'
-       const BIP39_ITERATIONS = ${BIP39_ITERATIONS}
        const BIP44_PURPOSE = ${BIP44_PURPOSE}
        const BIP44_COIN_NANO = ${BIP44_COIN_NANO}
        const BURN_ADDRESS = '${BURN_ADDRESS}'
index bd94034b95a1959f2baf752a5e66f2637f8162c8..7baf54a63340f553318ffc19ad4fd9477e0ce440 100644 (file)
@@ -1,7 +1,6 @@
 //! SPDX-FileCopyrightText: 2025 Chris Duncan <chris@zoso.dev>\r
 //! SPDX-License-Identifier: GPL-3.0-or-later\r
 \r
-import { BIP39_ITERATIONS } from '../constants'\r
 import { bytes, utf8 } from '../convert'\r
 \r
 /**\r
@@ -9,6 +8,7 @@ import { bytes, utf8 } from '../convert'
 */\r
 export class Bip39 {\r
        static #isInternal: boolean = false\r
+       static #ITERATIONS: 2048 = 2048\r
 \r
        /**\r
         * SHA-256 hash of entropy that is appended to the entropy and subsequently\r
@@ -203,7 +203,7 @@ export class Bip39 {
                                name: 'PBKDF2',\r
                                hash: 'SHA-512',\r
                                salt: utf8.toBytes(`mnemonic${salt.normalize('NFKD')}`),\r
-                               iterations: BIP39_ITERATIONS\r
+                               iterations: Bip39.#ITERATIONS\r
                        }\r
                        const seed = await crypto.subtle.deriveBits(algorithm, phraseKey, 512)\r
                        this.#bip39Seed = new Uint8Array(seed)\r