Documentation
¶
Overview ¶
Package secrets carries opaque references across durable boundaries. Only a live runner session may replace them with plaintext.
Index ¶
- Constants
- func ApplySchemaDefaults(schema map[string]any, value any) (any, error)
- func Contains(v any) bool
- func ExpandSchema(schema map[string]any) (map[string]any, error)
- func HasAnnotation(value any) bool
- func HasOmission(v any) bool
- func InvocationNames(t reflect.Type, input any) ([]string, error)
- func MaterializeInput(s *Session, t reflect.Type, input any) (any, error)
- func MaterializeInputWithUnsetEnv(s *Session, t reflect.Type, input any) (any, []string, error)
- func Names(v any) ([]string, error)
- func Placeholder(v any) (any, error)
- func Transform(v any, f func(Reference) (any, error)) (any, error)
- func ValidateDefault(value any) error
- func ValidateSchema(schema map[string]any, v any, materialized bool) error
- func ValidateType(t reflect.Type, v any) error
- func WithSession(ctx context.Context, s *Session) context.Context
- type Redactor
- func (s *Redactor) CheckOutput(v any) error
- func (s *Redactor) Close()
- func (s *Redactor) Error(err error) error
- func (*Redactor) GoString() string
- func (*Redactor) MarshalJSON() ([]byte, error)
- func (s *Redactor) NewTask() *Session
- func (s *Redactor) Redact(text string) string
- func (*Redactor) String() string
- type Reference
- type Resolver
- type Session
- func (s *Session) CheckOutput(value any) error
- func (s *Session) Close()
- func (s *Session) Error(err error) error
- func (*Session) GoString() string
- func (*Session) MarshalJSON() ([]byte, error)
- func (s *Session) Materialize(v any) (any, error)
- func (s *Session) Prepare(ctx context.Context, names []string, resolve Resolver) error
- func (s *Session) PrepareReferences(ctx context.Context, refs []Reference, resolve Resolver) error
- func (s *Session) Ready(names []string) bool
- func (s *Session) Redact(text string) string
- func (*Session) String() string
- type Sessions
Constants ¶
const WireKey = "$c2j_secret"
Variables ¶
This section is empty.
Functions ¶
func ApplySchemaDefaults ¶ added in v0.0.67
ApplySchemaDefaults attaches fallbacks to secret bindings, including omitted inputs. It never substitutes a named secret or evaluates default strings.
func ExpandSchema ¶
ExpandSchema admits a reference as the deferred representation of a secret string. ValidateSchema separately enforces that submission uses references.
func HasAnnotation ¶
func HasOmission ¶ added in v0.0.67
func InvocationNames ¶
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 MaterializeInputWithUnsetEnv ¶ added in v0.0.67
func Placeholder ¶
Placeholder is for type validation only and is never used for execution.
func ValidateDefault ¶ added in v0.0.67
ValidateDefault checks public literal defaults; they are never evaluated.
func ValidateSchema ¶
Schema annotations apply to string leaves. Unsupported schema constructs cannot implicitly grant permission to a reference.
func ValidateType ¶
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.
Types ¶
type Redactor ¶ added in v0.0.67
type Redactor struct {
// contains filtered or unexported fields
}
Redactor remembers secret material only to prevent disclosure across tasks. It has no name-to-value lookup and is cleared when the local execution ends.
func (*Redactor) CheckOutput ¶ added in v0.0.67
func (*Redactor) Error ¶ added in v0.0.67
Errors with secret-bearing messages lose their unwrap chain: retaining it would let error-chain diagnostics serialize the original plaintext.
func (*Redactor) MarshalJSON ¶ added in v0.0.67
type Reference ¶
type Reference struct {
Name string `json:"$c2j_secret" yaml:"$c2j_secret"`
Default *string `json:"default,omitempty" yaml:"default,omitempty"`
// Required preserves a recipe's constraint when a null fallback is forwarded.
Required bool `json:"required,omitempty" yaml:"required,omitempty"`
}
Reference holds an opaque name and an optional public fallback. An empty name with a fallback represents an omitted input with a schema default.
func Expression ¶
func InvocationReferences ¶ added in v0.0.67
InvocationReferences excludes references forwarded to child jobs.
func WithDefault ¶ added in v0.0.67
WithDefault attaches a public fallback without overriding an explicit fallback.
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session contains only one task attempt's transient secret values. Cross-task reuse belongs to JobDB; the shared Redactor cannot resolve names.
func FromContext ¶
func NewSession ¶
func NewSession() *Session
func (*Session) CheckOutput ¶
func (*Session) MarshalJSON ¶
func (*Session) PrepareReferences ¶ added in v0.0.67
PrepareReferences batches only the current task's names. Every preparation calls the task-context API; JobDB owns execution-scoped caching and coalescing.
type Sessions ¶
type Sessions struct {
// contains filtered or unexported fields
}
Sessions shares redaction tracking across a local job execution. It never stores names or values for materializing task inputs.
func NewSessions ¶
func NewSessions() *Sessions