secrets

package
v0.10.5 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: MIT Imports: 26 Imported by: 0

Documentation

Overview

Package secrets stores worker-local credentials. Values have no network read API.

Index

Constants

View Source
const MaxRemoteMessage = 12 << 10
View Source
const MaxValue = 4096
View Source
const RemoteProtocol = "control-secrets-v1"

Variables

This section is empty.

Functions

func NewManagementKey added in v0.6.0

func NewManagementKey() (*ecdh.PrivateKey, error)

func Open added in v0.6.0

func Open(private *ecdh.PrivateKey, node, name string, e Envelope) (string, error)

func SecureURL added in v0.6.0

func SecureURL(raw string) bool

SecureURL permits authenticated HTTPS or direct loopback development only. Remote HTTP permits key substitution even when secret values are encrypted.

func ValidDeadline added in v0.6.0

func ValidDeadline(expires int64, now time.Time) bool

func ValidManagementKey added in v0.6.0

func ValidManagementKey(key []byte) bool

func ValidName

func ValidName(name string) bool

func ValidRequestID added in v0.6.0

func ValidRequestID(id string) bool

Types

type Envelope added in v0.6.0

type Envelope struct {
	ID         string `json:"id"`
	ExpiresAt  int64  `json:"expiresAt"`
	Key        []byte `json:"key"`
	Nonce      []byte `json:"nonce"`
	Ciphertext []byte `json:"ciphertext"`
}

Envelope carries only ciphertext. Its key is the sender's ephemeral P-256 public key, not the worker's private decryption key.

func Seal added in v0.6.0

func Seal(node, name, value string, public []byte) (Envelope, error)

func (Envelope) Valid added in v0.6.0

func (e Envelope) Valid(now time.Time) bool

type ManagementReply added in v0.6.0

type ManagementReply struct {
	ID      string     `json:"id"`
	Error   string     `json:"error,omitempty"`
	Secrets []Metadata `json:"secrets,omitempty"`
}

ManagementReply has no value field or arbitrary diagnostic text.

type ManagementRequest added in v0.6.0

type ManagementRequest struct {
	ID        string    `json:"id"`
	Operation string    `json:"operation"`
	Name      string    `json:"name,omitempty"`
	ExpiresAt int64     `json:"expiresAt"`
	Envelope  *Envelope `json:"envelope,omitempty"`
}

func (ManagementRequest) Valid added in v0.6.0

func (q ManagementRequest) Valid(now time.Time) bool

type Metadata added in v0.6.0

type Metadata struct {
	Name      string    `json:"name"`
	CreatedAt time.Time `json:"createdAt,omitzero"`
	UpdatedAt time.Time `json:"updatedAt,omitzero"`
}

Metadata describes a secret without its value. Zero timestamps mean unknown.

type Redactor

type Redactor struct {
	// contains filtered or unexported fields
}

Redactor masks exact values and common text encodings. Arbitrary transforms, screenshots, and application-managed files are outside this protection.

func NewRedactor

func NewRedactor(values map[string]string) Redactor

func (Redactor) JSON

func (r Redactor) JSON(data []byte) ([]byte, error)

JSON redacts decoded strings, preserving JSON syntax even for short values.

func (Redactor) Text

func (r Redactor) Text(text string) string

type RemoteList added in v0.6.0

type RemoteList struct {
	Key     []byte     `json:"key"`
	Secrets []Metadata `json:"secrets"`
}

type Store

type Store struct {
	Dir     string
	WorkDir string
}

Store uses private, atomic files, not encryption or an execution sandbox. Keep its directory outside the filesystem API's workspace.

func (Store) Delete

func (s Store) Delete(ctx context.Context, name string) error

func (Store) List added in v0.6.0

func (s Store) List() ([]Metadata, error)

List returns sorted metadata only, never secret values.

func (Store) Names

func (s Store) Names() ([]string, error)

func (Store) Set

func (s Store) Set(ctx context.Context, name, value string) error

func (Store) Snapshot

func (s Store) Snapshot() (map[string]string, error)

Snapshot is for destination-side injection and redaction only, never RPC results.

Jump to

Keyboard shortcuts

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