trousseau

package
v0.0.0-...-ffa7171 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2014 License: MIT Imports: 26 Imported by: 0

Documentation

Overview

Package gpgagent interacts with the local GPG Agent.

Index

Constants

View Source
const (
	CONFIG_KEY_RECIPIENTS = "recipients"
	CONFIG_KEY_PASSWORD   = "password"
)
View Source
const (
	ENV_TROUSSEAU_STORE     = "TROUSSEAU_STORE"
	ENV_PASSPHRASE_KEY      = "TROUSSEAU_PASSPHRASE"
	ENV_KEYRING_SERVICE_KEY = "TROUSSEAU_KEYRING_SERVICE"
	ENV_KEYRING_USER_KEY    = "USER"
	ENV_MASTER_GPG_ID_KEY   = "TROUSSEAU_MASTER_GPG_ID"
	ENV_SSH_PRIVATE_KEY     = "TROUSSEAU_PRIVATE_KEY"
)
View Source
const (
	IMPORT_YOURS     = 0x0
	IMPORT_THEIRS    = 0x1
	IMPORT_OVERWRITE = 0x2
)

Import strategies enumeration

View Source
const (
	DEFAULT_STORE_FILENAME = ".trousseau"
)
View Source
const TROUSSEAU_VERSION = "0.3.0"

Variables

View Source
var (
	ErrNoAgent = errors.New("GPG_AGENT_INFO not set in environment")
	ErrNoData  = errors.New("GPG_ERR_NO_DATA cache miss")
	ErrCancel  = errors.New("gpgagent: Cancel")
)
View Source
var Logger = logrus.New()

Functions

func AddRecipientAction

func AddRecipientAction(c *cli.Context)

func AddRecipientCommand

func AddRecipientCommand() cli.Command

func AskPassword

func AskPassword() cli.BoolFlag

func CreateAction

func CreateAction(c *cli.Context)

func CreateCommand

func CreateCommand() cli.Command

func CreateStoreFile

func CreateStoreFile(path string, opts *crypto.Options, meta *Meta) (err error)

CreateStoreFile creates a trousseau file at $HOME/.trousseau

func DelAction

func DelAction(c *cli.Context)

func DelCommand

func DelCommand() cli.Command

func DownloadUsingGist

func DownloadUsingGist(dsn *dsn.Dsn) (err error)

downloadUsingGist executes the whole process of pulling the trousseau data store file from gist remote storage using the provided scheme informations.

func DownloadUsingS3

func DownloadUsingS3(dsn *dsn.Dsn) error

downloadUsingS3 executes the whole process of pulling the trousseau data store file from s3 remote storage using the provided environment.

func DownloadUsingScp

func DownloadUsingScp(dsn *dsn.Dsn, privateKey string) (err error)

downloadUsingScp executes the whole process of pulling the trousseau data store file from scp remote storage using the provided environment.

func ExportAction

func ExportAction(c *cli.Context)

func ExportCommand

func ExportCommand() cli.Command

func FileFlag

func FileFlag() cli.StringFlag

func GetAction

func GetAction(c *cli.Context)

func GetCommand

func GetCommand() cli.Command

func GetGpgPassphrase

func GetGpgPassphrase(gpgId string) (string, error)

func GetPassphrase

func GetPassphrase() (passphrase string)

GetPassphrase attemps to retrieve the user's gpg master key passphrase using multiple methods. First it will attempt to retrieve it from the environment, then it will try to fetch it from the system keyring manager, ultimately it will try to get it from a running gpg-agent daemon.

func ImportAction

func ImportAction(c *cli.Context)

func ImportCommand

func ImportCommand() cli.Command

func ImportStore

func ImportStore(src, dest *Store, strategy ImportStrategy) error

ImportStore imports the src encrypted data store content into dest data store, respecting the provided import strategy.

func KeysAction

func KeysAction(c *cli.Context)

func KeysCommand

func KeysCommand() cli.Command

func MetaAction

func MetaAction(c *cli.Context)

func MetaCommand

func MetaCommand() cli.Command

func OverwriteFlag

func OverwriteFlag() cli.BoolFlag

func PromptForPassword

func PromptForPassword() string

func PullAction

func PullAction(c *cli.Context)

func PullCommand

func PullCommand() cli.Command

func PushAction

func PushAction(c *cli.Context)

func PushCommand

func PushCommand() cli.Command

func RemoveRecipientAction

func RemoveRecipientAction(c *cli.Context)

func RemoveRecipientCommand

