Documentation ¶
Index ¶
- Constants
- type Client
- func (c *Client) Burn(ctx context.Context, metadataKey string) error
- func (c *Client) Generate(ctx context.Context, opts ...GenerateOption) (Metadata, error)
- func (c *Client) Metadata(ctx context.Context, metadataKey string) (Metadata, error)
- func (c *Client) Secret(ctx context.Context, secretKey string, opts ...SecretOption) (Secret, error)
- func (c *Client) Share(ctx context.Context, secret string, opts ...ShareOption) (Metadata, error)
- func (c *Client) Status(ctx context.Context) (Status, error)
- type ClientOption
- type Duration
- type Error
- type GenerateOption
- type HTTPClient
- type Metadata
- type Secret
- type SecretOption
- type ShareOption
- type State
- type Status
- type Time
Constants ¶
const ( // StateNew means that secret is not received or viewed. StateNew = "new" // StateViewed means that secret metadata is already viewed. StateViewed = "viewed" // StateReceived means that secret is received. StateReceived = "received" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client of service.
func New ¶
func New(userName, apiKey string, opts ...ClientOption) *Client
New returns new client instance.
func (*Client) Secret ¶
func (c *Client) Secret(ctx context.Context, secretKey string, opts ...SecretOption) (Secret, error)
Secret returns secret by secret key.
type ClientOption ¶
type ClientOption func(*Client)
ClientOption client option.
func WithHTTPClient ¶
func WithHTTPClient(httpClient HTTPClient) ClientOption
WithHTTPClient to set custom HTTP client.
type Duration ¶
Duration type.
func (*Duration) MarshalJSON ¶
MarshalJSON marshal duration to json value.
func (*Duration) UnmarshalJSON ¶
UnmarshalJSON unmarshal duration from json value.
type GenerateOption ¶
GenerateOption generate option.
func GeneratePassphrase ¶
func GeneratePassphrase(passPhrase string) GenerateOption
GeneratePassphrase generate a secret with a passphrase.
func GenerateRecipient ¶
func GenerateRecipient(recipient string) GenerateOption
GenerateRecipient generate a secret and send it to recipient.
func GenerateTTL ¶
func GenerateTTL(ttl time.Duration) GenerateOption
GenerateTTL generate a secret with TTL.
type HTTPClient ¶
HTTPClient interface.
type Metadata ¶
type Metadata struct { CustID string `json:"custid"` Value *string `json:"value,omitempty"` MetadataKey string `json:"metadata_key"` SecretKey string `json:"secret_key"` TTL Duration `json:"ttl"` MetadataTTL Duration `json:"metadata_ttl,omitempty"` SecretTTL Duration `json:"secret_ttl,omitempty"` State State `json:"state"` Recipient []string `json:"recipient,omitempty"` PassphraseRequired bool `json:"passphrase_required"` Created Time `json:"created"` Updated Time `json:"updated"` Received *Time `json:"received,omitempty"` }
Metadata of a secret.
type SecretOption ¶
SecretOption secret option.
func SecretPassphrase ¶
func SecretPassphrase(passPhrase string) SecretOption
SecretPassphrase set a passphrase to receive a secret.
type ShareOption ¶
ShareOption share option.
func SharePassphrase ¶
func SharePassphrase(passPhrase string) ShareOption
SharePassphrase share a secret with a passphrase.
func ShareRecipient ¶
func ShareRecipient(recipient string) ShareOption
ShareRecipient share a secret and send it to recipient.
type Time ¶
Time type.
func (*Time) MarshalJSON ¶
MarshalJSON marshal time to json value.
func (*Time) UnmarshalJSON ¶
UnmarshalJSON unmarshal time from json value.