server

package
v0.1.2-alpha Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Backup

func Backup(w http.ResponseWriter, r *http.Request) error

func BackupHTTP

func BackupHTTP(w http.ResponseWriter, r *http.Request)

func BackupLocal

func BackupLocal() error

func HashPassword

func HashPassword(s string) string

func NewHTTPError

func NewHTTPError(err error, status int, detail string) error

func ReadRecord

func ReadRecord(r Recorder) error

func RemoveRecord

func RemoveRecord(r Recorder) error

func Serve

func Serve()

func WriteRecord

func WriteRecord(r Recorder) error

Types

type Application

type Application struct {
	Application string `json:"application"`
	Username    string `json:"username"`
	Password    string `json:"password"`
	// contains filtered or unexported fields
}

func (*Application) String

func (a *Application) String() string

func (*Application) Unmarshal

func (a *Application) Unmarshal(r io.Reader) error

type BoltOption

type BoltOption func(*BoltRecord) (*BoltRecord, error)

func BoltBucket

func BoltBucket(bucket string) BoltOption

BoltBucket sets the bucket as the string parameter

func BoltKey

func BoltKey(key []byte) BoltOption

BoltKey sets the key as the byte slice parameter

func BoltValue

func BoltValue(value []byte) BoltOption

BoltValue sets the value as the byte slice parameter

type BoltRecord

type BoltRecord struct {
	Bucket string
	Key    []byte
	Value  []byte
}

BoltRecord is a record that holds the values for a BoltDB Bucket, Key, and VAlue.

func NewBoltRecord

func NewBoltRecord(opts ...BoltOption) (*BoltRecord, error)

NewBoltRecord takes optional values and either returns an empty BoltRecord or a record containing the optional values.

func (*BoltRecord) AddRecord

func (r *BoltRecord) AddRecord() error

AddRecord creates a bucket and a key value pair inside of the bucket using a record for values.

func (*BoltRecord) DeleteEncryptedRecord

func (r *BoltRecord) DeleteEncryptedRecord(db *bbolt.DB) error

DeleteEncryptedRecord only deletes keys that are encrypted. These are things like credentials.

func (*BoltRecord) DeletePlainRecord

func (r *BoltRecord) DeletePlainRecord(db *bbolt.DB) error

DeletePlainRecord deletes keys with only plaintext values. These are things like user records.

func (*BoltRecord) DeleteRecord

func (r *BoltRecord) DeleteRecord() error

DeleteRecord calls either DeletetPlainRecord or DeleteEncryptedRecord depending on the name of the bucket.

func (*BoltRecord) GetEncryptedRecord

func (r *BoltRecord) GetEncryptedRecord(db *bbolt.DB) error

GetEncryptedRecord reads only encrypted keys in a bucket.

func (*BoltRecord) GetPlainRecord

func (r *BoltRecord) GetPlainRecord(db *bbolt.DB) error

GetPlainRecord specifically looks for an unencrypted key name

func (*BoltRecord) GetRecord

func (r *BoltRecord) GetRecord() error

GetRecord calls either the GetPlainRecord or GetEncryptedRecord depending on whether the bucket name.

type ClientError

type ClientError interface {
	Error() string
	Body() ([]byte, error)
	Headers() (int, map[string]string)
}

type HTTPError

type HTTPError struct {
	Cause   error  `json:"-"`
	Details string `json:"details"`
	Status  int    `json:"-"`
}

func (*HTTPError) Body

func (e *HTTPError) Body() ([]byte, error)

func (*HTTPError) Error

func (e *HTTPError) Error() string

func (*HTTPError) Headers

func (e *HTTPError) Headers() (int, map[string]string)

type MasterPass

type MasterPass struct {
	MasterPassword string `json:"master_password"`
}

type Password

type Password struct {
	PlainText string `json:"password"`
	// contains filtered or unexported fields
}

func NewPassword

func NewPassword() *Password

NewPassword returns a pointer to a new password.

type Recorder

type Recorder interface {
	AddRecord() error
	GetRecord() error
	DeleteRecord() error
}

type Route

type Route struct {
	Name        string
	Method      string
	Pattern     string
	HandlerFunc http.HandlerFunc
}

type Routes

type Routes []Route

type Status

type Status struct {
	State string `json:"state"`
}

type User

type User struct {
	Username string
	*Password
}

User holds information about a user.

func (*User) String

func (u *User) String() string

Jump to

Keyboard shortcuts

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