Documentation
¶
Index ¶
- Variables
- type Client
- func (c *Client) Burn(metadataKey string, passphrase string) (Metadata, error)
- func (c *Client) Generate(passphrase string, secretTTL int, recipient string) (string, Metadata, error)
- func (c *Client) Get(secretKey string, passphrase string) (string, error)
- func (c *Client) GetMetadata(metadataKey string) (Metadata, error)
- func (c *Client) GetRecentMetadata() ([]PartialMetadata, error)
- func (c *Client) GetSystemStatus() (SystemStatus, error)
- func (c *Client) Put(secret string, passphrase string, secretTTL int, recipient string) (Metadata, error)
- type Metadata
- type PartialMetadata
- type SecretState
- type SystemStatus
Constants ¶
This section is empty.
Variables ¶
var ErrDestroyed = errors.New("onetimesecret: burned or retrieved")
ErrDestroyed is returned when a secret URL is requested but the secret has been destroyed.
var ErrInvalid = errors.New("onetimesecret: invalid argument")
ErrInvalid is returned when the client attempts to store an empty secret.
var ErrNotFound = errors.New("onetimesecret: unknown secret")
ErrNotFound is returned when there is no secret with the provided metadata key or secret key, or an incorrect passphrase is provided.
Functions ¶
This section is empty.
Types ¶
type Client ¶
A Client allows access to One-Time Secret.
func (*Client) Burn ¶
Burn destroys a secret given its metadata key and, if necessary, passphrase. If there is no secret with the given metadata key or the passphrase is incorrect, Burn returns ErrNotFound.
func (*Client) Generate ¶
func (c *Client) Generate(passphrase string, secretTTL int, recipient string) (string, Metadata, error)
Generate creates a short, unique secret with an optional passphrase and TTL, returning the secret and its metadata.
func (*Client) Get ¶
Get retrieves a secret given a secret key and, if necessary, a passphrase. If there is no secret with the given secret key or the passphrase is incorrect, Get returns ErrNotFound.
func (*Client) GetMetadata ¶
GetMetadata returns metadata for a secret given a metadata key. If there is no secret with the given metadata key, GetMetadata returns ErrNotFound.
func (*Client) GetRecentMetadata ¶
func (c *Client) GetRecentMetadata() ([]PartialMetadata, error)
GetRecentMetadata returns partial metadata for recently created secrets.
func (*Client) GetSystemStatus ¶
func (c *Client) GetSystemStatus() (SystemStatus, error)
GetSystemStatus returns the status of the One-Time Secret system.
type Metadata ¶
type Metadata struct {
CustomerID string
MetadataKey string
SecretKey string
InitialMetadataTTL int
MetadataTTL int
SecretTTL int
State SecretState
Updated time.Time
Created time.Time
ObfuscatedRecipient string
HasPassphrase bool
}
func (Metadata) MetadataURL ¶
MetadataURL returns a URL that allows retrieving the secret, burning the secret, and viewing its metadata.
type PartialMetadata ¶
type SecretState ¶
type SecretState string
const ( SecretStateOther SecretState = "other" SecretStateBurned SecretState = "burned" SecretStateNew SecretState = "new" SecretStateReceived SecretState = "received" SecretStateViewed SecretState = "viewed" )
type SystemStatus ¶
type SystemStatus string
const ( SystemStatusOther SystemStatus = "other" SystemStatusNominal SystemStatus = "nominal" SystemStatusOffline SystemStatus = "offline" )