client

package
v0.0.0-...-9192568 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SBinary   string = "/storage/binary/"
	SCard     string = "/storage/card/"
	SPassword string = "/storage/password/"
	SText     string = "/storage/text/"
)

Variables

View Source
var ErrUnauthorized = errors.New("incorrect username or password")

Functions

This section is empty.

Types

type AuthClient

type AuthClient interface {
	Login(ctx context.Context, user, password string) error
	Logout(ctx context.Context) error
	Register(ctx context.Context, user, password string) error
}

type BinaryClient

type BinaryClient interface {
	DeleteBinary(ctx context.Context, id string) error
	GetAllBinaries(ctx context.Context) ([]models.BinaryResponse, error)
	GetBinaryByID(ctx context.Context, id string) (models.BinaryResponse, error)
	StoreBinary(ctx context.Context, name string, data []byte, note string) (string, error)
}

type CardClient

type CardClient interface {
	DeleteCard(ctx context.Context, id string) error
	GetAllCards(ctx context.Context) ([]models.CardResponse, error)
	GetCardByID(ctx context.Context, id string) (models.CardResponse, error)
	StoreCard(ctx context.Context, name, number, holder, expDate, cvv, note string) (string, error)
}

type HTTPKeeperClient

type HTTPKeeperClient struct {
	// contains filtered or unexported fields
}

func NewHTTPClient

func NewHTTPClient(cfg *config.ClientConfig) (HTTPKeeperClient, error)

func (HTTPKeeperClient) DeleteBinary

func (c HTTPKeeperClient) DeleteBinary(ctx context.Context, id string) error

func (HTTPKeeperClient) DeleteCard

func (c HTTPKeeperClient) DeleteCard(ctx context.Context, id string) error

func (HTTPKeeperClient) DeletePassword

func (c HTTPKeeperClient) DeletePassword(ctx context.Context, id string) error

func (HTTPKeeperClient) DeleteText

func (c HTTPKeeperClient) DeleteText(ctx context.Context, id string) error

func (HTTPKeeperClient) GetAllBinaries

func (c HTTPKeeperClient) GetAllBinaries(ctx context.Context) ([]models.BinaryResponse, error)

func (HTTPKeeperClient) GetAllCards

func (c HTTPKeeperClient) GetAllCards(ctx context.Context) ([]models.CardResponse, error)

func (HTTPKeeperClient) GetAllPasswords

func (c HTTPKeeperClient) GetAllPasswords(ctx context.Context) ([]models.PasswordResponse, error)

func (HTTPKeeperClient) GetAllTexts

func (c HTTPKeeperClient) GetAllTexts(ctx context.Context) ([]models.TextResponse, error)

func (HTTPKeeperClient) GetBinaryByID

func (c HTTPKeeperClient) GetBinaryByID(ctx context.Context, id string) (models.BinaryResponse, error)

func (HTTPKeeperClient) GetCardByID

func (c HTTPKeeperClient) GetCardByID(ctx context.Context, id string) (models.CardResponse, error)

func (HTTPKeeperClient) GetPasswordByID

func (c HTTPKeeperClient) GetPasswordByID(ctx context.Context, id string) (models.PasswordResponse, error)

func (HTTPKeeperClient) GetTextByID

func (c HTTPKeeperClient) GetTextByID(ctx context.Context, id string) (models.TextResponse, error)

func (HTTPKeeperClient) Login

func (c HTTPKeeperClient) Login(ctx context.Context, user, password string) error

func (HTTPKeeperClient) Logout

func (c HTTPKeeperClient) Logout(ctx context.Context) error

func (HTTPKeeperClient) Register

func (c HTTPKeeperClient) Register(ctx context.Context, user, password string) error

func (HTTPKeeperClient) StoreBinary

func (c HTTPKeeperClient) StoreBinary(ctx context.Context, name string,
	data []byte, note string,
) (string, error)

func (HTTPKeeperClient) StoreCard

func (c HTTPKeeperClient) StoreCard(ctx context.Context,
	name, number, holder, expDate, cvv, note string,
) (string, error)

func (HTTPKeeperClient) StorePassword

func (c HTTPKeeperClient) StorePassword(ctx context.Context, name, user, password, note string) (string, error)

func (HTTPKeeperClient) StoreText

func (c HTTPKeeperClient) StoreText(ctx context.Context, name, data, note string) (string, error)

type KeeperClient

type KeeperClient interface {
	AuthClient
	BinaryClient
	CardClient
	PasswordClient
	TextClient
}

func NewClient

func NewClient(cfg *config.ClientConfig) (KeeperClient, error)

type KeeperClientConfig

type KeeperClientConfig interface {
	GetAPIAddress() string
	GetCACertPool() (*x509.CertPool, error)
	GetCertificate() (tls.Certificate, error)
}

type PasswordClient

type PasswordClient interface {
	DeletePassword(ctx context.Context, id string) error
	GetAllPasswords(ctx context.Context) ([]models.PasswordResponse, error)
	GetPasswordByID(ctx context.Context, id string) (models.PasswordResponse, error)
	StorePassword(ctx context.Context, name, user, password, note string) (string, error)
}

type TextClient

type TextClient interface {
	DeleteText(ctx context.Context, id string) error
	GetAllTexts(ctx context.Context) ([]models.TextResponse, error)
	GetTextByID(ctx context.Context, id string) (models.TextResponse, error)
	StoreText(ctx context.Context, name, data, note string) (string, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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