gopass: Index | Files | Directories

package backend

import ""


Package Files

context.go crypto.go rcs.go registry.go storage.go strings.go url.go


var (

    // ErrNotFound is returned if the requested backend was not found.
    ErrNotFound = fmt.Errorf("backend not found")

func CryptoBackendName Uses

func CryptoBackendName(cb CryptoBackend) string

CryptoBackendName returns the name of the given backend

func CryptoBackends Uses

func CryptoBackends() []string

CryptoBackends returns the list of registered crypto backends.

func HasCryptoBackend Uses

func HasCryptoBackend(ctx context.Context) bool

HasCryptoBackend returns true if a value for crypto backend has been set in the context

func HasRCSBackend Uses

func HasRCSBackend(ctx context.Context) bool

HasRCSBackend returns true if a value for sync backend has been set in the context

func HasStorageBackend Uses

func HasStorageBackend(ctx context.Context) bool

HasStorageBackend returns true if a value for store backend was set

func RCSBackendName Uses

func RCSBackendName(sb RCSBackend) string

RCSBackendName returns the name of the given backend

func RCSBackends Uses

func RCSBackends() []string

RCSBackends returns the list of registered RCS backends.

func RegisterCrypto Uses

func RegisterCrypto(id CryptoBackend, name string, loader CryptoLoader)

RegisterCrypto registers a new crypto backend with the backend registry.

func RegisterRCS Uses

func RegisterRCS(id RCSBackend, name string, loader RCSLoader)

RegisterRCS registers a new RCS backend with the backend registry.

func RegisterStorage Uses

func RegisterStorage(id StorageBackend, name string, loader StorageLoader)

RegisterStorage registers a new storage backend with the registry.

func StorageBackendName Uses

func StorageBackendName(sb StorageBackend) string

StorageBackendName returns the name of the given backend

func StorageBackends Uses

func StorageBackends() []string

StorageBackends returns the list of registered storage backends.

func WithCryptoBackend Uses

func WithCryptoBackend(ctx context.Context, be CryptoBackend) context.Context

WithCryptoBackend returns a context with the given crypto backend set

func WithCryptoBackendString Uses

func WithCryptoBackendString(ctx context.Context, be string) context.Context

WithCryptoBackendString returns a context with the given crypto backend set

func WithRCSBackend Uses

func WithRCSBackend(ctx context.Context, sb RCSBackend) context.Context

WithRCSBackend returns a context with the given sync backend set

func WithRCSBackendString Uses

func WithRCSBackendString(ctx context.Context, sb string) context.Context

WithRCSBackendString returns a context with the given sync backend set

func WithStorageBackend Uses

func WithStorageBackend(ctx context.Context, sb StorageBackend) context.Context

WithStorageBackend returns a context with the given store backend set

func WithStorageBackendString Uses

func WithStorageBackendString(ctx context.Context, sb string) context.Context

WithStorageBackendString returns a context with the given store backend set

type Crypto Uses

type Crypto interface {

    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 NewCrypto Uses

func NewCrypto(ctx context.Context, id CryptoBackend) (Crypto, error)

NewCrypto instantiates a new crypto backend.

type CryptoBackend Uses

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
    // XC is an experimental crypto backend
    // OpenPGP is a GPG1.x compatible pure-Go crypto backend
    // Vault is Hashicorp Vault backend

func GetCryptoBackend Uses

func GetCryptoBackend(ctx context.Context) CryptoBackend

GetCryptoBackend returns the selected crypto backend or the default (GPGCLI)

func (CryptoBackend) String Uses

func (c CryptoBackend) String() string

type CryptoLoader Uses

type CryptoLoader interface {
    New(context.Context) (Crypto, error)

CryptoLoader is the interface for creating a new crypto backend.

type Keyring Uses

type Keyring interface {
    ImportPublicKey(ctx context.Context, key []byte) error
    ExportPublicKey(ctx context.Context, id string) ([]byte, error)

    ListPublicKeyIDs(ctx context.Context) ([]string, error)
    ListPrivateKeyIDs(ctx context.Context) ([]string, error)

    FindPublicKeys(ctx context.Context, needles ...string) ([]string, error)
    FindPrivateKeys(ctx context.Context, needles ...string) ([]string, error)

    FormatKey(ctx context.Context, id string) string
    NameFromKey(ctx context.Context, id string) string
    EmailFromKey(ctx context.Context, id string) string
    Fingerprint(ctx context.Context, id string) string
    ReadNamesFromKey(ctx context.Context, buf []byte) ([]string, error)

    CreatePrivateKeyBatch(ctx context.Context, name, email, passphrase string) error
    CreatePrivateKey(ctx context.Context) error

Keyring is a public/private key manager

type RCS Uses

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)

RCS is a revision control backend

func CloneRCS Uses

func CloneRCS(ctx context.Context, id RCSBackend, repo, path string) (RCS, error)

CloneRCS clones an existing repository from a remote.

func InitRCS Uses

func InitRCS(ctx context.Context, id RCSBackend, path, name, email string) (RCS, error)

InitRCS initializes a new repository.

func OpenRCS Uses

func OpenRCS(ctx context.Context, id RCSBackend, path string) (RCS, error)

OpenRCS opens an existing repository.

type RCSBackend Uses

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
    // GoGit is an src-d/go-git.v4 based sync backend

func GetRCSBackend Uses

func GetRCSBackend(ctx context.Context) RCSBackend

GetRCSBackend returns the sync backend or the default (Git Mock)

func (RCSBackend) String Uses

func (s RCSBackend) String() string

type RCSLoader Uses

type RCSLoader interface {
    Open(context.Context, string) (RCS, error)
    Clone(context.Context, string, string) (RCS, error)
    Init(context.Context, string, string, string) (RCS, error)

RCSLoader is the interface for creating a new RCS backend.

type Revision Uses

type Revision struct {
    Hash        string
    AuthorName  string
    AuthorEmail string
    Date        time.Time
    Subject     string
    Body        string

Revision is a SCM revision

type Storage Uses

type Storage interface {
    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
    Available(ctx context.Context) error

    Name() string
    Version(context.Context) semver.Version
    Fsck(context.Context) error

Storage is an storage backend

func NewStorage Uses

func NewStorage(ctx context.Context, id StorageBackend, url *URL) (Storage, error)

NewStorage initializes a new storage backend.

type StorageBackend Uses

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
    // Consul is a consul backend storage

func GetStorageBackend Uses

func GetStorageBackend(ctx context.Context) StorageBackend

GetStorageBackend returns the store backend or the default (FS)

func (StorageBackend) String Uses

func (s StorageBackend) String() string

type StorageLoader Uses

type StorageLoader interface {
    New(context.Context, *URL) (Storage, error)

StorageLoader is the interface for creating a new storage backend.

type URL Uses

type URL struct {
    Crypto   CryptoBackend
    RCS      RCSBackend
    Storage  StorageBackend
    Scheme   string
    Host     string
    Port     string
    Path     string
    Username string
    Password string
    Query    url.Values
    // contains filtered or unexported fields

URL is a parsed backend URL

func FromPath Uses

func FromPath(path string) *URL

FromPath returns a new backend URL with the given path and default backends (GitCLI, GPGCLI, FS)

func ParseURL Uses

func ParseURL(us string) (*URL, error)

ParseURL attempts to parse an backend URL

func (*URL) MarshalYAML Uses

func (u *URL) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler

func (*URL) String Uses

func (u *URL) String() string

String implements fmt.Stringer

func (*URL) UnmarshalYAML Uses

func (u *URL) UnmarshalYAML(umf func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaler


crypto/xc/xcpbPackage xcpb is a generated protocol buffer package.

Package backend imports 13 packages (graph). Updated 2020-01-13. Refresh now. Tools for package owners.