Documentation
¶
Overview ¶
Package secret has the type of a secret in the three DSLs: Value, a reference, secret://<vault>/<key>, or a literal value. A field of this type is a secret: the spec makes it write-only, validate keeps it out of a span and a URL, the CLI refuses a literal in a flag, and each record shows the reference, or [redacted] for a literal. Only Reveal gives the value.
Index ¶
- Constants
- func Describe(doc string) string
- func Fields(t reflect.Type) []string
- func Has(x any) bool
- func Is(t reflect.Type) bool
- func Map(x any, fn func(v Value) (Value, error)) error
- func Parse(ref string) (string, string, error)
- func Plain(x any) any
- func PlainFunc(x any, fn func(v Value) string) any
- func References(x any) []string
- func Resolve(x any, fn func(ref string) (string, error)) error
- func Unresolved(ref string) error
- type Value
Constants ¶
const Redacted = "[redacted]"
Redacted is what a literal value shows as, in each record.
const Scheme = "secret://"
Scheme starts each reference: secret://<vault>/<key>.
const Takes = "A secret: a reference, secret://<vault>/<key>, or the value."
Takes is what a secret field takes, as its description in the spec, the docs and method get says.
Variables ¶
This section is empty.
Functions ¶
func Fields ¶
Fields are the JSON names of the fields of t, a struct or a pointer to one, that hold a secret, at each depth: the names that the audit redacts.
func Is ¶
Is reports whether a field of type t holds a secret: a Value, or a pointer, a slice, an array or a map of them, such as map[string]secret.Value.
func Map ¶
Map replaces each Value in *x that is not empty, at each depth, with the Value that fn gives for it: the agent opens each sealed value with it. x is a pointer. The first error of fn stops it, and is its error, and the Value that failed stays as it was.
func Parse ¶
Parse is the vault and the key of the reference ref, secret://<vault>/<key>. A ref that is not a reference, or that has no vault or no key, is an error that gives the form.
func Plain ¶
Plain is a copy of x in which each Value is a string, so it marshals its value: the CLI sends the request with it, and the dispatch of a behavior queues the job with it. Each other marshal of x gives the reference, or Redacted. A struct that holds a secret becomes a struct of the same fields and tags, so JSON reads it as it reads x. x is as it is when it holds no secret.
func PlainFunc ¶
PlainFunc is Plain, with each Value that is not empty as fn gives it: the job client seals each value of a job with it. An empty Value stays empty.
func References ¶
References are the references in x, at each depth, in the order of its fields, with the keys of a map in order.
func Resolve ¶
Resolve replaces each reference in *x, at each depth, with the value that fn gives for it. x is a pointer. The first error of fn stops it, and is its error.
func Unresolved ¶
Unresolved is the error of the reference ref, which no vault resolves. A command of the command DSL has no vault yet, so it refuses each reference with it: a reference is never sent as the value.
Types ¶
type Value ¶
type Value string
Value is a secret: a reference, such as secret://default/registry-token, or a literal value. String, Format, MarshalJSON and LogValue give the reference, or Redacted for a literal, so a log line, a span, a chain record or an audit entry never has the value. Reveal gives it, where a provider gives it to a command's standard input, an environment or a file. The route of each method resolves a reference from its vault, before the handler gets the input.
It is a string to JSON and to the validate tags, so a request carries it as a string and no_linebreak checks it as one. A conversion to string gives the value too: use Reveal, which a reader can find.
func (Value) Format ¶
Format prints String with each verb, so %v, %s, %q and %#v never print a literal value.
func (Value) IsReference ¶
IsReference reports whether v is a reference, secret://<vault>/<key>, and not a literal value.
func (Value) MarshalJSON ¶
MarshalJSON is String as a JSON string. Plain gives a copy of an input whose secrets marshal their values, for the request and the job.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package seal keeps the secret values of a job from each reader but its target agents.
|
Package seal keeps the secret values of a job from each reader but its target agents. |
|
Package vault is the store of secrets that the controller resolves a secret://<vault>/<key> reference from.
|
Package vault is the store of secrets that the controller resolves a secret://<vault>/<key> reference from. |
|
mocks
Package mocks provides mock implementations for testing.
|
Package mocks provides mock implementations for testing. |
|
natsvault
Package natsvault is the nats type of vault, the one that osapi ships.
|
Package natsvault is the nats type of vault, the one that osapi ships. |
|
natsvault/mocks
Package mocks provides mock implementations for testing.
|
Package mocks provides mock implementations for testing. |