Documentation ¶
Index ¶
- Constants
- type Secp256k1Keypair
- func DeriveSecp256k1Keypair(mnemonics string, path string) (*Secp256k1Keypair, error)
- func FromSecp256k1SecretKey(secretKey interface{}, skipValidation bool) (*Secp256k1Keypair, error)
- func FromSecp256k1Seed(seed []byte) (*Secp256k1Keypair, error)
- func GenerateSecp256k1Keypair() (*Secp256k1Keypair, error)
- func NewSecp256k1Keypair(keypair *Secp256k1KeypairData) (*Secp256k1Keypair, error)
- type Secp256k1KeypairData
- type Secp256k1PublicKey
- func (pk *Secp256k1PublicKey) Equals(other crypto.PublicKey[address.AddressView]) bool
- func (pk *Secp256k1PublicKey) Flag() uint8
- func (pk *Secp256k1PublicKey) String() string
- func (pk *Secp256k1PublicKey) ToAddress() (*address.AddressView, error)
- func (pk *Secp256k1PublicKey) ToAddressWith(network address.BitcoinNetworkType) (*address.AddressView, error)
- func (pk *Secp256k1PublicKey) ToBase64() string
- func (pk *Secp256k1PublicKey) ToBytes() []byte
- func (pk *Secp256k1PublicKey) Verify(message []byte, signature []byte) (bool, error)
Constants ¶
const DefaultSecp256k1DerivationPath = "m/54'/784'/0'/0/0"
const (
SchnorrPublicKeySize = 32
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Secp256k1Keypair ¶
type Secp256k1Keypair struct {
// contains filtered or unexported fields
}
Secp256k1Keypair represents a Secp256k1 keypair
func DeriveSecp256k1Keypair ¶
func DeriveSecp256k1Keypair(mnemonics string, path string) (*Secp256k1Keypair, error)
DeriveKeypair derives a keypair from mnemonics and path
func FromSecp256k1SecretKey ¶
func FromSecp256k1SecretKey(secretKey interface{}, skipValidation bool) (*Secp256k1Keypair, error)
FromSecretKey creates a keypair from a raw secret key byte array func FromSecp256k1SecretKey(secretKey []byte, skipValidation bool) (*Secp256k1Keypair, error) {
func FromSecp256k1Seed ¶
func FromSecp256k1Seed(seed []byte) (*Secp256k1Keypair, error)
FromSeed generates a keypair from a 32 byte seed
func GenerateSecp256k1Keypair ¶
func GenerateSecp256k1Keypair() (*Secp256k1Keypair, error)
Generate generates a new random keypair
func NewSecp256k1Keypair ¶
func NewSecp256k1Keypair(keypair *Secp256k1KeypairData) (*Secp256k1Keypair, error)
NewSecp256k1Keypair creates a new keypair instance
func (*Secp256k1Keypair) GetPublicKey ¶
func (kp *Secp256k1Keypair) GetPublicKey() crypto.PublicKey[address.AddressView]
GetPublicKey returns the public key
func (kp *Secp256k1Keypair) GetPublicKey() []byte { return kp.keypair.PublicKey }
func (*Secp256k1Keypair) GetSchnorrPublicKey ¶
func (kp *Secp256k1Keypair) GetSchnorrPublicKey() crypto.PublicKey[address.AddressView]
GetSchnorrPublicKey returns the Schnorr public key
func (*Secp256k1Keypair) GetSecretKey ¶
func (kp *Secp256k1Keypair) GetSecretKey() []byte
GetSecretKey returns the secret key
type Secp256k1KeypairData ¶
Secp256k1KeypairData represents the keypair data structure
type Secp256k1PublicKey ¶
type Secp256k1PublicKey struct {
// contains filtered or unexported fields
}
Secp256k1PublicKey represents a Secp256k1 public key
func NewSecp256k1PublicKey ¶
func NewSecp256k1PublicKey(value interface{}) (*Secp256k1PublicKey, error)
NewSecp256k1PublicKey creates a new Secp256k1PublicKey object
func (*Secp256k1PublicKey) Equals ¶
func (pk *Secp256k1PublicKey) Equals(other crypto.PublicKey[address.AddressView]) bool
Equals checks if two Secp256k1 public keys are equal
func (*Secp256k1PublicKey) Flag ¶
func (pk *Secp256k1PublicKey) Flag() uint8
Flag returns the signature scheme flag for Secp256k1
func (*Secp256k1PublicKey) String ¶
func (pk *Secp256k1PublicKey) String() string
String returns the hex string representation of the public key
func (*Secp256k1PublicKey) ToAddress ¶
func (pk *Secp256k1PublicKey) ToAddress() (*address.AddressView, error)
ToAddress returns the Bitcoin address associated with this Secp256k1 public key func (pk *Secp256k1PublicKey) ToAddress() (*address.AddressView, error) {
func (*Secp256k1PublicKey) ToAddressWith ¶
func (pk *Secp256k1PublicKey) ToAddressWith(network address.BitcoinNetworkType) (*address.AddressView, error)
ToAddressWith returns the Bitcoin address with specified network type
func (*Secp256k1PublicKey) ToBase64 ¶
func (pk *Secp256k1PublicKey) ToBase64() string
func (*Secp256k1PublicKey) ToBytes ¶
func (pk *Secp256k1PublicKey) ToBytes() []byte
ToBytes returns the byte array representation of the Secp256k1 public key