Secrets and the keychain
How an addon declares, reads, and passes on a password, token or key — by schema type, never through the environment or a command line.
Every password, token and key Dominevo holds lives in one place: the hub's encrypted keychain. A settings blob, device config or integration record holds a marker in place of the value:
{ "$secret": "secret://<owner>/<scope>/<fieldPath>", "v": 1 }Declare it by type, never by name
A field is a secret because its type says so:
- A config-UI field of
type: 'password', orsecret: trueon atextortextareafield. - A Zod field in a device config or an integration record:
.meta({ secret: true }).storage: 'inline'opts a field out (a masked field that is not a secret). - Hidden state that is a credential, never a form field (a token you mint or
receive), is listed in
protected readonly secretStatePaths = ['ingressToken', 'tokens[userId].accessToken']. - An array of rows with a secret needs an id field (default
id): references are addressed by item id, so reordering keeps them.
A declared field is keychain-backed by BaseAddon with no further code: the
stored blob holds the marker and this.config holds the value. A field named
like a credential but not declared is refused by the repository check.
const AccountSchema = z.object({
host: z.string(),
apiToken: z.string().meta({ secret: true }),
})Reading and clearing
- Every read of your own settings answers values:
this.config,this.state(), and eachthis.ctx.settings.read*. Writing back what you read changes nothing. Do not read the settings object passed toinitialize: that is the kernel's raw view and holds markers. Callsuper.initialize(context)and usethis.ctx. - Locked is never empty. When the keychain cannot serve a value right now,
it reads as its marker (
isSecretMarker(value)), never''or absent, and is listed inthis.unresolvedSecrets. Run degraded. Do not mint a replacement: an addon write over a secret it could not read is refused, so an "absent, so create and save" loop cannot clobber the real one. ''never clears a secret. To forget one, callthis.clearSecrets(['apiToken']).
Never through the environment or a command line
No secret reaches any process through its environment, and none goes on a command line (it shows in the process list). That includes an "optional token for power users". A credential is a declared field read from your config.
A child process that needs one (a tunnel client, ffmpeg with an
authenticated source) gets an owner-only file: a fresh 0700 temp
directory, the value written with mode 0o600, the path passed as the
argument (--token-file <path>), and the directory removed when the child
settles, on success or failure. A URL with embedded credentials is a secret on
the command line too: build it for the child from a file or a pipe, never from a
string you log.
Logs and the repository
A value resolved from the keychain is scrubbed from your addon's logs. A message you build with it (an error string from a child) is yours to scrub. Recorded test fixtures never carry a live credential. A published package never contains an OAuth client secret or a private key: every package is public on npm, so a secret that must exist server-side for a public integration lives behind a broker. A secret that was ever committed or published is rotated, not just deleted.
In the UI
The admin form shows "set", never the value; the library secret field renders it and a reveal happens in a dialog. You do not draw it yourself: declaring the field is enough.
Then
- Build an integration: a secret on an instance record
- Add an addon
Device capabilities for providers
The device-level capabilities a provider implements beyond the basics — switch options and power cycle, the timed siren, low-power sleep, re-sync, and reboot — with the rule each one enforces.
Moving bytes between addons
How one addon hands a file or a buffer to another with a one-shot ticket, and why a cap method never carries base64.