repo

package
v0.0.0-...-6aec01b Latest Latest
Warning

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

Go to latest
Published: May 17, 2023 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth interface {
	Login(ctx context.Context, username, securityKey string) (string, error)
}

type AuthRepo

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

AuthRepo is facade to operations regarding authentication in Keeper.

func NewAuthRepo

func NewAuthRepo(client goph.AuthClient) *AuthRepo

NewAuthRepo creates and initializes AuthRepo object.

func (*AuthRepo) Login

func (r *AuthRepo) Login(
	ctx context.Context,
	username, securityKey string,
) (string, error)

Login authenticates user in the Keeper service.

type AuthRepoMock

type AuthRepoMock struct {
	mock.Mock
}

func (*AuthRepoMock) Login

func (m *AuthRepoMock) Login(
	ctx context.Context,
	username, securityKey string,
) (string, error)

type Repositories

type Repositories struct {
	Auth    Auth
	Secrets Secrets
	Users   Users
}

Repositories is a collection of data repositories.

func New

func New(conn *grpcconn.Connection) *Repositories

New creates and initializes collection of data repositories.

type Secrets

type Secrets interface {
	Push(
		ctx context.Context,
		token, name string,
		kind goph.DataKind,
		description, payload []byte,
	) (uuid.UUID, error)

	List(ctx context.Context, token string) ([]*goph.Secret, error)
	Get(ctx context.Context, token string, id uuid.UUID) (*goph.Secret, []byte, error)

	Update(
		ctx context.Context,
		token string,
		id uuid.UUID,
		name string,
		description []byte,
		noDescription bool,
		data []byte,
	) error

	Delete(ctx context.Context, token string, id uuid.UUID) error
}

type SecretsRepo

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

SecretsRepo is facade to secrets stored in Keeper.

func NewSecretsRepo

func NewSecretsRepo(client goph.SecretsClient) *SecretsRepo

NewSecretsRepo creates and initializes SecretsRepo object.

func (*SecretsRepo) Delete

func (r *SecretsRepo) Delete(
	ctx context.Context,
	token string,
	id uuid.UUID,
) error

Delete removes user's secret.

func (*SecretsRepo) Get

func (r *SecretsRepo) Get(
	ctx context.Context,
	token string,
	id uuid.UUID,
) (*goph.Secret, []byte, error)

Get downloads full user's secret.

func (*SecretsRepo) List

func (r *SecretsRepo) List(
	ctx context.Context,
	token string,
) ([]*goph.Secret, error)

List returns list of user's secrets without data.

func (*SecretsRepo) Push

func (r *SecretsRepo) Push(
	ctx context.Context,
	token, name string,
	kind goph.DataKind,
	description, payload []byte,
) (uuid.UUID, error)

Push send new secret data to the server.

func (*SecretsRepo) Update

func (r *SecretsRepo) Update(
	ctx context.Context,
	token string,
	id uuid.UUID,
	name string,
	description []byte,
	noDescription bool,
	data []byte,
) error

Update changes parameters of stored secret.

type SecretsRepoMock

type SecretsRepoMock struct {
	mock.Mock
}

func (*SecretsRepoMock) Delete

func (m *SecretsRepoMock) Delete(
	ctx context.Context,
	token string,
	id uuid.UUID,
) error

func (*SecretsRepoMock) Get

func (m *SecretsRepoMock) Get(
	ctx context.Context,
	token string,
	id uuid.UUID,
) (*goph.Secret, []byte, error)

func (*SecretsRepoMock) List

func (m *SecretsRepoMock) List(
	ctx context.Context,
	token string,
) ([]*goph.Secret, error)

func (*SecretsRepoMock) Push

func (m *SecretsRepoMock) Push(
	ctx context.Context,
	token, name string,
	kind goph.DataKind,
	description, payload []byte,
) (uuid.UUID, error)

func (*SecretsRepoMock) Update

func (m *SecretsRepoMock) Update(
	ctx context.Context,
	token string,
	id uuid.UUID,
	name string,
	description []byte,
	noDescription bool,
	data []byte,
) error

type Users

type Users interface {
	Register(ctx context.Context, username, securityKey string) (string, error)
}

type UsersRepo

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

UsersRepo is facade to operations regarding Keeper.

func NewUsersRepo

func NewUsersRepo(client goph.UsersClient) *UsersRepo

NewUsersRepo creates and initializes UsersRepo object.

func (*UsersRepo) Register

func (r *UsersRepo) Register(
	ctx context.Context,
	username, securityKey string,
) (string, error)

Register creates a new user.

type UsersRepoMock

type UsersRepoMock struct {
	mock.Mock
}

func (*UsersRepoMock) Register

func (m *UsersRepoMock) Register(
	ctx context.Context,
	username, securityKey string,
) (string, error)

Jump to

Keyboard shortcuts

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