Documentation ¶
Index ¶
- Variables
- func Decrypt(r io.Reader, key string) (content, filename string, err error)
- func Encrypt(r io.Reader, key string) (string, error)
- func Fetch(server string, id string) (string, error)
- func GenerateKey() (string, error)
- func ParseURL(s string) (id, key string, fileOpt, keyOpt bool, err error)
- func SecretURL(url, id, key string, fileOpt, manualKeyOpt bool) string
- func Store(server string, s Secret) (string, error)
- type Secret
- type ServerError
Constants ¶
This section is empty.
Variables ¶
var ErrEmptyKey = errors.New("empty encryption key")
ErrEmptyKey is returned when no encryption key is provided.
var ErrInvalidKey = errors.New("invalid decryption key")
ErrInvalidKey is returned when a given decryption key is invalid.
var ErrInvalidMessage = errors.New("invalid message")
ErrInvalidMessage is returned when a given message is invalid.
var HTTPClient = http.DefaultClient
HTTPClient allows modifying the underlying http.Client.
Functions ¶
func Decrypt ¶
Decrypt reads the provided ciphertext and returns the plaintext decrypted with the given key. The ciphertext format is specified by the yopass frontend, no assumptions about the format should be made.
func Encrypt ¶
Encrypt reads the provided plaintext and returns a ciphertext encrypted with the given key. No assumptions about the ciphertext format should be made, the encryption method might change in future versions.
func GenerateKey ¶
GenerateKey creates a new encryption key from a cryptographically secure random number generator. The format matches the Javascript implementation.
Types ¶
type Secret ¶
type Secret struct { Expiration int32 `json:"expiration,omitempty"` Message string `json:"message"` OneTime bool `json:"one_time,omitempty"` AccessToken string `json:"access_token,omitempty"` }
Secret holds the encrypted message
type ServerError ¶
type ServerError struct {
// contains filtered or unexported fields
}
ServerError represents a yopass server error.
func (*ServerError) Error ¶
func (e *ServerError) Error() string
func (*ServerError) Unwrap ¶
func (e *ServerError) Unwrap() error