Documentation ¶
Index ¶
- Variables
- func CryptoBackendName(cb CryptoBackend) string
- func CryptoBackends() []string
- func CryptoNameFromBackend(be CryptoBackend) string
- func HasCryptoBackend(ctx context.Context) bool
- func HasRCSBackend(ctx context.Context) bool
- func HasStorageBackend(ctx context.Context) bool
- func RCSBackendName(sb RCSBackend) string
- func RCSBackends() []string
- func RcsNameFromBackend(be RCSBackend) string
- func RegisterCrypto(id CryptoBackend, name string, loader CryptoLoader)
- func RegisterRCS(id RCSBackend, name string, loader RCSLoader)
- func RegisterStorage(id StorageBackend, name string, loader StorageLoader)
- func StorageBackendName(sb StorageBackend) string
- func StorageBackends() []string
- func StorageNameFromBackend(be StorageBackend) string
- func WithCryptoBackend(ctx context.Context, be CryptoBackend) context.Context
- func WithCryptoBackendString(ctx context.Context, be string) context.Context
- func WithRCSBackend(ctx context.Context, sb RCSBackend) context.Context
- func WithRCSBackendString(ctx context.Context, sb string) context.Context
- func WithStorageBackend(ctx context.Context, sb StorageBackend) context.Context
- func WithStorageBackendString(ctx context.Context, sb string) context.Context
- type Crypto
- type CryptoBackend
- type CryptoLoader
- type Keyring
- type RCS
- type RCSBackend
- type RCSLoader
- type Revision
- type Revisions
- type Storage
- type StorageBackend
- type StorageLoader
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotFound is returned if the requested backend was not found. ErrNotFound = fmt.Errorf("backend not found") )
Functions ¶
func CryptoBackendName ¶
func CryptoBackendName(cb CryptoBackend) string
CryptoBackendName returns the name of the given backend
func CryptoBackends ¶
func CryptoBackends() []string
CryptoBackends returns the list of registered crypto backends.
func CryptoNameFromBackend ¶
func CryptoNameFromBackend(be CryptoBackend) string
CryptoNameFromBackend returns the name of a given crypto backend
func HasCryptoBackend ¶
HasCryptoBackend returns true if a value for crypto backend has been set in the context
func HasRCSBackend ¶
HasRCSBackend returns true if a value for sync backend has been set in the context
func HasStorageBackend ¶
HasStorageBackend returns true if a value for store backend was set
func RCSBackendName ¶
func RCSBackendName(sb RCSBackend) string
RCSBackendName returns the name of the given backend
func RCSBackends ¶
func RCSBackends() []string
RCSBackends returns the list of registered RCS backends.
func RcsNameFromBackend ¶
func RcsNameFromBackend(be RCSBackend) string
RcsNameFromBackend returns the name of a given RCS backend
func RegisterCrypto ¶
func RegisterCrypto(id CryptoBackend, name string, loader CryptoLoader)
RegisterCrypto registers a new crypto backend with the backend registry.
func RegisterRCS ¶
func RegisterRCS(id RCSBackend, name string, loader RCSLoader)
RegisterRCS registers a new RCS backend with the backend registry.
func RegisterStorage ¶
func RegisterStorage(id StorageBackend, name string, loader StorageLoader)
RegisterStorage registers a new storage backend with the registry.
func StorageBackendName ¶
func StorageBackendName(sb StorageBackend) string
StorageBackendName returns the name of the given backend
func StorageBackends ¶
func StorageBackends() []string
StorageBackends returns the list of registered storage backends.
func StorageNameFromBackend ¶
func StorageNameFromBackend(be StorageBackend) string
StorageNameFromBackend returns the name of a given storage backend
func WithCryptoBackend ¶
func WithCryptoBackend(ctx context.Context, be CryptoBackend) context.Context
WithCryptoBackend returns a context with the given crypto backend set
func WithCryptoBackendString ¶
WithCryptoBackendString returns a context with the given crypto backend set
func WithRCSBackend ¶
func WithRCSBackend(ctx context.Context, sb RCSBackend) context.Context
WithRCSBackend returns a context with the given sync backend set
func WithRCSBackendString ¶
WithRCSBackendString returns a context with the given sync backend set
func WithStorageBackend ¶
func WithStorageBackend(ctx context.Context, sb StorageBackend) context.Context
WithStorageBackend returns a context with the given store backend set
Types ¶
type Crypto ¶
type Crypto interface { Keyring Encrypt(ctx context.Context, plaintext []byte, recipients []string) ([]byte, error) Decrypt(ctx context.Context, ciphertext []byte) ([]byte, error) RecipientIDs(ctx context.Context, ciphertext []byte) ([]string, error) Name() string Version(context.Context) semver.Version Initialized(ctx context.Context) error Ext() string // filename extension IDFile() string // recipient IDs }
Crypto is a crypto backend
func DetectCrypto ¶
DetectCrypto tries to detect the crypto backend used
type CryptoBackend ¶
type CryptoBackend int
CryptoBackend is a cryptographic backend
const ( // Plain is a no-op crypto backend Plain CryptoBackend = iota // GPGCLI is a gpg-cli based crypto backend GPGCLI // XC is an experimental crypto backend XC // Age - age-encryption.org Age )
func CryptoBackendFromName ¶
func CryptoBackendFromName(name string) CryptoBackend
CryptoBackendFromName parses the identifier into a crypto backend
func GetCryptoBackend ¶
func GetCryptoBackend(ctx context.Context) CryptoBackend
GetCryptoBackend returns the selected crypto backend or the default (GPGCLI)
func (CryptoBackend) String ¶
func (c CryptoBackend) String() string
type CryptoLoader ¶
type CryptoLoader interface { fmt.Stringer New(context.Context) (Crypto, error) Handles(Storage) error Priority() int }
CryptoLoader is the interface for creating a new crypto backend.
type Keyring ¶
type Keyring interface { ImportPublicKey(ctx context.Context, key []byte) error ExportPublicKey(ctx context.Context, id string) ([]byte, error) ListRecipients(ctx context.Context) ([]string, error) ListIdentities(ctx context.Context) ([]string, error) FindRecipients(ctx context.Context, needles ...string) ([]string, error) FindIdentities(ctx context.Context, needles ...string) ([]string, error) Fingerprint(ctx context.Context, id string) string FormatKey(ctx context.Context, id, tpl string) string ReadNamesFromKey(ctx context.Context, buf []byte) ([]string, error) GenerateIdentity(ctx context.Context, name, email, passphrase string) error }
Keyring is a public/private key manager
type RCS ¶
type RCS interface { Add(ctx context.Context, args ...string) error Commit(ctx context.Context, msg string) error Push(ctx context.Context, remote, location string) error Pull(ctx context.Context, remote, location string) error Name() string Version(ctx context.Context) semver.Version InitConfig(ctx context.Context, name, email string) error AddRemote(ctx context.Context, remote, location string) error RemoveRemote(ctx context.Context, remote string) error Revisions(ctx context.Context, name string) ([]Revision, error) GetRevision(ctx context.Context, name, revision string) ([]byte, error) Status(ctx context.Context) ([]byte, error) Compact(ctx context.Context) error }
RCS is a revision control backend
type RCSBackend ¶
type RCSBackend int
RCSBackend is a remote-sync backend
const ( // Noop is a no-op mock backend Noop RCSBackend = iota // GitCLI is a git-cli based sync backend GitCLI // OnDiskRCS is the OnDisk storage backend in disguise as an RCS backend OnDiskRCS )
func GetRCSBackend ¶
func GetRCSBackend(ctx context.Context) RCSBackend
GetRCSBackend returns the sync backend or the default (Git Mock)
func RcsBackendFromName ¶
func RcsBackendFromName(name string) RCSBackend
RcsBackendFromName parses the identifier into a rcs backend
func (RCSBackend) String ¶
func (s RCSBackend) String() string
type RCSLoader ¶
type RCSLoader interface { fmt.Stringer Open(context.Context, string) (RCS, error) Clone(context.Context, string, string) (RCS, error) InitRCS(context.Context, string) (RCS, error) Handles(string) error Priority() int }
RCSLoader is the interface for creating a new RCS backend.
type Revision ¶
type Revision struct { Hash string AuthorName string AuthorEmail string Date time.Time Subject string Body string }
Revision is a SCM revision
type Storage ¶
type Storage interface { fmt.Stringer Get(ctx context.Context, name string) ([]byte, error) Set(ctx context.Context, name string, value []byte) error Delete(ctx context.Context, name string) error Exists(ctx context.Context, name string) bool List(ctx context.Context, prefix string) ([]string, error) IsDir(ctx context.Context, name string) bool Prune(ctx context.Context, prefix string) error Name() string Path() string Version(context.Context) semver.Version Fsck(context.Context) error }
Storage is an storage backend
func DetectStorage ¶
DetectStorage tries to detect the storage backend being used
func InitStorage ¶
InitStorage initilizes a new storage location.
func NewStorage ¶
NewStorage initializes an existing storage backend.
type StorageBackend ¶
type StorageBackend int
StorageBackend is a type of storage backend
const ( // FS is a filesystem-backend storage FS StorageBackend = iota // InMem is an in-memory mock store for tests InMem // OnDisk is an on-disk store OnDisk )
func GetStorageBackend ¶
func GetStorageBackend(ctx context.Context) StorageBackend
GetStorageBackend returns the store backend or the default (FS)
func StorageBackendFromName ¶
func StorageBackendFromName(name string) StorageBackend
StorageBackendFromName parses the identifier into a storage backend
func (StorageBackend) String ¶
func (s StorageBackend) String() string
Directories ¶
Path | Synopsis |
---|---|
gpg/cli
Package cli implements a GPG CLI crypto backend.
|
Package cli implements a GPG CLI crypto backend. |
plain
Package plain implements a plaintext backend TODO(2.x) DEPRECATED and slated for removal in the 2.0.0 release.
|
Package plain implements a plaintext backend TODO(2.x) DEPRECATED and slated for removal in the 2.0.0 release. |
xc
Package xc implements a modern crypto backend for gopass.
|
Package xc implements a modern crypto backend for gopass. |
git/cli
Package cli implements a git cli based RCS backend.
|
Package cli implements a git cli based RCS backend. |
noop
Package noop implements a ineffective RCS backend for use with external synchronization solutions.
|
Package noop implements a ineffective RCS backend for use with external synchronization solutions. |
fs
Package fs implement a password-store compatible on disk storage layout with unencrypted paths.
|
Package fs implement a password-store compatible on disk storage layout with unencrypted paths. |
kv/inmem
Package inmem implements an in memory storage backend for tests.
|
Package inmem implements an in memory storage backend for tests. |
kv/ondisk
Package ondisk implements an encrypted on-disk storage backend with integrated revision control as well as automatic synchronization (soon).
|
Package ondisk implements an encrypted on-disk storage backend with integrated revision control as well as automatic synchronization (soon). |