provider

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BitwardenDefaultPrefix default prefix for BitwardenItem.
	BitwardenDefaultPrefix = "SSHKeys__"
	// BitwardenCommand base command for Bitwarden.
	BitwardenCommand = "bw"
)
View Source
const (
	// OnePasswordDefaultPrefix default prefix for OnePasswordItem.
	//nolint:gosec // not security issue.
	OnePasswordDefaultPrefix = "SSHKeys__"
	// OnePasswordCommand base command for OnePassword.
	OnePasswordCommand = "op"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APIInterface

type APIInterface interface {
	Add(item *Item) error
	Get(name string) (Item, error)
	List() ([]Item, error)
}

APIInterface is an interface for all providers.

type Bitwarden

type Bitwarden struct {
	Commander Commander
}

Bitwarden for connection.

func (Bitwarden) Add

func (b Bitwarden) Add(item *Item) error

Add adds given item to Bitwarden.

func (Bitwarden) Get

func (b Bitwarden) Get(name string) (Item, error)

Get gets Item from Bitwarden with given item name.

func (Bitwarden) List

func (b Bitwarden) List() ([]Item, error)

List lists all added SSH keys.

func (Bitwarden) Sync

func (b Bitwarden) Sync() error

Sync syncs Bitwarden vault.

type BitwardenItem

type BitwardenItem struct {
	ID    *string `json:"id"`
	Type  int     `json:"type"`
	Name  string  `json:"name"`
	Notes string  `json:"notes"`
	Login string  `json:"login"`
}

BitwardenItem is item adapter for provider Item.

type Commander

type Commander struct {
	Executor exec.Interface
}

Commander is the root of this helper.

func NewCommander

func NewCommander() Commander

NewCommander is a factory for Commander.

type ExecutionFailedError

type ExecutionFailedError struct {
	Command string
	Message string
}

ExecutionFailedError occurs when an execution fails.

func (ExecutionFailedError) Error

func (e ExecutionFailedError) Error() string

type Field

type Field struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

Field is custom fields under Item.

type Item

type Item struct {
	ID     string  `json:"id,omitempty"`
	Name   string  `json:"name"`
	Values []Field `json:"value"`
}

Item is a secure item of provider.

func (Item) EncodeValues

func (i Item) EncodeValues() (string, error)

EncodeValues encodes Values.

type ItemAlreadyExists

type ItemAlreadyExists struct {
	Name string
}

ItemAlreadyExists occurs when given item is not found in the provder.

func (ItemAlreadyExists) Error

func (e ItemAlreadyExists) Error() string

type NotFound

type NotFound struct {
	Name *string
}

NotFound occurs when no provider found.

func (NotFound) Error

func (e NotFound) Error() string

type OnePassword

type OnePassword struct {
	Commander Commander
}

OnePassword for connection.

func (OnePassword) Add

func (o OnePassword) Add(item *Item) error

Add adds given item to OnePassword.

func (OnePassword) Get

func (o OnePassword) Get(name string) (Item, error)

Get gets Item from OnePassword with given item name.

func (OnePassword) List

func (o OnePassword) List() ([]Item, error)

List lists all added SSH keys.

type OnePasswordItem

type OnePasswordItem struct {
	UUID     *string                 `json:"uuid"`
	Details  OnePasswordItemDetails  `json:"details"`
	Overview OnePasswordItemOverview `json:"overview"`
}

OnePasswordItem is item adapter for provider OnePasswordItem.

type OnePasswordItemDetails

type OnePasswordItemDetails struct {
	NotesPlain *string `json:"notesPlain"`
}

OnePasswordItemDetails is item adapter for provider Item.

type OnePasswordItemOverview

type OnePasswordItemOverview struct {
	Title *string `json:"title"`
}

OnePasswordItemOverview is item adapter for provider OnePasswordItem.

Jump to

Keyboard shortcuts

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