Secrets

Store API keys and tokens, shown once and masked after.

Secrets

  • BILLING_API_KEYAPI key

    ProductionExpires Jan 14, 2027

    Saved Oct 14, 2026 by Maya Chen · ends in 4f2a · Used by 3 workflows

  • WEBHOOK_SIGNING_SECRETSigning secret

    ProductionPreview

    Saved Nov 2, 2026 by Maya Chen · ends in 91c0

  • LEGACY_CRM_TOKENToken

    PreviewExpired Nov 28

    Saved May 30, 2026 · ends in 0b17

Installation

pnpm dlx shadcn@latest add checkfu/uicontext/secret

Usage

import { SecretValues, Vault, type VaultItem } from "./ui/uicontext/components/kit/Secret.ts"
const Message = UiSchema.TaggedEnum({	ReplacedSecret: { id: Schema.String, values: SecretValues },	RotatedSecret: { id: Schema.String },	RemovedSecret: { id: Schema.String },})export const Secrets = (h: Html.H<typeof Message.Type>, items: ReadonlyArray<VaultItem>) =>	Vault(h, {		props: { label: "Secrets", items },		onEmit: {			RequestedReplace: ({ id, values }) => Message.ReplacedSecret({ id, values }),			RequestedRotate: ({ id }) => Message.RotatedSecret({ id }),			RequestedRemove: ({ id }) => Message.RemovedSecret({ id }),			RequestedAdd: () => undefined,		},	})

API reference

SecretFieldComponent

Props

SecretField props
NameTypeDefaultDescription
agentIdstring—The field's unique ID for agents, such as "secret-service-key".
labelrequiredstring—The secret's display name, such as "Service API key".
descriptionstring—What it's for, or where it goes: "Used by sessions during setup only."
savedrequiredSavedSecret | null—Null while nothing is saved
usedBystring—What uses it: "Used by 2 preflight scripts"
inputsSecretInput[]—The inputs; one masked input named "value" by default
canCan(["edit", "remove"])—What this person may do: "edit" enters or replaces the value, "remove" removes the saved one. Left out, they may edit and not remove.
lockedReasonstring—Why it can't be changed, when it can't: "Set by your admin"
removeWarningstring—Said in the remove confirm: "Sessions that use it fail until it's replaced."
saveLabelstringSave securelyThe save button's words; Save securely by default
removeLabelstringRemoveThe remove button's words; Remove by default
notestring"Said under the input; "Saved straight to the vault. Nobody can view it after you save it." by default
outcomeOutcome—The app's answer to the last request: "save" for RequestedSave, "remove" for RequestedRemove. Pending shows "Saving securely…"; a refusal shows its reason ("The secret was not saved. Try again.").
expiresstring—A countdown, formatted by the app: "Expires in 4:12"
closedstring—The entry is over (expired, cancelled, used); this sentence replaces the form
cancel{ label }—A Cancel that the app hears (stop a sign-in), in place of the local one
timeZonestring—The time zone (IANA) the saved date is shown in
localestring—The locale the saved date is formatted in; the browser's by default

Events

SecretField events
EventPayloadDescription
RequestedSave{ values: SecretValues }The values typed, by input name; the app sends them to its vault and drops them
RequestedRemove{}Remove the saved value, after the person confirmed
RequestedCancel{}The app's Cancel (the cancel prop) was pressed

Agent actions

What agents can do with SecretField
ActionDescription
ClickedReplaceOpen the field so the person can type a new value. You never see or type the value: tell the person it's ready for them.
ConfirmedRemoveasks firstRemove the saved value. Name its label and savedAt as the target.

VaultComponent

Props

Vault props
NameTypeDefaultDescription
agentIdstringvault:<label>The id agents know this vault by; vault:<label> by default
labelrequiredstring—"Secrets", "Vault", "Environment variables"
itemsrequiredVaultItem[]—The saved secrets, by name, with who saved them and when; never their values
addLabelstring—"Add secret"; leave out when this person can't add
emptyTitlestringNothing saved yetWhat an empty vault says; Nothing saved yet by default
emptyHintstring—A hint under the empty title
notestring—Said under the input when replacing a value
timeZonestring—The time zone (IANA) saved dates are shown in
localestring—The locale saved dates are formatted in; the browser's by default

Events

Vault events
EventPayloadDescription
RequestedAdd{}The add button was pressed: open the app's form for a new secret
RequestedReplace{ id: string; values: SecretValues }A secret's new value, typed by input name; the app sends it to its vault and drops it
RequestedRemove{ id: string }Remove a secret, after the person confirmed
RequestedRotate{ id: string }Make a new value for a secret, after the person confirmed; show it with ShownOnce

Agent actions

What agents can do with Vault
ActionDescription
ClickedReplaceOpen an item's replace field for the person to type into. You never see or type the value: tell the person it's ready.
ConfirmedRemoveasks firstRemove an item by id. Name that item's { id, name, savedAt }, as in the snapshot, as the target.

ShownOnceComponent

Props

ShownOnce props
NameTypeDefaultDescription
agentIdstringshown-once:<label>The id agents know this by; shown-once:<label> by default
labelrequiredstring—"Personal access token", "Connection token"
valuerequiredRedacted—The new token, shown this once
descriptionstring—What to do with it: "Paste it into your client's settings."
doneLabelstring—"Done"; leave out when the app closes it some other way

Events

ShownOnce events
EventPayloadDescription
RequestedDone{}The person pressed Done: close it, and the value is gone

Accessibility

  • The value is a masked input with a Show button (aria-pressed); nothing typed is kept after it's sent.
  • Saved secrets show their name and who saved them, never their value.
  • A value shown once is selected when focused, and copying it says whether it worked.

Source