Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetConfigPaths ¶
GetConfigPaths returns the paths for the contifuration file and the accountDir.
func GuessPromptFunction ¶
func GuessPromptFunction() openpgp.PromptFunction
GuessPromptFunction is a function that returns an openpgp.PromptFunction well suited for the context.
func NewPassword ¶
NewPassword return a randomly generated password of the requested length
Types ¶
type Account ¶
type Account struct { Name string Username string Password string Notes string // The following fields are valued when the account is read. IsSigned bool SignedBy *openpgp.Key // the key of the signer, if available // contains filtered or unexported fields }
Account represents an Account
func NewAccountFromConsole ¶
NewAccountFromConsole returns an Account built with the elements collected by interacting with the user.
func NewAccountFromFile ¶
NewAccountFromFile returns an Account as described by a file in the accountDir.
func NewAccountFromReader ¶
NewAccountFromReader returns an account with the provided element. The reader is expected to returns bytes int the appropriate format :
- []byte(password\nusername\nnotes)
type Config ¶
type Config struct { SecringDir string PubringDir string AccountDir string RecipientKeyIds string SignerKeyID string PromptFunction openpgp.PromptFunction }
Config represents the configuration required to work with GPG.
func NewConfig ¶
NewConfig returns an initialized Config with the information copied from a Profile. If nil Profile is passed we build one from DefaultProfile.
func (*Config) EntityListRecipients ¶
func (c *Config) EntityListRecipients() (openpgp.EntityList, error)
EntityListRecipients returns the openpgp.EntityList corresponding to the RecipientKeyIds from the Config.
func (*Config) EntityListWithSecretKey ¶
func (c *Config) EntityListWithSecretKey() (openpgp.EntityList, error)
EntityListWithSecretKey returns the openpgp.EntityList contains in Secring.
func (*Config) EntitySigner ¶
EntitySigner returns an Entity with a decrypted Private Key.
type Profile ¶
type Profile struct { Name string SecringDir string PubringDir string AccountDir string RecipientKeyIds string SignerKeyID string }
Profile represents the information that can be persited to disk of a Config.
func DefaultProfile ¶
func DefaultProfile() *Profile
DefaultProfile returns the a Profile with customized information for a user.
type ProfileStore ¶
type ProfileStore []Profile
ProfileStore is type alias that we used to store Profile in the configuration file.
func LoadProfileStore ¶
func LoadProfileStore() (ProfileStore, error)
LoadProfileStore returns the ProfileStore with the information found in the configuration file.