yopass

package
v0.0.0-...-103b1b3 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2020 License: Apache-2.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 Database

type Database interface {
	Get(key string) (Secret, error)
	Put(key string, secret Secret) error
	Delete(key string) error
}

Database interface

func NewMemcached

func NewMemcached(server string) Database

NewMemcached returns a new memcached database client

func NewRedis

func NewRedis(url string) (Database, error)

NewRedis returns a new Redis database client

type Memcached

type Memcached struct {
	Client *memcache.Client
}

Memcached client

func (Memcached) Delete

func (m Memcached) Delete(key string) error

Delete key from memcached

func (*Memcached) Get

func (m *Memcached) Get(key string) (Secret, error)

Get key in memcached

func (*Memcached) Put

func (m *Memcached) Put(key string, secret Secret) error

Put key in Memcached

type Redis

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

Redis client

func (*Redis) Delete

func (r *Redis) Delete(key string) error

Delete key from Redis

func (*Redis) Get

func (r *Redis) Get(key string) (Secret, error)

Get key from Redis

func (*Redis) Put

func (r *Redis) Put(key string, secret Secret) error

Put key to Redis

type Secret

type Secret struct {
	Expiration int32  `json:"expiration,omitempty"`
	Message    string `json:"message"`
	OneTime    bool   `json:"one_time,omitempty"`
}

Secret holds the encrypted message

func (*Secret) ToJSON

func (s *Secret) ToJSON() ([]byte, error)

ToJSON converts a Secret to json

type Yopass

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

Yopass struct holding database and settings. This should be created with yopass.New

func New

func New(db Database, maxLength int) Yopass

New is the main way of creating the server.

func (*Yopass) HTTPHandler

func (y *Yopass) HTTPHandler() http.Handler

HTTPHandler containing all routes

Jump to

Keyboard shortcuts

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