trousseau

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2019 License: MIT Imports: 24 Imported by: 0

Documentation

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 (
	SYMMETRIC_ENCRYPTION  CryptoType = 0
	ASYMMETRIC_ENCRYPTION CryptoType = 1

	SYMMETRIC_ENCRYPTION_REPR  string = "symmetric"
	ASYMMETRIC_ENCRYPTION_REPR string = "asymmetric"
)
View Source
const (
	GPG_ENCRYPTION     CryptoAlgorithm = 0
	AES_256_ENCRYPTION CryptoAlgorithm = 1

	GPG_ENCRYPTION_REPR     string = "gpg"
	AES_256_ENCRYPTION_REPR string = "aes256"
)
View Source
const (
	DEFAULT_STORE_FILENAME = ".trousseau"
)
View Source
const TROUSSEAU_VERSION = "0.4.0"

Variables

View Source
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

View Source
var ErrorLogger = log.New(os.Stderr, "Error: ", 0)
View Source
var GnupgHome = path.Join(os.Getenv("HOME"), ".gnupg")

Gnupg variables

View Source
var GnupgPubring func() string = func() string { return path.Join(GnupgHome, "pubring.gpg") }
View Source
var GnupgSecring func() string = func() string { return path.Join(GnupgHome, "secring.gpg") }
View Source
var InfoLogger = log.New(os.Stdout, "", 0)
View Source
var UpgradeClosures map[string]UpgradeClosure = map[string]UpgradeClosure{
	"0.3.0": upgradeZeroDotThreeToNext,
}
View Source
var VersionDiscoverClosures map[string]VersionMatcher = map[string]VersionMatcher{
	"0.3.0": isVersionZeroDotThreeDotZero,
	"0.3.1": isVersionZeroDotThreeDotOne,
}

Functions

func AddRecipientAction

func AddRecipientAction(recipient string) error

func AskPassphrase

func AskPassphrase(confirm bool)

func AskPassphraseFlagCheck

func AskPassphraseFlagCheck() bool

func CreateAction

func CreateAction(ct CryptoType, ca CryptoAlgorithm, recipients []string) error

func DelAction

func DelAction(key string) error

func DiscoverVersion

func DiscoverVersion(d []byte, mapping map[string]VersionMatcher) string

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(destination io.Writer, plain bool) error

func GetAction

func GetAction(key string, filepath string) error

func GetPassphrase

func GetPassphrase() (passphrase string, err error)

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

func PathExists(path string) bool

exists returns whether the given file or directory exists or not

func PromptForHiddenInput

func PromptForHiddenInput(msg string) string

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 PullAction

func PullAction(source string, sshPrivateKey string, askPassword bool) error

func PushAction

func PushAction(destination string, sshPrivateKey string, askPassword bool) error

func RemoveRecipientAction

func RemoveRecipientAction(recipient string) error

func RenameAction

func RenameAction(src, dest string, overwrite bool) error

func SetAction

func SetAction(key, value, file string) error

func SetAsked

func SetAsked()

func SetPassphrase

func SetPassphrase(p string)

func SetStorePath

func SetStorePath(storePath string)

func ShowAction

func ShowAction() error

func UpgradeAction

func UpgradeAction(yes, noBackup bool) error

func UpgradeFrom

func UpgradeFrom(startVersion string, d []byte, mapping map[string]UpgradeClosure) ([]byte, error)

func UploadUsingGist

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

uploadUsingGist executes the whole process of pushing the trousseau data store file to gist remote storage using the provided dsn informations.

func UploadUsingS3

func UploadUsingS3(dsn *dsn.Dsn) error

uploadUsingS3 executes the whole process of pushing the trousseau data store file to s3 remote storage using the provided environment.

func UploadUsingScp

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

uploadUsingScp executes the whole process of pushing the trousseau data store file to scp remote storage using the provided environment.

Types

type CryptoAlgorithm

type CryptoAlgorithm int

Declare available encryption algorithms

type CryptoType

type CryptoType int

Declare encryption 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
}

func FromBytes

func FromBytes(d []byte) (*Trousseau, error)

func OpenTrousseau

func OpenTrousseau(fp string) (*Trousseau, error)

func (*Trousseau) Decrypt

func (t *Trousseau) Decrypt() (*store.Store, error)

func (*Trousseau) Encrypt

func (t *Trousseau) Encrypt(store *store.Store) error

func (*Trousseau) Write

func (t *Trousseau) Write(fp string) error

type UpgradeClosure

type UpgradeClosure func([]byte) ([]byte, error)

type VersionMatcher

type VersionMatcher func([]byte) bool

Jump to

Keyboard shortcuts

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