manage

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2026 License: MIT Imports: 20 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

Constants

This section is empty.

Variables

View Source
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 CTSActor

type CTSActor = cts.Actor

CTSActor is a machine identity. Its access key has a separate identifier.

type CTSActorKind

type CTSActorKind = cts.ActorKind

These service-qualified types alias CipherStash's generated API types. Their fields and pointer choices come from the overlays beside each spec.

type CTSActorPage

type CTSActorPage = cts.ActorPage

CTSActorPage is one page of actors. Pass NextCursor to the next call until it is empty.

type CTSRole

type CTSRole = cts.Role

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

func (c *Client) DeleteCTSActor(ctx context.Context, id string) error

DeleteCTSActor deletes the actor and its access key. Tokens already issued for that key may remain usable until they expire.

func (*Client) DeleteZeroKMSClient

func (c *Client) DeleteZeroKMSClient(ctx context.Context, id string) error

DeleteZeroKMSClient deletes the client with the given UUID.

func (*Client) DisableZeroKMSKeyset

func (c *Client) DisableZeroKMSKeyset(ctx context.Context, id string) error

DisableZeroKMSKeyset disables the keyset with the given UUID. Keysets cannot be deleted.

func (*Client) EnableZeroKMSKeyset

func (c *Client) EnableZeroKMSKeyset(ctx context.Context, id string) error

EnableZeroKMSKeyset enables the keyset with the given UUID.

func (*Client) GrantZeroKMSKeyset

func (c *Client) GrantZeroKMSKeyset(ctx context.Context, keysetID, clientID string) error

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.

func (*Client) RevokeZeroKMSKeyset

func (c *Client) RevokeZeroKMSKeyset(ctx context.Context, keysetID, clientID string) error

RevokeZeroKMSKeyset revokes a client's access to a keyset. Both IDs are UUIDs.

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

type CreatedCTSActor struct {
	CTSActor

	Role CTSRole
	// contains filtered or unexported fields
}

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

type HTTPError struct {
	Service    string
	StatusCode int
}

HTTPError reports a non-2xx administration response. It never includes the response body, which can contain credentials.

func (*HTTPError) Error

func (e *HTTPError) Error() string

func (*HTTPError) Unwrap

func (e *HTTPError) Unwrap() error

type ListCTSActorsOptions

type ListCTSActorsOptions struct {
	Limit  int
	Cursor string
}

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

type ModifyZeroKMSKeysetOptions struct {
	Name        *string
	Description *string
}

ModifyZeroKMSKeysetOptions leaves nil fields unchanged. A non-nil pointer sends its value, including an empty string, for the service to validate.

type ZeroKMSClient

type ZeroKMSClient struct {
	ID          string
	Name        string
	Description string
	KeysetIDs   []string
}

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.

type ZeroKMSKeyset

type ZeroKMSKeyset struct {
	ID          string
	Name        string
	Description string
	IsDisabled  bool
	IsDefault   bool
}

ZeroKMSKeyset describes a ZeroKMS keyset without exposing key material.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL