Update secret

View as Markdown

Update one or more fields on a Vault secret without reading its current value. Fields not included remain unchanged. Use null to clear nullable fields.

Update a secret

1const updated = await bctrl.tools.call("vault.secrets.update", {
2 name: "production/github/login",
3 password: process.env.NEW_GITHUB_PASSWORD!,
4 label: "Updated GitHub account",
5});
6
7console.log(updated.name, updated.hasTotp);

At least one field besides name must be provided.

Request parameters

ParameterTypeRequiredDescription
nameVaultSecretNameYesSecret to update.
usernamestringNoUsername on a login secret.
passwordstringNoPassword on a login secret.
valuestringNoValue on a value secret.
totpSecretstring | nullNoBase32 TOTP seed. Use null to clear it.
labelstring | nullNoDisplay label. Use null to clear it.
originsstring[] | nullNoExact allowed origins. Use null to clear them.
originPatternsstring[] | nullNoAllowed origin patterns. Use null to clear them.
notesstring | nullNoPrivate notes. Use null to clear them.

Response

The response contains the same safe metadata as Get secret metadata; it never returns the updated secret value.

FieldTypeAlways presentDescription
nameVaultSecretNameYesSecret name.
type"login" | "value"YesStored secret shape.
labelstringNoDisplay label, when set.
originsstring[]NoExact allowed origins, when configured.
originPatternsstring[]NoAllowed origin patterns, when configured.
hasTotpbooleanYesWhether a TOTP seed exists.
createdAtstringNoCreation timestamp, when available.
updatedAtstringNoUpdate timestamp, when available.

Next