Documentation ¶
Index ¶
Constants ¶
const MessageLength = 32
MessageLength is the fixed Message Length
const PrivateKeyLength = 32
PrivateKeyLength is the fixed Private Key Length
const SignatureLength = 64
SignatureLength is the fixed Signature Length
const SignatureLengthRecovery = 65
SignatureLengthRecovery is the length of a secp256k1 signature with recovery byte (used for ecrecover)
Variables ¶
This section is empty.
Functions ¶
func RecoverPublicKey ¶ added in v0.3.0
RecoverPublicKey returns the 64-byte uncompressed public key that created the given signature.
func RecoverPublicKeyCompressed ¶ added in v0.3.2
RecoverPublicKeyCompressed returns the 33-byte compressed public key that signed the given message.
func VerifySignature ¶ added in v0.7.0
VerifySignature verifies a signature given a public key and a message
Types ¶
type Keypair ¶
type Keypair struct {
// contains filtered or unexported fields
}
Keypair holds the pub,pk keys
func GenerateKeypair ¶
GenerateKeypair will generate a Keypair
func NewKeypair ¶
func NewKeypair(pk ecdsa.PrivateKey) *Keypair
NewKeypair will returned a Keypair from a PrivateKey
func NewKeypairFromPrivate ¶
func NewKeypairFromPrivate(priv *PrivateKey) (*Keypair, error)
NewKeypairFromPrivate will return a Keypair for a PrivateKey
func NewKeypairFromPrivateKeyString ¶ added in v0.2.0
NewKeypairFromPrivateKeyString returns a Keypair given a 0x prefixed private key string
type PrivateKey ¶
type PrivateKey struct {
// contains filtered or unexported fields
}
PrivateKey struct for PrivateKey
func NewPrivateKey ¶
func NewPrivateKey(in []byte) (*PrivateKey, error)
NewPrivateKey will return a PrivateKey for a []byte
type PublicKey ¶
type PublicKey struct {
// contains filtered or unexported fields
}
PublicKey struct for PublicKey
func (*PublicKey) UnmarshalPubkey ¶ added in v0.3.0
UnmarshalPubkey converts [65]byte to a secp256k1 public key.