Documentation ¶
Index ¶
- Constants
- Variables
- func AddRecipientAction(recipient string) error
- func AskPassphrase(confirm bool)
- func AskPassphraseFlagCheck() bool
- func CreateAction(ct CryptoType, ca CryptoAlgorithm, recipients []string) error
- func DelAction(key string) error
- func DiscoverVersion(d []byte, mapping map[string]VersionMatcher) string
- func DownloadUsingGist(dsn *dsn.Dsn) (err error)
- func DownloadUsingS3(dsn *dsn.Dsn) error
- func DownloadUsingScp(dsn *dsn.Dsn, privateKey string) (err error)
- func ExportAction(destination io.Writer, plain bool) error
- func GetAction(key string, filepath string) error
- func GetPassphrase() (passphrase string, err error)
- func GetStorePath() string
- func ImportAction(source io.Reader, strategy ImportStrategy, plain bool) error
- func ImportStore(src, dest *store.Store, strategy ImportStrategy) error
- func InferStorePath() string
- func KeysAction() error
- func ListRecipientsAction() error
- func MetaAction() error
- func PathExists(path string) bool
- func PromptForHiddenInput(msg string) string
- func PromptForHiddenInputConfirm() string
- func PullAction(source string, sshPrivateKey string, askPassword bool) error
- func PushAction(destination string, sshPrivateKey string, askPassword bool) error
- func RemoveRecipientAction(recipient string) error
- func RenameAction(src, dest string, overwrite bool) error
- func SetAction(key, value, file string) error
- func SetAsked()
- func SetPassphrase(p string)
- func SetStorePath(storePath string)
- func ShowAction() error
- func UpgradeAction(yes, noBackup bool) error
- func UpgradeFrom(startVersion string, d []byte, mapping map[string]UpgradeClosure) ([]byte, error)
- func UploadUsingGist(dsn *dsn.Dsn) (err error)
- func UploadUsingS3(dsn *dsn.Dsn) error
- func UploadUsingScp(dsn *dsn.Dsn, privateKey string) (err error)
- type CryptoAlgorithm
- type CryptoType
- type ImportStrategy
- type Trousseau
- type UpgradeClosure
- type VersionMatcher
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 ( SYMMETRIC_ENCRYPTION CryptoType = 0 ASYMMETRIC_ENCRYPTION CryptoType = 1 SYMMETRIC_ENCRYPTION_REPR string = "symmetric" ASYMMETRIC_ENCRYPTION_REPR string = "asymmetric" )
const ( GPG_ENCRYPTION CryptoAlgorithm = 0 AES_256_ENCRYPTION CryptoAlgorithm = 1 GPG_ENCRYPTION_REPR string = "gpg" AES_256_ENCRYPTION_REPR string = "aes256" )
const (
DEFAULT_STORE_FILENAME = ".trousseau"
)
const TROUSSEAU_VERSION = "0.4.0"
Variables ¶
var ( S3Defaults map[string]string = map[string]string{ "Path": "trousseau.tsk", } ScpDefaults map[string]string = map[string]string{ "Id": os.Getenv("USER"), "Port": "22", "Path": "trousseau.tsk", } )
Global variables defining default values for S3 and scp uploads/downloads
var ErrorLogger = log.New(os.Stderr, "Error: ", 0)
var GnupgHome = path.Join(os.Getenv("HOME"), ".gnupg")
Gnupg variables
var GnupgPubring func() string = func() string { return path.Join(GnupgHome, "pubring.gpg") }
var GnupgSecring func() string = func() string { return path.Join(GnupgHome, "secring.gpg") }
var InfoLogger = log.New(os.Stdout, "", 0)
var UpgradeClosures map[string]UpgradeClosure = map[string]UpgradeClosure{
"0.3.0": upgradeZeroDotThreeToNext,
}
var VersionDiscoverClosures map[string]VersionMatcher = map[string]VersionMatcher{
"0.3.0": isVersionZeroDotThreeDotZero,
"0.3.1": isVersionZeroDotThreeDotOne,
}
Functions ¶
func AddRecipientAction ¶
func AskPassphrase ¶
func AskPassphrase(confirm bool)
func AskPassphraseFlagCheck ¶
func AskPassphraseFlagCheck() bool
func CreateAction ¶
func CreateAction(ct CryptoType, ca CryptoAlgorithm, recipients []string) error
func DiscoverVersion ¶
func DiscoverVersion(d []byte, mapping map[string]VersionMatcher) string
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 GetPassphrase ¶
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 GetStorePath ¶
func GetStorePath() string
func ImportAction ¶
func ImportAction(source io.Reader, strategy ImportStrategy, plain bool) error
func ImportStore ¶
func ImportStore(src, dest *store.Store, strategy ImportStrategy) error
ImportStore imports the src encrypted data store content into dest data store, respecting the provided import strategy.
func InferStorePath ¶
func InferStorePath() string
func KeysAction ¶
func KeysAction() error
func ListRecipientsAction ¶
func ListRecipientsAction() error
func MetaAction ¶
func MetaAction() error
func PathExists ¶
exists returns whether the given file or directory exists or not
func PromptForHiddenInput ¶
PromptForHiddenInput will prompt on stdin with the provided message and will hide the user input. This is intended to be used to ask the user for password or passphrase
func PromptForHiddenInputConfirm ¶
func PromptForHiddenInputConfirm() string
func RemoveRecipientAction ¶
func RenameAction ¶
func SetPassphrase ¶
func SetPassphrase(p string)
func SetStorePath ¶
func SetStorePath(storePath string)
func ShowAction ¶
func ShowAction() error
func UpgradeAction ¶
func UpgradeFrom ¶
func UploadUsingGist ¶
uploadUsingGist executes the whole process of pushing the trousseau data store file to gist remote storage using the provided dsn informations.
func UploadUsingS3 ¶
uploadUsingS3 executes the whole process of pushing the trousseau data store file to s3 remote storage using the provided environment.
Types ¶
type ImportStrategy ¶
type ImportStrategy uint32
func (*ImportStrategy) FromCliContext ¶
func (s *ImportStrategy) FromCliContext(c *cli.Context) error
TODO : remove
type Trousseau ¶
type Trousseau struct { // Crypto public configuration attributes CryptoType CryptoType `json:"crypto_type"` CryptoAlgorithm CryptoAlgorithm `json:"crypto_algorithm"` // Encrypted data private attribute Data []byte `json:"_data"` // contains filtered or unexported fields }