A tenant secret's value, for the step that must use it in-process: an
HMAC or JWT signing key, a password a native driver takes. Every other
step leaves {{secret.NAME}} as written and the proxy puts the value in
where the request leaves it (Plugin.Template).
Only a field the schema declares reveal: true may be revealed
(reveal/3, or every reference of a text with values/4); the
struct's Inspect prints #Plugin.Secret<NAME> and Jason.Encoder
refuses it, so a log line, a crash report or an output cannot carry the
value. value/1 unwraps it where it is used.
Summary
Functions
The names of the tenant's variables and secrets, never their values:
%{plain: names, secret: names}, each sorted, for an editor that
completes {{NAME}} and {{secret.NAME}}. A nil tenant has none.
Whether text is exactly one secret reference, {{secret.NAME}},
stamped or not: what reveal/3 accepts.
The tenant variable references of text, {{NAME}} and
{{secret.NAME}}, each once, in the order they first appear: what
values/4 resolves, for a plugin that lists them (its templates).
The secret text references, text being the value of the step's
setting key: {{secret.NAME}}, stamped or not, and nothing else.
{:error, message} when text is not one reference or the tenant has
no such secret. Raises ArgumentError when the plugin's schema does not
declare key reveal: true.
text with each secret of values (values/4, the secret.NAME keys)
replaced by its reference, {{secret.NAME}} (the longest match at a place wins), as written
and in its URL-encoded forms (form and percent encoding, upper and
lower-case hex): a value in a URI may come back encoded. A value
shorter than 4 bytes is left: it would match
ordinary text. Anything but text comes back as it is; a map, list or
tuple is scrubbed at any depth, a map's keys too.
The value, for the call that uses it. Never log, record or output it.
The values of every tenant variable text references, for a step that
hands a whole text and its values to something outside the proxy that
resolves them itself (a Camel step's written routes, which the host
builds with the values as Camel properties). text is the value of
plugin's setting key, which its schema must declare reveal: true.
Types
Functions
The names of the tenant's variables and secrets, never their values:
%{plain: names, secret: names}, each sorted, for an editor that
completes {{NAME}} and {{secret.NAME}}. A nil tenant has none.
Whether text is exactly one secret reference, {{secret.NAME}},
stamped or not: what reveal/3 accepts.
The tenant variable references of text, {{NAME}} and
{{secret.NAME}}, each once, in the order they first appear: what
values/4 resolves, for a plugin that lists them (its templates).
The secret text references, text being the value of the step's
setting key: {{secret.NAME}}, stamped or not, and nothing else.
{:error, message} when text is not one reference or the tenant has
no such secret. Raises ArgumentError when the plugin's schema does not
declare key reveal: true.
text with each secret of values (values/4, the secret.NAME keys)
replaced by its reference, {{secret.NAME}} (the longest match at a place wins), as written
and in its URL-encoded forms (form and percent encoding, upper and
lower-case hex): a value in a URI may come back encoded. A value
shorter than 4 bytes is left: it would match
ordinary text. Anything but text comes back as it is; a map, list or
tuple is scrubbed at any depth, a map's keys too.
The value, for the call that uses it. Never log, record or output it.
@spec values(module(), String.t(), String.t() | nil, String.t()) :: {%{required(String.t()) => String.t()}, [String.t()]}
The values of every tenant variable text references, for a step that
hands a whole text and its values to something outside the proxy that
resolves them itself (a Camel step's written routes, which the host
builds with the values as Camel properties). text is the value of
plugin's setting key, which its schema must declare reveal: true.
Returns {values, errors}: values maps NAME to a plain variable's
value and secret.NAME to a secret's, each reference once; errors says
why each reference that did not resolve did not (not defined, a plain
one written as a secret, a secret that cannot be decrypted). Raises
ArgumentError when key is not declared reveal: true.
The secrets come back as text, not wrapped: the caller sends them on and
must scrub them from what comes back (scrub/2). Never log, record or
output them.