Documentation
¶
Overview ¶
Package httpKey provides a Service that is a HTTP client to an external key service that can respond to HTTP requests defined here.
Index ¶
- type KeyBySecretRequest
- type RegenerateSecretResponse
- type Service
- func (s Service) CreateKey(ref string, o *key.Options) (k *key.Key, err error)
- func (s Service) DeleteKey(ref string) error
- func (s Service) KeyByRef(ref string) (k *key.Key, err error)
- func (s Service) KeyBySecret(secret string) (k *key.Key, err error)
- func (s Service) Keys(startID string, limit int) (page key.KeysPage, err error)
- func (s Service) RegenerateSecret(ref string) (secret string, err error)
- func (s Service) UpdateKey(ref string, o *key.Options) (k *key.Key, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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.
type Service ¶
type Service struct {
// Client provides HTTP request making functionality.
Client *apiClient.Client
}
Service implements gopherpit.com/gopherpit/services/key.Service interface.
func NewService ¶
func NewService(c *apiClient.Client) *Service
NewService creates a new Service and injects key.ErrorRegistry in the API Client.
func (Service) CreateKey ¶
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 (Service) DeleteKey ¶
DeleteKey deletes an existing Key by making a HTTP DELETE request to {Client.Endpoint}/keys/{ref}.
func (Service) KeyByRef ¶
KeyByRef retrieves a Key instance by making a HTTP GET request to {Client.Endpoint}/keys/{ref}.
func (Service) KeyBySecret ¶
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 (Service) Keys ¶
Keys retrieves a paginated list of Key instances by making a HTTP GET request to {Client.Endpoint}/keys.
func (Service) RegenerateSecret ¶
RegenerateSecret generates a new secret key by making a HTTP POST request to {Client.Endpoint}/keys/{ref}/secret.