secp256k1

package
v0.0.0-...-41a254f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultSecp256k1DerivationPath = "m/54'/784'/0'/0/0"
View Source
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

func (*Secp256k1Keypair) Sign

func (kp *Secp256k1Keypair) Sign(input []byte) ([]byte, error)

Sign signs the provided data

type Secp256k1KeypairData

type Secp256k1KeypairData struct {
	PublicKey []byte
	SecretKey []byte
}

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

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

func (*Secp256k1PublicKey) Verify

func (pk *Secp256k1PublicKey) Verify(message []byte, signature []byte) (bool, error)

Verify verifies that the signature is valid for the provided message

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL