2019-03-06 20:13:50 +00:00
|
|
|
package test
|
|
|
|
|
|
|
|
import (
|
2022-03-14 12:36:02 +00:00
|
|
|
"github.com/btcsuite/btcd/btcec/v2"
|
2019-03-06 20:13:50 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// CreateKey returns a deterministically generated key pair.
|
|
|
|
func CreateKey(index int32) (*btcec.PrivateKey, *btcec.PublicKey) {
|
|
|
|
// Avoid all zeros, because it results in an invalid key.
|
2022-03-14 12:36:02 +00:00
|
|
|
privKey, pubKey := btcec.PrivKeyFromBytes([]byte{
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, byte(index + 1),
|
|
|
|
})
|
2019-03-06 20:13:50 +00:00
|
|
|
|
|
|
|
return privKey, pubKey
|
|
|
|
}
|