macaroons: use fast scrypt options in itest and unit tests
This commit is contained in:
parent
466294ed4c
commit
847d27f8a6
13
macaroons/security.go
Normal file
13
macaroons/security.go
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// +build !rpctest
|
||||||
|
|
||||||
|
package macaroons
|
||||||
|
|
||||||
|
import "github.com/btcsuite/btcwallet/snacl"
|
||||||
|
|
||||||
|
var (
|
||||||
|
// Below are the default scrypt parameters that are used when creating
|
||||||
|
// the encryption key for the macaroon database with snacl.NewSecretKey.
|
||||||
|
scryptN = snacl.DefaultN
|
||||||
|
scryptR = snacl.DefaultR
|
||||||
|
scryptP = snacl.DefaultP
|
||||||
|
)
|
14
macaroons/security_rpctest.go
Normal file
14
macaroons/security_rpctest.go
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
// +build rpctest
|
||||||
|
|
||||||
|
package macaroons
|
||||||
|
|
||||||
|
import "github.com/btcsuite/btcwallet/waddrmgr"
|
||||||
|
|
||||||
|
var (
|
||||||
|
// Below are the reduced scrypt parameters that are used when creating
|
||||||
|
// the encryption key for the macaroon database with snacl.NewSecretKey.
|
||||||
|
// We use very low values for our itest/rpctest to speed things up.
|
||||||
|
scryptN = waddrmgr.FastScryptOptions.N
|
||||||
|
scryptR = waddrmgr.FastScryptOptions.R
|
||||||
|
scryptP = waddrmgr.FastScryptOptions.P
|
||||||
|
)
|
12
macaroons/security_test.go
Normal file
12
macaroons/security_test.go
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
package macaroons
|
||||||
|
|
||||||
|
import "github.com/btcsuite/btcwallet/waddrmgr"
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
// Below are the reduced scrypt parameters that are used when creating
|
||||||
|
// the encryption key for the macaroon database with snacl.NewSecretKey.
|
||||||
|
// We use very low values for our itest/rpctest to speed things up.
|
||||||
|
scryptN = waddrmgr.FastScryptOptions.N
|
||||||
|
scryptR = waddrmgr.FastScryptOptions.R
|
||||||
|
scryptP = waddrmgr.FastScryptOptions.P
|
||||||
|
}
|
@ -106,8 +106,9 @@ func (r *RootKeyStorage) CreateUnlock(password *[]byte) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// We haven't yet stored a key, so create a new one.
|
// We haven't yet stored a key, so create a new one.
|
||||||
encKey, err := snacl.NewSecretKey(password, snacl.DefaultN,
|
encKey, err := snacl.NewSecretKey(
|
||||||
snacl.DefaultR, snacl.DefaultP)
|
password, scryptN, scryptR, scryptP,
|
||||||
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user