store

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2019 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultDirName = ".vcn"
View Source
const DirPerm os.FileMode = 0700

DirPerm holds permission bits that are used for all directories that store creates.

View Source
const FilePerm os.FileMode = 0600

FilePerm holds permission bits that are used for all files that store creates.

Variables

This section is empty.

Functions

func Config

func Config() *config

Config returns the global config instance

func ConfigFile

func ConfigFile() string

ConfigFile returns the config file path

func LoadConfig

func LoadConfig() error

LoadConfig loads the global configuration from file

func SaveConfig

func SaveConfig() error

SaveConfig stores the current configuration to file

func SetConfigFile

func SetConfigFile(filepath string)

SetConfigFile sets the config file path (e.g. ~/.vcn/config.json)

func SetDefaultDir

func SetDefaultDir() error

SetDefaultDir sets the default store working directory (eg. ~/.vcn)

func SetDir

func SetDir(p string)

SetDir sets the store working directory (eg. ~/.vcn)

Types

type Keystore

type Keystore struct {
	Path string `json:"path"`
}

Keystore holds the path of a user's keystore

func (Keystore) CreateKey

func (k Keystore) CreateKey(passphrase string) (pubKey string, err error)

CreateKey generates a new key and stores it into the Keystore directory, encrypting it with the passphrase.

type User

type User struct {
	Email     string      `json:"email"`
	Token     string      `json:"token"`
	Keystores []*Keystore `json:"keystores"`
}

User holds user configuration

func (*User) AddKeystore

func (u *User) AddKeystore(keydir string) (*Keystore, error)

AddKeystore adds a keystore dir to the User

func (*User) DefaultKeystore

func (u *User) DefaultKeystore() (*Keystore, error)

DefaultKeystore returns the default keystore

func (User) HasPubKey

func (u User) HasPubKey() bool

HasPubKey returns true if the User has at least one public key

func (User) LastPubKey

func (u User) LastPubKey() string

LastPubKey returns the last added User's public key

func (User) OpenKey

func (u User) OpenKey(pubKey string) (io.Reader, error)

OpenKey opens the named pubKey for reading

func (User) PubKeys

func (u User) PubKeys() []string

PubKeys returns all User's public keys found

Jump to

Keyboard shortcuts

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