From 5ed850196b489d699481e09a096efd7148e367ba Mon Sep 17 00:00:00 2001 From: sneak Date: Fri, 20 Jun 2025 12:49:01 -0700 Subject: [PATCH] fix: convert ALL_CAPS constants to CamelCase (revive) - Rename APP_BIP39 to AppBIP39 - Rename APP_HD_WIF to AppHDWIF - Rename APP_XPRV to AppXPRV - Rename APP_PWD85 to AppPWD85 - Update all references in the code --- pkg/bip85/bip85.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/bip85/bip85.go b/pkg/bip85/bip85.go index f0a66d6..a76d4a7 100644 --- a/pkg/bip85/bip85.go +++ b/pkg/bip85/bip85.go @@ -28,12 +28,12 @@ const ( BIP85_KEY_HMAC_KEY = "bip-entropy-from-k" //nolint:revive // ALL_CAPS used for BIP85 constants // Application numbers - APP_BIP39 = 39 // BIP39 mnemonics //nolint:revive // ALL_CAPS used for BIP85 constants - APP_HD_WIF = 2 // WIF for Bitcoin Core //nolint:revive // ALL_CAPS used for BIP85 constants - APP_XPRV = 32 // Extended private key //nolint:revive // ALL_CAPS used for BIP85 constants + AppBIP39 = 39 // BIP39 mnemonics + AppHDWIF = 2 // WIF for Bitcoin Core + AppXPRV = 32 // Extended private key APP_HEX = 128169 //nolint:revive // ALL_CAPS used for BIP85 constants APP_PWD64 = 707764 // Base64 passwords //nolint:revive // ALL_CAPS used for BIP85 constants - APP_PWD85 = 707785 // Base85 passwords //nolint:revive // ALL_CAPS used for BIP85 constants + AppPWD85 = 707785 // Base85 passwords APP_RSA = 828365 //nolint:revive // ALL_CAPS used for BIP85 constants ) @@ -161,7 +161,7 @@ func deriveChildKey(parent *hdkeychain.ExtendedKey, path string) (*hdkeychain.Ex // DeriveBIP39Entropy derives entropy for a BIP39 mnemonic func DeriveBIP39Entropy(masterKey *hdkeychain.ExtendedKey, language, words, index uint32) ([]byte, error) { - path := fmt.Sprintf("%s/%d'/%d'/%d'/%d'", BIP85_MASTER_PATH, APP_BIP39, language, words, index) + path := fmt.Sprintf("%s/%d'/%d'/%d'/%d'", BIP85_MASTER_PATH, AppBIP39, language, words, index) entropy, err := DeriveBIP85Entropy(masterKey, path) if err != nil { @@ -193,7 +193,7 @@ func DeriveBIP39Entropy(masterKey *hdkeychain.ExtendedKey, language, words, inde // DeriveWIFKey derives a private key in WIF format func DeriveWIFKey(masterKey *hdkeychain.ExtendedKey, index uint32) (string, error) { - path := fmt.Sprintf("%s/%d'/%d'", BIP85_MASTER_PATH, APP_HD_WIF, index) + path := fmt.Sprintf("%s/%d'/%d'", BIP85_MASTER_PATH, AppHDWIF, index) entropy, err := DeriveBIP85Entropy(masterKey, path) if err != nil { @@ -215,7 +215,7 @@ func DeriveWIFKey(masterKey *hdkeychain.ExtendedKey, index uint32) (string, erro // DeriveXPRV derives an extended private key (XPRV) func DeriveXPRV(masterKey *hdkeychain.ExtendedKey, index uint32) (*hdkeychain.ExtendedKey, error) { - path := fmt.Sprintf("%s/%d'/%d'", BIP85_MASTER_PATH, APP_XPRV, index) + path := fmt.Sprintf("%s/%d'/%d'", BIP85_MASTER_PATH, AppXPRV, index) entropy, err := DeriveBIP85Entropy(masterKey, path) if err != nil { @@ -322,7 +322,7 @@ func DeriveBase85Password(masterKey *hdkeychain.ExtendedKey, pwdLen, index uint3 return "", fmt.Errorf("pwdLen must be between 10 and 80") } - path := fmt.Sprintf("%s/%d'/%d'/%d'", BIP85_MASTER_PATH, APP_PWD85, pwdLen, index) + path := fmt.Sprintf("%s/%d'/%d'/%d'", BIP85_MASTER_PATH, AppPWD85, pwdLen, index) entropy, err := DeriveBIP85Entropy(masterKey, path) if err != nil {