Documentation
¶
Overview ¶
Package manage administers CipherStash keysets, encryption clients and grants through ZeroKMS, and actors and access-key metadata through CTS. Domain types and operations use CTS or ZeroKMS names to identify their service; Client is the shared administrative client, not a ZeroKMS encryption identity.
Index ¶
- Variables
- type CTSAccessKeyMetadata
- type CTSActor
- type CTSActorKind
- type CTSActorPage
- type CTSRole
- type Client
- func (c *Client) CreateCTSActor(ctx context.Context, opts CreateCTSActorOptions) (*CreatedCTSActor, error)
- func (c *Client) CreateZeroKMSClient(ctx context.Context, opts CreateZeroKMSClientOptions) (*CreatedZeroKMSClient, error)
- func (c *Client) CreateZeroKMSKeyset(ctx context.Context, opts CreateZeroKMSKeysetOptions) (*CreatedZeroKMSKeyset, error)
- func (c *Client) DeleteCTSActor(ctx context.Context, id string) error
- func (c *Client) DeleteZeroKMSClient(ctx context.Context, id string) error
- func (c *Client) DisableZeroKMSKeyset(ctx context.Context, id string) error
- func (c *Client) EnableZeroKMSKeyset(ctx context.Context, id string) error
- func (c *Client) GrantZeroKMSKeyset(ctx context.Context, keysetID, clientID string) error
- func (c *Client) ListCTSAccessKeys(ctx context.Context) ([]CTSAccessKeyMetadata, error)
- func (c *Client) ListCTSActors(ctx context.Context, opts ListCTSActorsOptions) (CTSActorPage, error)
- func (c *Client) ListZeroKMSClients(ctx context.Context, opts ListZeroKMSClientsOptions) ([]ZeroKMSClient, error)
- func (c *Client) ListZeroKMSKeysets(ctx context.Context, opts ListZeroKMSKeysetsOptions) ([]ZeroKMSKeyset, error)
- func (c *Client) ModifyZeroKMSKeyset(ctx context.Context, id string, opts ModifyZeroKMSKeysetOptions) error
- func (c *Client) RevokeZeroKMSKeyset(ctx context.Context, keysetID, clientID string) error
- type ClientOption
- type Config
- type CreateCTSActorOptions
- type CreateZeroKMSClientOptions
- type CreateZeroKMSKeysetClientOptions
- type CreateZeroKMSKeysetOptions
- type CreatedCTSActor
- type CreatedZeroKMSClient
- type CreatedZeroKMSKeyset
- type HTTPError
- type ListCTSActorsOptions
- type ListZeroKMSClientsOptions
- type ListZeroKMSKeysetsOptions
- type ModifyZeroKMSKeysetOptions
- type ZeroKMSClient
- type ZeroKMSClientType
- type ZeroKMSKeyset
Constants ¶
This section is empty.
Variables ¶
var ( ErrConfig = auth.ErrConfig ErrAuthentication = auth.ErrAuthentication ErrTransport = auth.ErrTransport ErrResponse = auth.ErrResponse ErrForbidden = errors.New("cipherstash: operation forbidden") ErrNotFound = errors.New("cipherstash: resource not found") ErrConflict = errors.New("cipherstash: resource conflict") ErrSecretConsumed = errors.New("cipherstash: creation secret already consumed") )
Failure categories. The first four are the same values as auth's, so one errors.Is check covers authentication and administration failures.
Functions ¶
This section is empty.
Types ¶
type CTSAccessKeyMetadata ¶
type CTSAccessKeyMetadata = cts.AccessKeyMetadata
CTSAccessKeyMetadata describes an access key without its secret.
type CTSActorKind ¶
These service-qualified types alias CipherStash's generated API types. Their fields and pointer choices come from the overlays beside each spec.
type CTSActorPage ¶
CTSActorPage is one page of actors. Pass NextCursor to the next call until it is empty.
type CTSRole ¶
These service-qualified types alias CipherStash's generated API types. Their fields and pointer choices come from the overlays beside each spec.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client administers one workspace through the generated CTS and ZeroKMS clients. It never retries a request. The service authorises each operation.
func NewClient ¶
func NewClient(crn auth.CRN, tokens oauth2.TokenSource, opts ...ClientOption) (*Client, error)
NewClient makes no network request. tokens must come from auth.NewTokenSource, which attaches the verified ZeroKMS endpoint to each token. The caller keeps ownership of tokens and its lifetime context.
func (*Client) CreateCTSActor ¶
func (c *Client) CreateCTSActor(ctx context.Context, opts CreateCTSActorOptions) (*CreatedCTSActor, error)
CreateCTSActor is not retried. After a transport or response error the actor may exist; reconcile with ListCTSActors before creating it again.
func (*Client) CreateZeroKMSClient ¶
func (c *Client) CreateZeroKMSClient(ctx context.Context, opts CreateZeroKMSClientOptions) (*CreatedZeroKMSClient, error)
CreateZeroKMSClient is not retried. After a transport or response error the client may exist; reconcile with ListZeroKMSClients before creating it again.
func (*Client) CreateZeroKMSKeyset ¶
func (c *Client) CreateZeroKMSKeyset(ctx context.Context, opts CreateZeroKMSKeysetOptions) (*CreatedZeroKMSKeyset, error)
CreateZeroKMSKeyset is not retried. After a transport or response error the keyset may exist; reconcile with ListZeroKMSKeysets before creating it again.
func (*Client) DeleteCTSActor ¶
DeleteCTSActor deletes the actor and its access key. Tokens already issued for that key may remain usable until they expire.
func (*Client) DeleteZeroKMSClient ¶
DeleteZeroKMSClient deletes the client with the given UUID.
func (*Client) DisableZeroKMSKeyset ¶
DisableZeroKMSKeyset disables the keyset with the given UUID. Keysets cannot be deleted.
func (*Client) EnableZeroKMSKeyset ¶
EnableZeroKMSKeyset enables the keyset with the given UUID.
func (*Client) GrantZeroKMSKeyset ¶
GrantZeroKMSKeyset grants a client access to a keyset. Both IDs are UUIDs.
func (*Client) ListCTSAccessKeys ¶
func (c *Client) ListCTSAccessKeys(ctx context.Context) ([]CTSAccessKeyMetadata, error)
ListCTSAccessKeys returns every access key's metadata; the service does not paginate them.
func (*Client) ListCTSActors ¶
func (c *Client) ListCTSActors(ctx context.Context, opts ListCTSActorsOptions) (CTSActorPage, error)
func (*Client) ListZeroKMSClients ¶
func (c *Client) ListZeroKMSClients(ctx context.Context, opts ListZeroKMSClientsOptions) ([]ZeroKMSClient, error)
ListZeroKMSClients returns every matching client; the service does not paginate them.
func (*Client) ListZeroKMSKeysets ¶
func (c *Client) ListZeroKMSKeysets(ctx context.Context, opts ListZeroKMSKeysetsOptions) ([]ZeroKMSKeyset, error)
ListZeroKMSKeysets returns every keyset; the service does not paginate them.
func (*Client) ModifyZeroKMSKeyset ¶
func (c *Client) ModifyZeroKMSKeyset(ctx context.Context, id string, opts ModifyZeroKMSKeysetOptions) error
ModifyZeroKMSKeyset changes metadata for the keyset with the given UUID.
type ClientOption ¶
type ClientOption func(*clientOptions)
func WithCTSURL ¶
func WithCTSURL(ctsURL *url.URL) ClientOption
WithCTSURL sends CTS administration requests to ctsURL instead of the workspace region's CTS. It must be an HTTPS URL, or HTTP to a loopback host, without credentials, query or fragment. Pass the same URL to auth.WithCTSURL.
func WithTransport ¶
func WithTransport(transport http.RoundTripper) ClientOption
WithTransport sets the transport for administration requests. It does not affect the token source's requests. The client still sets a 10-second timeout per request and never follows redirects. The default is http.DefaultTransport.
type Config ¶
type Config[K auth.AccessKey] struct { WorkspaceCRN auth.CRN `env:"CS_WORKSPACE_CRN,required"` ClientAccessKey K `env:"CS_CLIENT_ACCESS_KEY,required"` }
Config holds workspace credentials using the Terraform provider's environment names. Use a concrete auth.ControlAccessKey, auth.AdminAccessKey or auth.MemberAccessKey for K to select the role policy. Decoding validates syntax; token verification enforces the role. Application client IDs belong in the consumer's configuration.
type CreateCTSActorOptions ¶
type CreateCTSActorOptions = cts.CreateActorOptions
CreateCTSActorOptions describes an app or agent and its access key's role. An empty Role and nil TokenExpiry (in seconds) select the service defaults.
type CreateZeroKMSClientOptions ¶
type CreateZeroKMSClientOptions = zerokms.CreateClientOptions
CreateZeroKMSClientOptions creates a client with an initial grant. KeysetID is a UUID; empty selects the workspace's default keyset.
type CreateZeroKMSKeysetClientOptions ¶
type CreateZeroKMSKeysetClientOptions = zerokms.CreateKeysetClientOptions
CreateZeroKMSKeysetClientOptions requests a client alongside a new keyset. ClientType must be "device", the service's supported client type.
type CreateZeroKMSKeysetOptions ¶
type CreateZeroKMSKeysetOptions = zerokms.CreateKeysetOptions
CreateZeroKMSKeysetOptions describes a new keyset. A nil Client creates no client.
type CreatedCTSActor ¶
CreatedCTSActor holds the actor's metadata and its once-returned access key. CreatedAt is empty because CTS does not return it on creation; ListCTSActors reports it. Copies share one extraction right: export the key once, or wipe it.
func (*CreatedCTSActor) ExportAccessKey ¶
func (a *CreatedCTSActor) ExportAccessKey() ([]byte, error)
ExportAccessKey returns the encoded access key for persistence. The caller owns the bytes and should clear them after use. Later calls on this result or any copy return ErrSecretConsumed.
func (CreatedCTSActor) Format ¶
func (CreatedCTSActor) Format(f fmt.State, _ rune)
Format redacts the result for every fmt verb, including in logs.
func (*CreatedCTSActor) Wipe ¶
func (a *CreatedCTSActor) Wipe()
Wipe clears an access key that will not be exported. It is nil-safe and idempotent.
type CreatedZeroKMSClient ¶
type CreatedZeroKMSClient struct {
ZeroKMSClient
KeysetID string
// contains filtered or unexported fields
}
CreatedZeroKMSClient holds the client's metadata and its once-returned key. Copies share one extraction right: export the key once, or wipe it.
func (*CreatedZeroKMSClient) ExportClientKey ¶
func (c *CreatedZeroKMSClient) ExportClientKey() ([]byte, error)
ExportClientKey returns the base64-encoded client key for persistence. The caller owns the bytes and should clear them after use. Later calls on this result or any copy return ErrSecretConsumed.
func (CreatedZeroKMSClient) Format ¶
func (CreatedZeroKMSClient) Format(f fmt.State, _ rune)
Format redacts the result for every fmt verb, including in logs.
func (*CreatedZeroKMSClient) Wipe ¶
func (c *CreatedZeroKMSClient) Wipe()
Wipe clears a client key that will not be exported. It is nil-safe and idempotent.
type CreatedZeroKMSKeyset ¶
type CreatedZeroKMSKeyset struct {
ZeroKMSKeyset
Client *CreatedZeroKMSClient
}
CreatedZeroKMSKeyset includes the optional client created with the keyset. Export or wipe that client's key through the Client field.
type HTTPError ¶
HTTPError reports a non-2xx administration response. It never includes the response body, which can contain credentials.
type ListCTSActorsOptions ¶
ListCTSActorsOptions selects one page. Zero Limit and empty Cursor select the service defaults and the first page.
type ListZeroKMSClientsOptions ¶
type ListZeroKMSClientsOptions struct {
KeysetID string
}
ListZeroKMSClientsOptions filters by a keyset UUID; empty lists every client.
type ListZeroKMSKeysetsOptions ¶
type ListZeroKMSKeysetsOptions = zerokms.ListKeysetsOptions
ListZeroKMSKeysetsOptions includes disabled keysets when ShowDisabled is true.
type ModifyZeroKMSKeysetOptions ¶
ModifyZeroKMSKeysetOptions leaves nil fields unchanged. A non-nil pointer sends its value, including an empty string, for the service to validate.
type ZeroKMSClient ¶
ZeroKMSClient is a ZeroKMS client identity, distinct from the administrative Client. KeysetIDs lists every keyset it is granted.
type ZeroKMSClientType ¶
type ZeroKMSClientType = zerokms.ClientType
These service-qualified types alias CipherStash's generated API types. Their fields and pointer choices come from the overlays beside each spec.