secp256k1

package
v1.10.12-rc.5 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2023 License: BSD-3-Clause Imports: 10 Imported by: 5

Documentation

Index

Constants

View Source
const (
	// SignatureLen is the number of bytes in a secp2561k recoverable signature
	SignatureLen = 65

	// PrivateKeyLen is the number of bytes in a secp2561k recoverable private
	// key
	PrivateKeyLen = 32

	// PublicKeyLen is the number of bytes in a secp2561k recoverable public key
	PublicKeyLen = 33

	PrivateKeyPrefix = "PrivateKey-"
)

Variables

View Source
var (
	ErrInvalidSig = errors.New("invalid signature")
)

Functions

This section is empty.

Types

type Factory

type Factory struct {
	Cache cache.LRU[ids.ID, *PublicKey]
}

func (*Factory) NewPrivateKey

func (*Factory) NewPrivateKey() (*PrivateKey, error)

func (*Factory) RecoverHashPublicKey

func (f *Factory) RecoverHashPublicKey(hash, sig []byte) (*PublicKey, error)

func (*Factory) RecoverPublicKey

func (f *Factory) RecoverPublicKey(msg, sig []byte) (*PublicKey, error)

func (*Factory) ToPrivateKey

func (*Factory) ToPrivateKey(b []byte) (*PrivateKey, error)

func (*Factory) ToPublicKey

func (*Factory) ToPublicKey(b []byte) (*PublicKey, error)

type PrivateKey

type PrivateKey struct {
	// contains filtered or unexported fields
}

func TestKeys

func TestKeys() []*PrivateKey

func (*PrivateKey) Address

func (k *PrivateKey) Address() ids.ShortID

func (*PrivateKey) Bytes

func (k *PrivateKey) Bytes() []byte

func (*PrivateKey) MarshalJSON

func (k *PrivateKey) MarshalJSON() ([]byte, error)

func (*PrivateKey) MarshalText

func (k *PrivateKey) MarshalText() ([]byte, error)

func (*PrivateKey) PublicKey

func (k *PrivateKey) PublicKey() *PublicKey

func (*PrivateKey) Sign

func (k *PrivateKey) Sign(msg []byte) ([]byte, error)

func (*PrivateKey) SignHash

func (k *PrivateKey) SignHash(hash []byte) ([]byte, error)

func (*PrivateKey) String

func (k *PrivateKey) String() string

func (*PrivateKey) ToECDSA

func (k *PrivateKey) ToECDSA() *stdecdsa.PrivateKey

ToECDSA returns the ecdsa representation of this private key

func (*PrivateKey) UnmarshalJSON

func (k *PrivateKey) UnmarshalJSON(b []byte) error

func (*PrivateKey) UnmarshalText

func (k *PrivateKey) UnmarshalText(text []byte) error

type PublicKey

type PublicKey struct {
	// contains filtered or unexported fields
}

func (*PublicKey) Address

func (k *PublicKey) Address() ids.ShortID

func (*PublicKey) Bytes

func (k *PublicKey) Bytes() []byte

func (*PublicKey) ToECDSA

func (k *PublicKey) ToECDSA() *stdecdsa.PublicKey

ToECDSA returns the ecdsa representation of this public key

func (*PublicKey) Verify

func (k *PublicKey) Verify(msg, sig []byte) bool

func (*PublicKey) VerifyHash

func (k *PublicKey) VerifyHash(hash, sig []byte) bool

Jump to

Keyboard shortcuts

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