secrets

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package secrets implements the client-side Podplane Secrets aggregated API calls used by `podplane secret`.

Index

Constants

View Source
const (
	// APIGroupVersion is the Podplane Secrets aggregated API group/version.
	APIGroupVersion = "secrets-api.podplane.dev/v1beta1"
)
View Source
const Algorithm = "x25519-hkdf-sha256-aes-256-gcm"

Algorithm is the supported client-side write encryption algorithm.

Variables

This section is empty.

Functions

func AssociatedData

func AssociatedData(opts WriteOptions) []byte

AssociatedData returns the AES-GCM associated data for one secret value.

func DecodePublicKey

func DecodePublicKey(value string) ([]byte, error)

DecodePublicKey accepts padded standard base64 or unpadded base64url public keys.

func EncryptWriteValue

func EncryptWriteValue(recipient string, plaintext, associatedData []byte) (string, error)

EncryptWriteValue encrypts one secret write value for the operator public key.

func IsStalePublicKeyError

func IsStalePublicKeyError(err error) bool

IsStalePublicKeyError reports whether an API error indicates key rotation.

func KeyspaceName

func KeyspaceName(provider, spc string) string

KeyspaceName returns the SecretProviderKeyspace name for provider and binding/SPC.

func ResolveProvider

func ResolveProvider(summary config.ClusterSummary, requested string) (string, error)

ResolveProvider returns the requested secrets provider or the cluster default.

func SummaryHasProvider

func SummaryHasProvider(summary config.ClusterSummary, provider string) bool

SummaryHasProvider reports whether the cached cluster summary includes provider.

func ValidateKey

func ValidateKey(key string) error

ValidateKey validates a Podplane secret key name.

func ValidateProviderName

func ValidateProviderName(provider string) error

ValidateProviderName validates a configured secrets provider name.

func ValidateScopeName

func ValidateScopeName(name, value string) error

ValidateScopeName validates a namespace or SecretProviderClass scope name.

Types

type Client

type Client struct {
	Context    string
	Kubeconfig string
}

Client shells out to kubectl so aggregated API calls use the user's normal kubeconfig credentials and auth plugins.

func (Client) Delete

func (c Client) Delete(namespace, keyspaceName, key string, destroy bool) error

Delete archives or destroys keys under one provider/SPC boundary.

func (Client) EncryptedRequest

func (c Client) EncryptedRequest(opts WriteOptions) (SecretProviderKeyspace, error)

EncryptedRequest builds an encrypted SecretProviderKeyspace write request.

func (Client) Get

func (c Client) Get(namespace, keyspaceName string) (SecretProviderKeyspace, error)

Get returns metadata for one provider/SPC boundary.

func (Client) PublicKey

func (c Client) PublicKey() (PublicKey, error)

PublicKey fetches publickeys/latest.

func (Client) Put

Put sends a named SecretProviderKeyspace update.

func (Client) PutEncrypted

func (c Client) PutEncrypted(request SecretProviderKeyspace, opts WriteOptions) (SecretProviderKeyspace, error)

PutEncrypted sends an encrypted write request and retries once after key rotation.

type EncryptedValue

type EncryptedValue struct {
	KeyID      string `json:"keyID" yaml:"keyID"`
	Algorithm  string `json:"algorithm" yaml:"algorithm"`
	Ciphertext string `json:"ciphertext" yaml:"ciphertext"`
}

EncryptedValue carries client-side encrypted secret material.

type EntryRequest

type EntryRequest struct {
	Key            string          `json:"key" yaml:"key"`
	Operation      string          `json:"operation" yaml:"operation"`
	EncryptedValue *EncryptedValue `json:"encryptedValue,omitempty" yaml:"encryptedValue,omitempty"`
}

EntryRequest is one SecretProviderKeyspace entry operation.

type EntryStatus

type EntryStatus struct {
	Key          string `json:"key" yaml:"key"`
	Status       string `json:"status" yaml:"status"`
	BackendPath  string `json:"backendPath,omitempty" yaml:"backendPath,omitempty"`
	RestoreUntil string `json:"restoreUntil,omitempty" yaml:"restoreUntil,omitempty"`
}

EntryStatus is one metadata-only backend key status.

type KeyspaceMeta

type KeyspaceMeta struct {
	Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`
	Name      string `json:"name" yaml:"name"`
}

KeyspaceMeta identifies a SecretProviderKeyspace resource.

type KeyspaceSpec

type KeyspaceSpec struct {
	Entries []EntryRequest `json:"entries" yaml:"entries"`
}

KeyspaceSpec contains requested entry operations.

type KeyspaceStatus

type KeyspaceStatus struct {
	Provider string        `json:"provider,omitempty" yaml:"provider,omitempty"`
	Entries  []EntryStatus `json:"entries,omitempty" yaml:"entries,omitempty"`
}

KeyspaceStatus contains backend-derived metadata only.

type PublicKey

type PublicKey struct {
	APIVersion string `json:"apiVersion,omitempty" yaml:"apiVersion,omitempty"`
	Kind       string `json:"kind,omitempty" yaml:"kind,omitempty"`
	Metadata   struct {
		Name string `json:"name,omitempty" yaml:"name,omitempty"`
	} `json:"metadata,omitempty" yaml:"metadata,omitempty"`
	Spec PublicKeySpec `json:"spec" yaml:"spec"`
}

PublicKey is the Kubernetes-style public key object returned by the operator.

type PublicKeySpec

type PublicKeySpec struct {
	KeyID     string `json:"keyID" yaml:"keyID"`
	CreatedAt string `json:"createdAt,omitempty" yaml:"createdAt,omitempty"`
	Algorithm string `json:"algorithm" yaml:"algorithm"`
	PublicKey string `json:"publicKey" yaml:"publicKey"`
}

PublicKeySpec describes the current operator encryption public key.

type SecretProviderKeyspace

type SecretProviderKeyspace struct {
	APIVersion string         `json:"apiVersion" yaml:"apiVersion"`
	Kind       string         `json:"kind" yaml:"kind"`
	Metadata   KeyspaceMeta   `json:"metadata" yaml:"metadata"`
	Spec       *KeyspaceSpec  `json:"spec,omitempty" yaml:"spec,omitempty"`
	Status     KeyspaceStatus `json:"status,omitempty" yaml:"status,omitempty"`
}

SecretProviderKeyspace is the Kubernetes-style SecretProviderKeyspace object.

func NewKeyspaceRequest

func NewKeyspaceRequest(namespace, keyspaceName, key, operation string, encrypted *EncryptedValue) SecretProviderKeyspace

NewKeyspaceRequest builds a one-entry SecretProviderKeyspace request.

type WriteOptions

type WriteOptions struct {
	Namespace    string
	KeyspaceName string
	ClusterID    string
	Key          string
	Operation    string
	Value        []byte
}

WriteOptions describes one encrypted SecretProviderKeyspace write request.

Jump to

Keyboard shortcuts

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