Documentation ¶
Overview ¶
Package gpgagent interacts with the local GPG Agent.
Index ¶
- Constants
- Variables
- func AddRecipientAction(c *cli.Context)
- func AddRecipientCommand() cli.Command
- func AskPassword() cli.BoolFlag
- func CreateAction(c *cli.Context)
- func CreateCommand() cli.Command
- func CreateStoreFile(path string, opts *crypto.Options, meta *Meta) (err error)
- func DelAction(c *cli.Context)
- func DelCommand() cli.Command
- func DownloadUsingGist(dsn *dsn.Dsn) (err error)
- func DownloadUsingS3(dsn *dsn.Dsn) error
- func DownloadUsingScp(dsn *dsn.Dsn, privateKey string) (err error)
- func ExportAction(c *cli.Context)
- func ExportCommand() cli.Command
- func FileFlag() cli.StringFlag
- func GetAction(c *cli.Context)
- func GetCommand() cli.Command
- func GetGpgPassphrase(gpgId string) (string, error)
- func GetPassphrase() (passphrase string)
- func ImportAction(c *cli.Context)
- func ImportCommand() cli.Command
- func ImportStore(src, dest *Store, strategy ImportStrategy) error
- func KeysAction(c *cli.Context)
- func KeysCommand() cli.Command
- func MetaAction(c *cli.Context)
- func MetaCommand() cli.Command
- func OverwriteFlag() cli.BoolFlag
- func PromptForPassword() string
- func PullAction(c *cli.Context)
- func PullCommand() cli.Command
- func PushAction(c *cli.Context)
- func PushCommand() cli.Command
- func RemoveRecipientAction(c *cli.Context)
- func RemoveRecipientCommand() cli.Command
- func SetAction(c *cli.Context)
- func SetCommand() cli.Command
- func ShowAction(c *cli.Context)
- func ShowCommand() cli.Command
- func SshPrivateKeyPathFlag() cli.StringFlag
- func TheirsFlag() cli.BoolFlag
- func VerboseFlag() cli.BoolFlag
- func YesFlag() cli.StringFlag
- func YoursFlag() cli.BoolFlag
- type Conn
- type DataStore
- func (ds *DataStore) Del(key string) error
- func (ds *DataStore) FromJson(jsonData []byte) error
- func (ds *DataStore) Get(key string) (interface{}, error)
- func (ds *DataStore) Items() ([]KVPair, error)
- func (ds *DataStore) Keys() ([]string, error)
- func (ds *DataStore) Set(key string, value interface{}) error
- func (ds *DataStore) ToJson() (string, error)
- type Encodable
- type ImportStrategy
- type KVPair
- type KVStore
- type Meta
- type PassphraseRequest
- type RawFormatter
- type Store
Constants ¶
const ( CONFIG_KEY_RECIPIENTS = "recipients" CONFIG_KEY_PASSWORD = "password" )
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" )
const ( IMPORT_YOURS = 0x0 IMPORT_THEIRS = 0x1 IMPORT_OVERWRITE = 0x2 )
Import strategies enumeration
const (
DEFAULT_STORE_FILENAME = ".trousseau"
)
const TROUSSEAU_VERSION = "0.3.0"
Variables ¶
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") )
var Logger = logrus.New()
Functions ¶
func AddRecipientAction ¶
func AddRecipientCommand ¶
func AskPassword ¶
func CreateAction ¶
func CreateCommand ¶
func CreateStoreFile ¶
CreateStoreFile creates a trousseau file at $HOME/.trousseau
func DelCommand ¶
func DownloadUsingGist ¶
downloadUsingGist executes the whole process of pulling the trousseau data store file from gist remote storage using the provided scheme informations.
func DownloadUsingS3 ¶
downloadUsingS3 executes the whole process of pulling the trousseau data store file from s3 remote storage using the provided environment.
func DownloadUsingScp ¶
downloadUsingScp executes the whole process of pulling the trousseau data store file from scp remote storage using the provided environment.
func ExportAction ¶
func ExportCommand ¶
func FileFlag ¶
func FileFlag() cli.StringFlag
func GetCommand ¶
func GetGpgPassphrase ¶
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 ImportCommand ¶
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 KeysCommand ¶
func MetaAction ¶
func MetaCommand ¶
func OverwriteFlag ¶
func PromptForPassword ¶
func PromptForPassword() string
func PullAction ¶
func PullCommand ¶
func PushAction ¶
func PushCommand ¶
func RemoveRecipientAction ¶
func RemoveRecipientCommand ¶
func SetCommand ¶
func ShowAction ¶
func ShowCommand ¶
func SshPrivateKeyPathFlag ¶
func SshPrivateKeyPathFlag() cli.StringFlag
func TheirsFlag ¶
func VerboseFlag ¶
func YesFlag ¶
func YesFlag() cli.StringFlag
Types ¶
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn is a connection to the GPG agent.
func NewGpgAgentConn ¶
NewGpgAgentConn connects to the GPG Agent as described in the GPG_AGENT_INFO environment variable.
func (*Conn) GetPassphrase ¶
func (c *Conn) GetPassphrase(pr *PassphraseRequest) (passphrase string, outerr error)
func (*Conn) RemoveFromCache ¶
type DataStore ¶
type DataStore struct { KVStore Meta Meta `json:"_meta"` Container map[string]interface{} `json:"data"` }
func NewDataStore ¶
func NewDataStore() *DataStore
type ImportStrategy ¶
type ImportStrategy uint32
func (*ImportStrategy) FromCliContext ¶
func (s *ImportStrategy) FromCliContext(c *cli.Context) 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 (*Meta) RemoveRecipient ¶
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