usecase

package
v0.0.0-...-f0ba60e Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAlreadyExists = errors.New("already exists")
View Source
var ErrBadPermission = errors.New("bad file/dir permission")
View Source
var ErrInvalidData = errors.New("invalid data")
View Source
var ErrNotDir = errors.New("not a directory")
View Source
var ErrNotFile = errors.New("not a regular file")
View Source
var ErrPrivateKeyNotFound = errors.New("private key not found")
View Source
var ErrUnknownUser = fmt.Errorf("unknown user")

Functions

func IsShEncFile

func IsShEncFile(in string) (bool, error)

Types

type App

type App struct {
	Store *KeyStore
}

func (*App) AddKeyList

func (a *App) AddKeyList(in string)

func (*App) AddPublicKey

func (a *App) AddPublicKey(in, name string)

func (*App) DecryptFile

func (a *App) DecryptFile(in, out string)

func (*App) EncryptFile

func (a *App) EncryptFile(in, out string, members []string)

func (*App) GenerateFileKey

func (a *App) GenerateFileKey(out string, fileID [16]byte, members []string) (domain.UserInfo, []domain.UserInfo, error)

func (*App) ListPublicKeys

func (a *App) ListPublicKeys()

func (*App) RemovePublicKey

func (a *App) RemovePublicKey(name string)

func (*App) ShowFileInfo

func (a *App) ShowFileInfo(in string)

func (*App) UpdateFile

func (a *App) UpdateFile(base, in, out string)

type KeyStore

type KeyStore struct {
	Confd string // App config directory

	Keyd    string // Owner's key directory
	Pubkeyf string // Owner's public key file
	Prvkeyf string // Owner's private key file

	Knownkeyd string // Known (member's) keys directory
	Keylistf  string // Known (member's) list

	Filed string // file data directory
	// contains filtered or unexported fields
}

func NewKeyStore

func NewKeyStore() (KeyStore, error)

NewKeyStore creates a new KeyStore instance. If conf dir is not exist, creates it. If private key is not exist, return store with ErrPrivateKeyNotFound.

func (*KeyStore) AddFileKey

func (s *KeyStore) AddFileKey(keylist domain.KeyListFile) error

func (*KeyStore) AddPublicKey

func (s *KeyStore) AddPublicKey(key keys.PublicKey, name string) error

func (*KeyStore) GetByFingerprint

func (s *KeyStore) GetByFingerprint(fingerprint string) (keys.PublicKey, error)

func (*KeyStore) GetByName

func (s *KeyStore) GetByName(name string) (keys.PublicKey, error)

func (*KeyStore) GetFileKey

func (s *KeyStore) GetFileKey(fileid, ownerfp string) (keys.PrivateKey, error)

func (*KeyStore) GetMyPrivateKey

func (s *KeyStore) GetMyPrivateKey() (keys.PrivateKey, error)

func (*KeyStore) GetMyPublicKey

func (s *KeyStore) GetMyPublicKey() (keys.PublicKey, error)

func (*KeyStore) GetNameByFingerprint

func (s *KeyStore) GetNameByFingerprint(fingerprint string) string

func (*KeyStore) RemovePublicKey

func (s *KeyStore) RemovePublicKey(fingerprint string) error

Jump to

Keyboard shortcuts

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