pub

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: Unlicense Imports: 5 Imported by: 0

Documentation

Overview

Package pub is a wrapper around secp256k1 library from the Decred project to handle generate and serialise secp256k1 public keys, including deriving them from private keys.

Index

Constants

View Source
const (
	// KeyLen is the length of the serialized key. It is an ECDSA compressed
	// key.
	KeyLen = secp256k1.PubKeyBytesLenCompressed
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Bytes

type Bytes [KeyLen]byte

Bytes is the serialised form of a public key.

func (Bytes) Equals

func (pb Bytes) Equals(qb Bytes) bool

type Key

type Key secp256k1.PublicKey

Key is a public key.

func Derive

func Derive(prv *prv.Key) *Key

Derive generates a public key from the prv.Key.

func FromBytes

func FromBytes(b []byte) (pub *Key, e error)

FromBytes converts a byte slice into a public key, if it is valid and on the secp256k1 elliptic curve.

func (*Key) Equals

func (pub *Key) Equals(pub2 *Key) bool

Equals returns true if two public keys are the same.

func (*Key) ToBytes

func (pub *Key) ToBytes() (p Bytes)

ToBytes returns the compressed 33 byte form of the pubkey as used in wire and storage forms.

func (*Key) ToHex

func (pub *Key) ToHex() (s string, e error)

func (*Key) ToPublicKey

func (pub *Key) ToPublicKey() *secp256k1.PublicKey

Jump to

Keyboard shortcuts

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