style: enable strict gofumpt (#15579)
This commit is contained in:
+3
-3
@@ -26,12 +26,12 @@ const (
|
||||
var Secp256k1 = secp256k1Algo{}
|
||||
|
||||
type (
|
||||
DeriveFn func(mnemonic string, bip39Passphrase, hdPath string) ([]byte, error)
|
||||
DeriveFn func(mnemonic, bip39Passphrase, hdPath string) ([]byte, error)
|
||||
GenerateFn func(bz []byte) types.PrivKey
|
||||
)
|
||||
|
||||
type WalletGenerator interface {
|
||||
Derive(mnemonic string, bip39Passphrase, hdPath string) ([]byte, error)
|
||||
Derive(mnemonic, bip39Passphrase, hdPath string) ([]byte, error)
|
||||
Generate(bz []byte) types.PrivKey
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ func (s secp256k1Algo) Name() PubKeyType {
|
||||
|
||||
// Derive derives and returns the secp256k1 private key for the given seed and HD path.
|
||||
func (s secp256k1Algo) Derive() DeriveFn {
|
||||
return func(mnemonic string, bip39Passphrase, hdPath string) ([]byte, error) {
|
||||
return func(mnemonic, bip39Passphrase, hdPath string) ([]byte, error) {
|
||||
seed, err := bip39.NewSeedWithErrorChecking(mnemonic, bip39Passphrase)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
+4
-4
@@ -156,7 +156,7 @@ func (p BIP44Params) String() string {
|
||||
}
|
||||
|
||||
// ComputeMastersFromSeed returns the master secret key's, and chain code.
|
||||
func ComputeMastersFromSeed(seed []byte) (secret [32]byte, chainCode [32]byte) {
|
||||
func ComputeMastersFromSeed(seed []byte) (secret, chainCode [32]byte) {
|
||||
curveIdentifier := []byte("Bitcoin seed")
|
||||
secret, chainCode = i64(curveIdentifier, seed)
|
||||
|
||||
@@ -216,7 +216,7 @@ func DerivePrivateKeyForPath(privKeyBytes, chainCode [32]byte, path string) ([]b
|
||||
// It returns the new private key and new chain code.
|
||||
// For more information on hardened keys see:
|
||||
// - https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki
|
||||
func derivePrivateKey(privKeyBytes [32]byte, chainCode [32]byte, index uint32, harden bool) ([32]byte, [32]byte) {
|
||||
func derivePrivateKey(privKeyBytes, chainCode [32]byte, index uint32, harden bool) ([32]byte, [32]byte) {
|
||||
var data []byte
|
||||
|
||||
if harden {
|
||||
@@ -244,7 +244,7 @@ func derivePrivateKey(privKeyBytes [32]byte, chainCode [32]byte, index uint32, h
|
||||
}
|
||||
|
||||
// modular big endian addition
|
||||
func addScalars(a []byte, b []byte) [32]byte {
|
||||
func addScalars(a, b []byte) [32]byte {
|
||||
aInt := new(big.Int).SetBytes(a)
|
||||
bInt := new(big.Int).SetBytes(b)
|
||||
sInt := new(big.Int).Add(aInt, bInt)
|
||||
@@ -263,7 +263,7 @@ func uint32ToBytes(i uint32) []byte {
|
||||
}
|
||||
|
||||
// i64 returns the two halfs of the SHA512 HMAC of key and data.
|
||||
func i64(key []byte, data []byte) (il [32]byte, ir [32]byte) {
|
||||
func i64(key, data []byte) (il, ir [32]byte) {
|
||||
mac := hmac.New(sha512.New, key)
|
||||
// sha512 does not err
|
||||
_, _ = mac.Write(data)
|
||||
|
||||
Reference in New Issue
Block a user