identity

package
v0.2.4-rc1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2020 License: Apache-2.0 Imports: 12 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadSeed

func LoadSeed(path string) ([]byte, error)

LoadSeed from path

func NewManager

func NewManager(path string) (pkg.IdentityManager, error)

NewManager creates an identity daemon from seed The daemon will auto generate a new seed if the path does not exist

Types

type KeyPair

type KeyPair struct {
	PrivateKey ed25519.PrivateKey
	PublicKey  ed25519.PublicKey
}

KeyPair holds a public and private side of an ed25519 key pair

func FromSeed

func FromSeed(seed []byte) (pair KeyPair, err error)

FromSeed creates a new key pair from seed

func GenerateKeyPair

func GenerateKeyPair() (k KeyPair, err error)

GenerateKeyPair creates a new KeyPair from a random seed

func LoadKeyPair

func LoadKeyPair(path string) (k KeyPair, err error)

LoadKeyPair reads a seed from a file located at path and re-create a KeyPair using the seed

func LoadLegacyKeyPair

func LoadLegacyKeyPair(path string) (k KeyPair, err error)

LoadLegacyKeyPair load keypair without deprecated message for converted

func (KeyPair) Identity

func (k KeyPair) Identity() string

Identity implements the Identifier interface

func (*KeyPair) Save

func (k *KeyPair) Save(path string) error

Save saves the seed of a key pair in a file located at path

type UserIdentity

type UserIdentity struct {
	// Mnemonic words of Private Key
	Mnemonic string `json:"mnemonic"`
	// ThreebotID generated by explorer
	ThreebotID uint64 `json:"threebotid"`
	// contains filtered or unexported fields
}

UserIdentity defines serializable struct to identify a user

func NewUserIdentity

func NewUserIdentity(key KeyPair, threebotid uint64) *UserIdentity

NewUserIdentity create a new UserIdentity from existing key

func (*UserIdentity) FromMnemonic

func (u *UserIdentity) FromMnemonic(mnemonic string) error

FromMnemonic initialize the Key (KeyPair) from mnemonic argument

func (*UserIdentity) Key

func (u *UserIdentity) Key() KeyPair

Key returns the internal KeyPair

func (*UserIdentity) Load

func (u *UserIdentity) Load(path string) error

Load fetch a seed file and initialize key based on mnemonic

func (*UserIdentity) Save

func (u *UserIdentity) Save(path string) error

Save dumps UserIdentity into a versioned file

Jump to

Keyboard shortcuts

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