mirror of
https://github.com/lightninglabs/loop
synced 2024-11-13 13:10:30 +00:00
17 lines
447 B
Go
17 lines
447 B
Go
package test
|
|
|
|
import (
|
|
"github.com/btcsuite/btcd/btcec/v2"
|
|
)
|
|
|
|
// 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.
|
|
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),
|
|
})
|
|
|
|
return privKey, pubKey
|
|
}
|