func RemoveRecipientCommand() cli.Command

func SetAction

func SetAction(c *cli.Context)

func SetCommand

func SetCommand() cli.Command

func ShowAction

func ShowAction(c *cli.Context)

func ShowCommand

func ShowCommand() cli.Command

func SshPrivateKeyPathFlag

func SshPrivateKeyPathFlag() cli.StringFlag

func TheirsFlag

func TheirsFlag() cli.BoolFlag

func VerboseFlag

func VerboseFlag() cli.BoolFlag

func YesFlag

func YesFlag() cli.StringFlag

func YoursFlag

func YoursFlag() cli.BoolFlag

Types

type Conn

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

Conn is a connection to the GPG agent.

func NewGpgAgentConn

func NewGpgAgentConn() (*Conn, error)

NewGpgAgentConn connects to the GPG Agent as described in the GPG_AGENT_INFO environment variable.

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) GetPassphrase

func (c *Conn) GetPassphrase(pr *PassphraseRequest) (passphrase string, outerr error)

func (*Conn) RemoveFromCache

func (c *Conn) RemoveFromCache(cacheKey string) error

type DataStore

type DataStore struct {
	KVStore
	Meta      Meta                   `json:"_meta"`
	Container map[string]interface{} `json:"data"`
}

func NewDataStore

func NewDataStore() *DataStore

func (*DataStore) Del

func (ds *DataStore) Del(key string) error

DelStoreKey deletes a key value pair from the trousseau file

func (*DataStore) FromJson

func (ds *DataStore) FromJson(jsonData []byte) error

func (*DataStore) Get

func (ds *DataStore) Get(key string) (interface{}, error)

GetStoreKey fetches a key from the trousseau file store

func (*DataStore) Items

func (ds *DataStore) Items() ([]KVPair, error)

func (*DataStore) Keys

func (ds *DataStore) Keys() ([]string, error)

ListStoreKeys lists the keys contained in the trousseau store file

func (*DataStore) Set

func (ds *DataStore) Set(key string, value interface{}) error

SetStoreKey sets a key value pair in the store

func (*DataStore) ToJson

func (ds *DataStore) ToJson() (string, error)

type Encodable

type Encodable interface {
	FromJson([]byte) error
	ToJson() ([]byte, error)
}

type ImportStrategy

type ImportStrategy uint32

func (*ImportStrategy) FromCliContext

func (s *ImportStrategy) FromCliContext(c *cli.Context) error

type KVPair

type KVPair struct {
	Key   string
	Value interface{}
}

func NewKVPair

func NewKVPair(key string, value interface{}) *KVPair

type KVStore

type KVStore interface {
	Get(string) (interface{}, error)
	Set(string, interface{}) error
	Del(string) error
	Keys() ([]string, error)
	Items() ([]KVPair, error)
}

type Meta

type Meta struct {
	CreatedAt        string   `json:"created_at"`
	LastModifiedAt   string   `json:"last_modified_at"`
	Recipients       []string `json:"recipients"`
	TrousseauVersion string   `json:"version"`
}

func (*Meta) AddRecipient

func (m *Meta) AddRecipient(recipient string) error

func (*Meta) RemoveRecipient

func (m *Meta) RemoveRecipient(recipient string) error

type PassphraseRequest

type PassphraseRequest struct {
	CacheKey, Error, Prompt, Desc string

	// If the option --no-ask is used and the passphrase is not in
	// the cache the user will not be asked to enter a passphrase
	// but the error code GPG_ERR_NO_DATA is returned.  (ErrNoData)
	NoAsk bool
}

PassphraseRequest is a request to get a passphrase from the GPG Agent.

type RawFormatter

type RawFormatter struct{}

func (*RawFormatter) AppendKeyValue

func (f *RawFormatter) AppendKeyValue(serialized []byte, key, value interface{}) []byte

func (*RawFormatter) Format

func (f *RawFormatter) Format(entry *logrus.Entry) ([]byte, error)

type Store

type Store struct {
	*DataStore
	// contains filtered or unexported fields
}

func LoadStore

func LoadStore(path string, opts *crypto.Options) (*Store, error)

LoadStore reads and decrypt a trousseau data store from the provided path, using the provided encryption options.

func NewStore

func NewStore(path string, encryptionOpts *crypto.Options) *Store

func (*Store) Metadata

func (s *Store) Metadata() ([]KVPair, error)

func (*Store) Sync

func (s *Store) Sync() error

Sync encrypts the store content and writes it to the disk

Jump to

Keyboard shortcuts

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