secrets

package
v0.0.66 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package secrets carries opaque references across durable boundaries. Only a live runner session may replace them with plaintext.

Index

Constants

View Source
const WireKey = "$c2j_secret"

Variables

This section is empty.

Functions

func Candidates

func Candidates(v any) []string

Candidates only scans data already loaded by the compiler. It performs no expression evaluation, include resolution, or extension retrieval.

func Contains

func Contains(v any) bool

func ExpandSchema

func ExpandSchema(schema map[string]any) (map[string]any, error)

ExpandSchema admits a reference as the deferred representation of a secret string. ValidateSchema separately enforces that submission uses references.

func HasAnnotation

func HasAnnotation(value any) bool

func InvocationNames

func InvocationNames(t reflect.Type, input any) ([]string, error)

Forwarding fields carry references to a child job and never materialize them in the parent. The child validates its own recipe schema before executing.

func MaterializeInput

func MaterializeInput(s *Session, t reflect.Type, input any) (any, error)

func Names

func Names(v any) ([]string, error)

func Placeholder

func Placeholder(v any) (any, error)

Placeholder is for type validation only and is never used for execution.

func Transform

func Transform(v any, f func(Reference) (any, error)) (any, error)

Transform clones JSON-shaped data; a reserved reference object is atomic.

func ValidateSchema

func ValidateSchema(schema map[string]any, v any, materialized bool) error

Schema annotations apply to string leaves. Unsupported schema constructs cannot implicitly grant permission to a reference.

func ValidateType

func ValidateType(t reflect.Type, v any) error

ValidateType permits native ops to opt in with secret:"true" on string inputs, or secret:"env" on a map of environment variables. Extension payloads use secret:"schema" and are checked against their manifest before invocation.

func WithSession

func WithSession(ctx context.Context, s *Session) context.Context

Types

type Reference

type Reference struct {
	Name string `json:"$c2j_secret" yaml:"$c2j_secret"`
}

func Expression

func Expression(expr string) (Reference, bool)

func Parse

func Parse(v any) (Reference, bool, error)

func Template

func Template(text string) (Reference, bool)

type Resolver

type Resolver func(context.Context, []string) (jobdb.SecretResolveResult, error)

type Session

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

Session belongs to one local invocation of a job, including its task retries. It is deliberately neither serializable nor a process-wide credential cache.

func FromContext

func FromContext(ctx context.Context) *Session

func NewSession

func NewSession() *Session

func (*Session) CheckOutput

func (s *Session) CheckOutput(v any) error

func (*Session) Close

func (s *Session) Close()

func (*Session) Error

func (s *Session) Error(err error) error

Errors with secret-bearing messages lose their unwrap chain: retaining it would let error-chain diagnostics serialize the original plaintext.

func (*Session) GoString

func (*Session) GoString() string

func (*Session) MarshalJSON

func (*Session) MarshalJSON() ([]byte, error)

func (*Session) Materialize

func (s *Session) Materialize(v any) (any, error)

func (*Session) Prepare

func (s *Session) Prepare(ctx context.Context, required, candidates []string, resolve Resolver) error

Prepare serializes fills so concurrent callers reuse an in-flight batch. The small fixed batch also bounds request size for JobDB's default limits. Provider response limits remain authoritative; speculative failures fall back to the current task's names. Missing future names are never negatively cached.

func (*Session) Ready

func (s *Session) Ready(names []string) bool

func (*Session) Redact

func (s *Session) Redact(text string) string

func (*Session) String

func (*Session) String() string

type Sessions

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

Sessions connects a WorkSet's job and task workers, without putting a cache ID or value into a chapter. A second local execution cannot borrow the first's cache; overlapping executions of the same key fail closed.

func NewSessions

func NewSessions() *Sessions

func (*Sessions) Close

func (m *Sessions) Close(key jobdb.JobKey)

func (*Sessions) Get

func (m *Sessions) Get(key jobdb.JobKey) *Session

func (*Sessions) Open

func (m *Sessions) Open(key jobdb.JobKey) (*Session, error)

Jump to

Keyboard shortcuts

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