secrets

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	Writer
	Reader
	Deleter
}

type Deleter

type Deleter interface {
	Delete(string) error
}

type NATS

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

func NewNatsBackend

func NewNatsBackend(nc *nats.Conn, v ValidateFunc) (*NATS, error)

func (*NATS) Delete

func (n *NATS) Delete(id string) error

func (*NATS) Read

func (n *NATS) Read(id string) (Secret, error)

func (*NATS) Validate added in v0.0.3

func (n *NATS) Validate(s Secret) error

func (*NATS) Write

func (n *NATS) Write(s Secret) error

type Reader

type Reader interface {
	Read(string) (Secret, error)
}

type ReaderDeleter

type ReaderDeleter interface {
	Reader
	Deleter
}

type RecordError

type RecordError struct {
	Status      int
	Description string
}

func NewSecretError

func NewSecretError(status int, description string) RecordError

func (RecordError) Body

func (r RecordError) Body() string

func (RecordError) Code

func (r RecordError) Code() int

func (RecordError) Error

func (r RecordError) Error() string

type Secret

type Secret struct {
	ID       string `json:"id"`
	Text     string `json:"text"`
	Password string `json:"password"`
	Views    int    `json:"views"`
}

func AddSecret

func AddSecret(w Writer, s Secret) (Secret, error)

func GetSecret

func GetSecret(s Secret, b Backend) (Secret, error)

type ValidateFunc added in v0.0.3

type ValidateFunc func(s Secret) error

func DefaultValidator added in v0.0.3

func DefaultValidator(length int) ValidateFunc

type Writer

type Writer interface {
	Write(Secret) error
	Validate(Secret) error
}

Jump to

Keyboard shortcuts

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