keys

package
v4.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ECKind

type ECKind string

ECKind is the key type

const (
	// Ed25519 https://tools.ietf.org/html/rfc8032
	Ed25519 ECKind = "Ed25519"
	// Secp256k1 https://tools.ietf.org/html/rfc4492
	Secp256k1 ECKind = "Secp256k1"
	// NistP256 https://tools.ietf.org/html/rfc5656
	NistP256 ECKind = "NistP256"
)

type Key

type Key struct {
	PubKey PubKey
	// contains filtered or unexported fields
}

Key is the cryptographic key to a Tezos Wallet

func FromBase58

func FromBase58(privKey string, kind ECKind) (*Key, error)

FromBase58 returns a new key from a private key in base58 form

func FromBase64

func FromBase64(privKey string, kind ECKind) (*Key, error)

FromBase64 returns a new key from a private key in base64 form

func FromBytes

func FromBytes(privKey []byte, kind ECKind) (*Key, error)

FromBytes returns a new key from a private key in byte form

func FromEncryptedSecret

func FromEncryptedSecret(esk, passwd string) (*Key, error)

FromEncryptedSecret returns a new key from an encrypted private key

func FromHex

func FromHex(privKey string, kind ECKind) (*Key, error)

FromHex returns a new key from a private key in hex form

func FromMnemonic

func FromMnemonic(mnemonic, email, passwd string, kind ECKind) (*Key, error)

FromMnemonic returns a new key from a mnemonic

func Generate

func Generate(kind ECKind) (*Key, error)

Generate returns a new cryptographic key based on the kind of elliptical curve passed

  • Ed25519
  • Secp256k1
  • NistP256

func (*Key) GetBytes

func (k *Key) GetBytes() []byte

GetBytes will return the raw bytes of the private key.

func (*Key) GetSecretKey

func (k *Key) GetSecretKey() string

GetSecretKey will return the base58 encoded key with the secret key prefix. This is unencrypted. Example: edskRpfRbhVr7SjmVpMK1kzTDrSzuCKroxjQAsfJn94X7LgbpqJLvRDHfNHFT9KbCZAXVVhMmkQGz4APscezMbJFov5ZNPSY9H

func (*Key) SignBytes

func (k *Key) SignBytes(msg []byte) (Signature, error)

SignBytes will sign a byte message

func (*Key) SignHex

func (k *Key) SignHex(msg string) (Signature, error)

SignHex will sign a hex encoded string

type PubKey

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

PubKey is the public key to a Tezos Wallet

func (*PubKey) GetAddress

func (p *PubKey) GetAddress() string

GetAddress will public key hash (address) of the public key. Example:

tz1L8fUQLuwRuywTZUP5JUw9LL3kJa8LMfoo

func (*PubKey) GetBytes

func (p *PubKey) GetBytes() []byte

GetBytes will return the raw bytes of the public key

func (*PubKey) GetPublicKey

func (p *PubKey) GetPublicKey() string

GetPublicKey will return the base58 encoded key with the private key prefix. Example:

edskRpfRbhVr7SjmVpMK1kzTDrSzuCKroxjQAsfJn94X7LgbpqJLvRDHfNHFT9KbCZAXVVhMmkQGz4APscezMbJFov5ZNPSY9H

type Signature

type Signature struct {
	Bytes []byte
	// contains filtered or unexported fields
}

Signature represents the signature of an operation

func (*Signature) AppendToBytes

func (s *Signature) AppendToBytes(msg []byte) []byte

AppendToBytes takes a bytes message and adds the signature to it for injection

func (*Signature) AppendToHex

func (s *Signature) AppendToHex(msg string) string

AppendToHex takes a hex encoded message and adds the signature to it for injection

func (*Signature) ToBase58

func (s *Signature) ToBase58() string

ToBase58 returns the signature as a base58 encoded string with the correct prefix

func (*Signature) ToBytes

func (s *Signature) ToBytes() []byte

ToBytes returns the signature as bytes

func (*Signature) ToHex

func (s *Signature) ToHex() string

ToHex returns the signature encoded to hex

Jump to

Keyboard shortcuts

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