keypair

package
v0.0.0-...-5c1e2d0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2018 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateKeys

func GenerateKeys() (publicKey, privateKey string)

func GenerateKeysDeterministic

func GenerateKeysDeterministic(seedBytes []byte) (publicKey, privateKey string)

Types

type KeyPair

type KeyPair struct {
	Public  string `json:"public"`
	Private string `json:"private,omitempty"`
	// contains filtered or unexported fields
}

func FromPair

func FromPair(public, private string) (kp KeyPair, err error)

func FromPublic

func FromPublic(public string) (kp KeyPair, err error)

FromPublic generates a half-key pair

func New

func New() (kp KeyPair)

func NewDeterministic

func NewDeterministic(passphrase string) (kp KeyPair)

func (KeyPair) Decrypt

func (kp KeyPair) Decrypt(encrypted []byte, sender KeyPair) (msg []byte, err error)

func (KeyPair) Encrypt

func (kp KeyPair) Encrypt(msg []byte, recipient KeyPair) (encrypted []byte, err error)

func (KeyPair) Hash

func (kp KeyPair) Hash() string

func (KeyPair) MarshalJSON

func (kp KeyPair) MarshalJSON() ([]byte, error)

func (KeyPair) PublicKey

func (kp KeyPair) PublicKey() (kpPublic KeyPair)

func (KeyPair) Signature

func (kp KeyPair) Signature(regionkey KeyPair) (signature string, err error)

Signature returns your public key encrypted by a shared region key. Anyone who has the shared region key can decrypt this and see that the contents do indeed match that public key used to make it.

func (*KeyPair) UnmarshalJSON

func (kp *KeyPair) UnmarshalJSON(b []byte) (err error)

func (KeyPair) Validate

func (kp KeyPair) Validate(signature string, sender KeyPair) (err error)

Validate using the specified keypair (usually should be shared region key)

type KeyPairJSON

type KeyPairJSON struct {
	Public  string
	Private string
}

Jump to

Keyboard shortcuts

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