key

package
v2.2.12+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2021 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package key provides a persistence layer for user key.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDAO

func NewDAO(o dao.DAO) dao.DAO

Types

type DAO

type DAO interface {
	SaveKey(key *encryption.Key) error
	GetKey(owner string, KeyID string) (*encryption.Key, error)
	ListKeys(owner string) ([]*encryption.Key, error)
	DeleteKey(owner string, keyID string) error
}

DAO is a protocol for user key storing

type UserKeyTool

type UserKeyTool interface {
	GetEncrypted(ctx context.Context, keyID string, data []byte) ([]byte, error)
	GetDecrypted(ctx context.Context, keyID string, data []byte) ([]byte, error)
}

UserKeyTool describes a tool that can encrypt/decrypt data based on user context

func GetUserKeyTool

func GetUserKeyTool(user string, pass []byte) UserKeyTool

GetUserKeyTool creates a keytool based on specified @user and @pass

func MasterKeyTool

func MasterKeyTool(ctx context.Context) (UserKeyTool, error)

MasterKeyTool creates the admin key tool

Directories

Path Synopsis
Package grpc is a simple encryption key persistence layer
Package grpc is a simple encryption key persistence layer

Jump to

Keyboard shortcuts

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