Documentation ¶
Overview ¶
Package httpKey provides a HTTP client to an external key service that can respond to HTTP requests defined here.
Index ¶
- Variables
- type Client
- func (c Client) CreateKey(ref string, o *key.Options) (k *key.Key, err error)
- func (c Client) DeleteKey(ref string) error
- func (c Client) KeyByRef(ref string) (k *key.Key, err error)
- func (c Client) KeyBySecret(secret string) (k *key.Key, err error)
- func (c Client) Keys(startID string, limit int) (page key.KeysPage, err error)
- func (c Client) RegenerateSecret(ref string) (secret string, err error)
- func (c Client) UpdateKey(ref string, o *key.Options) (k *key.Key, err error)
- type KeyBySecretRequest
- type RegenerateSecretResponse
Constants ¶
This section is empty.
Variables ¶
var ( ErrKeyNotFound = errorRegistry.MustAddMessageError(1000, "Key Not Found") ErrKeyRefAlreadyExists = errorRegistry.MustAddMessageError(1001, "Key Reference Already Exists") ErrKeyRefRequired = errorRegistry.MustAddMessageError(1002, "Key Reference Required") )
Errors that are returned from the HTTP server.
Functions ¶
This section is empty.
Types ¶
type Client ¶ added in v0.5.2
type Client struct {
*apiClient.Client
}
Client implements gopherpit.com/gopherpit/services/key.Service interface.
func NewClient ¶ added in v0.5.2
func NewClient(c *apiClient.Client) *Client
NewClient creates a new Client.
func (Client) CreateKey ¶ added in v0.5.2
CreateKey creates a new Key with Options by making a HTTP POST request to {Client.Endpoint}/keys/{ref}. Post body is a JSON-encoded key.Options instance.
func (Client) DeleteKey ¶ added in v0.5.2
DeleteKey deletes an existing Key by making a HTTP DELETE request to {Client.Endpoint}/keys/{ref}.
func (Client) KeyByRef ¶ added in v0.5.2
KeyByRef retrieves a Key instance by making a HTTP GET request to {Client.Endpoint}/keys/{ref}.
func (Client) KeyBySecret ¶ added in v0.5.2
KeyBySecret validates a password of an existing User by making a HTTP POST request to {Client.Endpoint}/authenticate. Request body is a JSON-encoded KeyBySecretRequest instance. Expected response body is a JSON-encoded instance of key.Key.
func (Client) Keys ¶ added in v0.5.2
Keys retrieves a paginated list of Key instances by making a HTTP GET request to {Client.Endpoint}/keys.
func (Client) RegenerateSecret ¶ added in v0.5.2
RegenerateSecret generates a new secret key by making a HTTP POST request to {Client.Endpoint}/keys/{ref}/secret.
type KeyBySecretRequest ¶
type KeyBySecretRequest struct {
Secret string `json:"secret"`
}
KeyBySecretRequest is a structure that is passed as JSON-encoded body to KeyBySecret HTTP request.
type RegenerateSecretResponse ¶
type RegenerateSecretResponse struct {
Secret string `json:"secret"`
}
RegenerateSecretResponse is a structure that is returned as JSON-encoded body from RegenerateSecret HTTP request.