Documentation
¶
Index ¶
- Constants
- Variables
- type Client
- func (c *Client) GetKey(ctx context.Context, search []byte) (keyText string, err error)
- func (c *Client) GetVersion(ctx context.Context) (vi VersionInfo, err error)
- func (c *Client) NewRequest(method, path, rawQuery string, body io.Reader) (r *http.Request, err error)
- func (c *Client) PKSAdd(ctx context.Context, keyText string) error
- func (c *Client) PKSLookup(ctx context.Context, pd *PageDetails, search, operation string, ...) (response string, err error)
- type Config
- type PageDetails
- type VersionInfo
Constants ¶
const ( // OperationGet is a PKSLookup operation value to perform a "get" operation. OperationGet = "get" // OperationIndex is a PKSLookup operation value to perform a "index" operation. OperationIndex = "index" // OperationVIndex is a PKSLookup operation value to perform a "vindex" operation. OperationVIndex = "vindex" )
const OptionMachineReadable = "mr"
OptionMachineReadable is a PKSLookup options value to return machine readable output.
Variables ¶
var ( // ErrInvalidKeyText is returned when the key text is invalid. ErrInvalidKeyText = errors.New("invalid key text") // ErrInvalidSearch is returned when the search value is invalid. ErrInvalidSearch = errors.New("invalid search") // ErrInvalidOperation is returned when the operation is invalid. ErrInvalidOperation = errors.New("invalid operation") )
var DefaultConfig = &Config{}
DefaultConfig is a configuration that uses default values.
var ( // ErrTLSRequired is returned when an auth token is supplied with a non-TLS BaseURL. ErrTLSRequired = errors.New("TLS required when auth token provided") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { // Base URL of the service. BaseURL *url.URL // Auth token to include in the Authorization header of each request (if supplied). AuthToken string // User agent to include in each request (if supplied). UserAgent string // HTTPClient to use to make HTTP requests. HTTPClient *http.Client }
Client describes the client details.
func NewClient ¶
NewClient sets up a new Key Service client with the specified base URL and auth token.
func (*Client) GetKey ¶
GetKey retrieves an ASCII armored keyring matching search from the Key Service. A 32-bit key ID, 64-bit key ID, 128-bit version 3 fingerprint, or 160-bit version 4 fingerprint can be specified in search. The context controls the lifetime of the request.
func (*Client) GetVersion ¶
func (c *Client) GetVersion(ctx context.Context) (vi VersionInfo, err error)
GetVersion gets version information from the Key Service. The context controls the lifetime of the request.
func (*Client) NewRequest ¶ added in v0.5.0
func (c *Client) NewRequest(method, path, rawQuery string, body io.Reader) (r *http.Request, err error)
NewRequest returns a new Request given a method, path, query, and optional body. The path may be relative or absolute.
func (*Client) PKSAdd ¶
PKSAdd submits an ASCII armored keyring to the Key Service, as specified in section 4 of the OpenPGP HTTP Keyserver Protocol (HKP) specification. The context controls the lifetime of the request.
func (*Client) PKSLookup ¶
func (c *Client) PKSLookup(ctx context.Context, pd *PageDetails, search, operation string, fingerprint, exact bool, options []string) (response string, err error)
PKSLookup requests data from the Key Service, as specified in section 3 of the OpenPGP HTTP Keyserver Protocol (HKP) specification. The context controls the lifetime of the request.
type Config ¶
type Config struct { // Base URL of the service (https://keys.sylabs.io is used if not supplied). BaseURL string // Auth token to include in the Authorization header of each request (if supplied). AuthToken string // User agent to include in each request (if supplied). UserAgent string // HTTPClient to use to make HTTP requests (if supplied). HTTPClient *http.Client }
Config contains the client configuration.
type PageDetails ¶
type PageDetails struct { // Maximum number of results per page (server may ignore or return fewer). Size int // Token for next page (advanced with each request, empty for last page). Token string }
PageDetails includes pagination details.
type VersionInfo ¶
type VersionInfo struct {
Version string `json:"version"`
}
VersionInfo contains version information.