@coffre/ui 0.8.2 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/chunks/{audit-sentence-C_wMpAqr.js → audit-sentence-JrQIUq6j.js} +2 -2
  2. package/dist/chunks/audit-sentence-JrQIUq6j.js.map +1 -0
  3. package/dist/chunks/{connected-apps-Bn5rEoV2.js → connected-apps-Dr8UgjK7.js} +2 -2
  4. package/dist/chunks/{connected-apps-Bn5rEoV2.js.map → connected-apps-Dr8UgjK7.js.map} +1 -1
  5. package/dist/chunks/{directory-BQNOdze_.js → directory-XcSbDRJv.js} +2 -2
  6. package/dist/chunks/{directory-BQNOdze_.js.map → directory-XcSbDRJv.js.map} +1 -1
  7. package/dist/chunks/{grants-CJIBrkod.js → grants-CmdZjKYU.js} +2 -2
  8. package/dist/chunks/{grants-CJIBrkod.js.map → grants-CmdZjKYU.js.map} +1 -1
  9. package/dist/chunks/{personal-tokens-B8rkT-DI.js → personal-tokens-Dvl1FktE.js} +2 -2
  10. package/dist/chunks/{personal-tokens-B8rkT-DI.js.map → personal-tokens-Dvl1FktE.js.map} +1 -1
  11. package/dist/chunks/{principal-page-Cv5PheS9.js → principal-page-bOaEYWJB.js} +6 -6
  12. package/dist/chunks/{principal-page-Cv5PheS9.js.map → principal-page-bOaEYWJB.js.map} +1 -1
  13. package/dist/chunks/{use-change-CQyDpCqw.js → use-change-BY6KPmnJ.js} +52 -4
  14. package/dist/chunks/use-change-BY6KPmnJ.js.map +1 -0
  15. package/dist/index.d.ts +1 -0
  16. package/dist/pages/account.js +4 -4
  17. package/dist/pages/audit.js +1 -1
  18. package/dist/pages/environment.js +108 -38
  19. package/dist/pages/environment.js.map +1 -1
  20. package/dist/pages/project-access.js +3 -3
  21. package/dist/pages/project-environments.js +1 -1
  22. package/dist/pages/projects.js +1 -1
  23. package/dist/pages/service-account.js +2 -2
  24. package/dist/pages/service-accounts.js +1 -1
  25. package/dist/pages/user.js +3 -3
  26. package/dist/pages/users.js +1 -1
  27. package/package.json +3 -3
  28. package/src/lib/audit-sentences.ts +5 -2
  29. package/src/lib/changes.ts +6 -2
  30. package/src/lib/secret-edit-batch.ts +49 -4
  31. package/src/pages/environment.tsx +87 -16
  32. package/src/styles/globals.css +28 -0
  33. package/dist/chunks/audit-sentence-C_wMpAqr.js.map +0 -1
  34. package/dist/chunks/use-change-CQyDpCqw.js.map +0 -1
@@ -2,12 +2,12 @@ import { o as listsServices, v as queries } from "../chunks/queries-epz4MIuW.js"
2
2
  import { c as Notice, i as EmptyState, l as Spinner, s as Modal } from "../chunks/ui-2kwXXfrX.js";
3
3
  import { G as Plus, J as Search, M as Key, _ as Check, it as User, u as useCoffre } from "../chunks/page-JTORvh-N.js";
4
4
  import { t as useShell } from "../chunks/use-shell-C_NmvCt_.js";
5
- import { H as parseProjectAccess, U as projectAccessLabel, W as projectAccessOptions, t as useChange, v as grantAccess, y as grantId } from "../chunks/use-change-CQyDpCqw.js";
5
+ import { G as projectAccessOptions, U as parseProjectAccess, W as projectAccessLabel, t as useChange, v as grantAccess, y as grantId } from "../chunks/use-change-BY6KPmnJ.js";
6
6
  import { n as PrincipalLink, t as PrincipalAvatar } from "../chunks/principal-DFBswTBr.js";
7
- import { r as KIND } from "../chunks/directory-BQNOdze_.js";
7
+ import { r as KIND } from "../chunks/directory-XcSbDRJv.js";
8
8
  import { t as pageRoute } from "../chunks/page-route-Drfw7lmn.js";
9
9
  import { a as ReferencesInto } from "../chunks/references-DImfw0cz.js";
10
- import { i as useRefusedGrants, n as GrantsTable, r as RefusedGrants, t as GrantRowView } from "../chunks/grants-CJIBrkod.js";
10
+ import { i as useRefusedGrants, n as GrantsTable, r as RefusedGrants, t as GrantRowView } from "../chunks/grants-CmdZjKYU.js";
11
11
  import { t as useProject } from "../chunks/project-page-BI--vjt3.js";
12
12
  import { useId, useState } from "react";
13
13
  import { Link } from "@tanstack/react-router";
@@ -3,7 +3,7 @@ import { a as ErrorLine, c as Notice, i as EmptyState, n as ConfirmDialog, o as
3
3
  import { G as Plus, H as MoreHorizontal, W as Pencil, b as ChevronRight, h as Archive, nt as Trash, q as RotateBack, t as Card, u as useCoffre } from "../chunks/page-JTORvh-N.js";
4
4
  import { a as rowClass, i as RowPending, t as ItemFailure } from "../chunks/row-state-BsIHspy4.js";
5
5
  import { t as useShell } from "../chunks/use-shell-C_NmvCt_.js";
6
- import { D as renameEnvironment, g as environmentId, l as createEnvironment, n as useChangeStatus, o as archiveEnvironment, t as useChange } from "../chunks/use-change-CQyDpCqw.js";
6
+ import { D as renameEnvironment, g as environmentId, l as createEnvironment, n as useChangeStatus, o as archiveEnvironment, t as useChange } from "../chunks/use-change-BY6KPmnJ.js";
7
7
  import { t as environmentSlugProblem } from "../chunks/validation-DiHIwZRA.js";
8
8
  import { t as PrincipalAvatar } from "../chunks/principal-DFBswTBr.js";
9
9
  import { t as pageRoute } from "../chunks/page-route-Drfw7lmn.js";
@@ -4,7 +4,7 @@ import { n as MakesProjectsOnly, r as ProjectEmptyStateCopy } from "../chunks/af
4
4
  import { E as Folder, G as Plus, N as Layers, d as Tile, i as PageHeader, k as Hash, m as AlertTriangle, n as ClosedDoor, u as useCoffre } from "../chunks/page-JTORvh-N.js";
5
5
  import { a as rowClass, i as RowPending, r as RowFailure } from "../chunks/row-state-BsIHspy4.js";
6
6
  import { t as useShell } from "../chunks/use-shell-C_NmvCt_.js";
7
- import { C as projectsList, n as useChangeStatus, t as useChange, u as createProject } from "../chunks/use-change-CQyDpCqw.js";
7
+ import { C as projectsList, n as useChangeStatus, t as useChange, u as createProject } from "../chunks/use-change-BY6KPmnJ.js";
8
8
  import { a as slugProblem } from "../chunks/validation-DiHIwZRA.js";
9
9
  import { t as useAction } from "../chunks/use-action-BB-RcHo1.js";
10
10
  import { n as FolderRow, t as FolderMenu } from "../chunks/folders-Dw240WMJ.js";
@@ -3,11 +3,11 @@ import { a as ErrorLine, c as Notice, i as EmptyState, l as Spinner, r as CopyBu
3
3
  import { F as Link, G as Plus, M as Key, O as GitHub, c as statusOf, s as memberRef, st as X, t as Card, u as useCoffre, v as CheckCircle } from "../chunks/page-JTORvh-N.js";
4
4
  import { a as rowClass, i as RowPending, r as RowFailure } from "../chunks/row-state-BsIHspy4.js";
5
5
  import { t as useShell } from "../chunks/use-shell-C_NmvCt_.js";
6
- import { A as revokeCredential, T as removeBinding, n as useChangeStatus, t as useChange } from "../chunks/use-change-CQyDpCqw.js";
6
+ import { A as revokeCredential, T as removeBinding, n as useChangeStatus, t as useChange } from "../chunks/use-change-BY6KPmnJ.js";
7
7
  import { t as pageRoute } from "../chunks/page-route-Drfw7lmn.js";
8
8
  import { t as useAction } from "../chunks/use-action-BB-RcHo1.js";
9
9
  import { t as MultiCombobox } from "../chunks/multi-combobox-CsIXihuc.js";
10
- import { n as PrincipalLayout, r as ActionsLog, t as PrincipalAccess } from "../chunks/principal-page-Cv5PheS9.js";
10
+ import { n as PrincipalLayout, r as ActionsLog, t as PrincipalAccess } from "../chunks/principal-page-bOaEYWJB.js";
11
11
  import { Fragment, useEffect, useId, useState } from "react";
12
12
  import { ROLES, ROLE_NAMES, assignableToEnvironment, credentialScopeInWords } from "@coffre/core/access";
13
13
  import { Autocomplete } from "@base-ui/react/autocomplete";
@@ -1,7 +1,7 @@
1
1
  import { o as listsServices, v as queries } from "../chunks/queries-epz4MIuW.js";
2
2
  import { M as Key, i as PageHeader, n as ClosedDoor, u as useCoffre } from "../chunks/page-JTORvh-N.js";
3
3
  import { t as useShell } from "../chunks/use-shell-C_NmvCt_.js";
4
- import { t as DirectoryTable } from "../chunks/directory-BQNOdze_.js";
4
+ import { t as DirectoryTable } from "../chunks/directory-XcSbDRJv.js";
5
5
  import { n as RemovedList } from "../chunks/offboarding-CrgwaetA.js";
6
6
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
7
  import { useSuspenseQuery } from "@tanstack/react-query";
@@ -1,10 +1,10 @@
1
1
  import { v as queries } from "../chunks/queries-epz4MIuW.js";
2
2
  import { s as memberRef, u as useCoffre } from "../chunks/page-JTORvh-N.js";
3
3
  import { t as useShell } from "../chunks/use-shell-C_NmvCt_.js";
4
- import { p as disconnectMemberApp } from "../chunks/use-change-CQyDpCqw.js";
5
- import { t as ConnectedAppsCard } from "../chunks/connected-apps-Bn5rEoV2.js";
4
+ import { p as disconnectMemberApp } from "../chunks/use-change-BY6KPmnJ.js";
5
+ import { t as ConnectedAppsCard } from "../chunks/connected-apps-Dr8UgjK7.js";
6
6
  import { t as pageRoute } from "../chunks/page-route-Drfw7lmn.js";
7
- import { n as PrincipalLayout, r as ActionsLog, t as PrincipalAccess } from "../chunks/principal-page-Cv5PheS9.js";
7
+ import { n as PrincipalLayout, r as ActionsLog, t as PrincipalAccess } from "../chunks/principal-page-bOaEYWJB.js";
8
8
  import { jsx } from "react/jsx-runtime";
9
9
  import { useSuspenseQuery } from "@tanstack/react-query";
10
10
  //#region src/pages/user.tsx
@@ -1,7 +1,7 @@
1
1
  import { v as queries } from "../chunks/queries-epz4MIuW.js";
2
2
  import { i as PageHeader, n as ClosedDoor, ot as Users, u as useCoffre } from "../chunks/page-JTORvh-N.js";
3
3
  import { t as useShell } from "../chunks/use-shell-C_NmvCt_.js";
4
- import { t as DirectoryTable } from "../chunks/directory-BQNOdze_.js";
4
+ import { t as DirectoryTable } from "../chunks/directory-XcSbDRJv.js";
5
5
  import { n as RemovedList } from "../chunks/offboarding-CrgwaetA.js";
6
6
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
7
  import { useSuspenseQuery } from "@tanstack/react-query";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coffre/ui",
3
- "version": "0.8.2",
3
+ "version": "0.9.0",
4
4
  "description": "coffre's pages, for a deployment's own TanStack Start app: its router, and a Vite plugin for its build.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -44,8 +44,8 @@
44
44
  "@tanstack/router-core": "1.171.15",
45
45
  "lucide-react": "1.47.0",
46
46
  "sonner": "2.0.7",
47
- "@coffre/client": "0.8.2",
48
- "@coffre/core": "0.8.2"
47
+ "@coffre/client": "0.9.0",
48
+ "@coffre/core": "0.9.0"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "@tanstack/react-query": "5.103.1",
@@ -252,8 +252,11 @@ const TEMPLATES: Record<string, Template> = {
252
252
  },
253
253
  tried: 'change',
254
254
  what: secrets,
255
- then: ({ entry, batch }) =>
256
- batch.length > 1 || entry.version === null || entry.version === 1 ? [] : [`, now version ${entry.version}`],
255
+ // A plain value is no secret: the sentence says it was written as one.
256
+ then: ({ entry, batch }) => [
257
+ ...(batch.length > 1 || entry.version === null || entry.version === 1 ? [] : [`, now version ${entry.version}`]),
258
+ ...(batch.length === 1 && entry.metadata.plain === true ? [', as a plain value, no secret'] : []),
259
+ ],
257
260
  },
258
261
  // The credential proxy's own entry beside the vault's read: which credential the keys went into, and where.
259
262
  'credential.use': {
@@ -8,7 +8,7 @@ import type { Change, ListShape, Target, Words } from './optimistic.ts';
8
8
  import { affects, keys } from './queries.ts';
9
9
  import { regenerateWrite, type Generation } from '@coffre/core/recipe';
10
10
  import { regeneratedKeys, renamePairs } from './recipes.ts';
11
- import { applySecretEditBatch, companionsOf, generationsOf, type SecretChange, type SecretDraft, type SecretEditBatchResult } from './secret-edit-batch.ts';
11
+ import { applySecretEditBatch, companionsOf, generationsOf, plainValuesOf, type SecretChange, type SecretDraft, type SecretEditBatchResult } from './secret-edit-batch.ts';
12
12
  import type { DirectoryPrincipal, GrantRow, ProjectSummary } from '../shared/models.ts';
13
13
 
14
14
  /**
@@ -518,8 +518,9 @@ export function saveSecrets(
518
518
  removing: ARCHIVING,
519
519
  apply: (entries, vars) => {
520
520
  const now = new Date().toISOString();
521
- // A value typed by hand has no recipe; a generated one has the one it was made by.
521
+ // A value typed by hand has no recipe; a generated one has the one it was made by. A plain one shows as it is.
522
522
  const generations = generationsOf(vars.active, vars.drafts, vars.changes);
523
+ const plains = plainValuesOf(vars.active, vars.drafts, vars.changes);
523
524
  const bumped = (entry: SecretKey | undefined, key: string): SecretKey => {
524
525
  // In a fork, a value written over the parent's is an override, whose own version the list read back says.
525
526
  const inherited = entry?.parent != null && entry.parent.state !== 'overridden' && entry.key === key;
@@ -536,6 +537,7 @@ export function saveSecrets(
536
537
  updatedAt: now,
537
538
  updatedBy: author,
538
539
  generated: generations.get(key) ?? null,
540
+ value: plains.get(key) ?? null,
539
541
  parent: entry?.parent == null || entry.key !== key ? null : { ...entry.parent, state: 'overridden', changed: false, reset: false },
540
542
  };
541
543
  };
@@ -642,6 +644,8 @@ export function regenerateSecret(
642
644
  updatedAt: now,
643
645
  updatedBy: author,
644
646
  generated: vars.generated,
647
+ // A generated value is a secret.
648
+ value: null,
645
649
  parent: entry.parent == null ? null : { ...entry.parent, state: 'overridden', changed: false, reset: false },
646
650
  };
647
651
  });
@@ -14,6 +14,8 @@ export type SecretDraft = {
14
14
  companion?: Companion;
15
15
  /** The recipe a generated value was made by, saved with it; typing over the value drops it. */
16
16
  recipe?: string;
17
+ /** Written plain: no secret, shown to whoever lists the environment. */
18
+ plain?: boolean;
17
19
  };
18
20
 
19
21
  export type SecretChange = {
@@ -24,15 +26,39 @@ export type SecretChange = {
24
26
  companion?: Companion;
25
27
  /** Only beside a generated value. */
26
28
  recipe?: string;
29
+ /** Only beside a new value: whether it is written plain, no secret. A value is a secret unless it says so. */
30
+ plain?: boolean;
31
+ /**
32
+ * The version the edit started from, by id (`valueEdit`): a plain write
33
+ * replaces it, or is refused, so that making a stored secret plain never
34
+ * publishes a value someone has written over since.
35
+ */
36
+ replaces?: string;
27
37
  };
28
38
 
39
+ /**
40
+ * What a value edit makes of a row's change: `value`, written `plain` or
41
+ * not, from where the edit started (`from.start`, the row's plain value or
42
+ * the secret it revealed, `from.plain`, whether the row is plain, and
43
+ * `from.startedAt`, that version's id). Back where it started, it is no
44
+ * change. The version it started from stays with the change from its first
45
+ * edit on, so a remount of the row (a rename refused, then retried) never
46
+ * loses it.
47
+ */
48
+ export function valueEdit(change: SecretChange, from: { start: string; plain: boolean; startedAt: string | undefined }, value: string, plain: boolean): Partial<SecretChange> {
49
+ const replaces = change.replaces ?? from.startedAt;
50
+ if (value === from.start && plain === from.plain) return { value: null, plain: undefined, replaces };
51
+ return { value, plain, replaces, companion: undefined, recipe: undefined };
52
+ }
53
+
29
54
  type ActiveSecret = { key: string };
30
55
 
31
56
  /**
32
57
  * A merge patch: a string sets a key, adding it if it is new; a value with
33
- * how it was generated sets it with its recipe; `null` archives it.
58
+ * how it was generated sets it with its recipe; a plain one, no secret,
59
+ * says so; `null` archives it.
34
60
  */
35
- export type SecretPatch = Record<string, string | { value: string; generated: Generation } | null>;
61
+ export type SecretPatch = Record<string, string | { value: string; generated: Generation } | { value: string; plain: true; replaces?: string } | null>;
36
62
 
37
63
  /**
38
64
  * How a row's generated value was made, as its write says it: its recipe,
@@ -46,9 +72,10 @@ function generationOf(key: string, edit: { recipe?: string; companion?: Companio
46
72
  }
47
73
 
48
74
  /** What a row writes under each key: its value, and its companion's beside it. */
49
- function rowPatch(key: string, value: string, edit: { recipe?: string; companion?: Companion }): SecretPatch {
75
+ function rowPatch(key: string, value: string, edit: { recipe?: string; companion?: Companion; plain?: boolean; replaces?: string }): SecretPatch {
50
76
  const generated = generationOf(key, edit);
51
- const entry = (each: string) => (generated === undefined ? each : { value: each, generated });
77
+ const plain = (each: string) => (edit.replaces === undefined ? { value: each, plain: true as const } : { value: each, plain: true as const, replaces: edit.replaces });
78
+ const entry = (each: string) => (generated !== undefined ? { value: each, generated } : edit.plain === true ? plain(each) : each);
52
79
  const patch: SecretPatch = Object.create(null);
53
80
  patch[key] = entry(value);
54
81
  if (edit.companion !== undefined) patch[edit.companion.key.trim()] = entry(edit.companion.value);
@@ -79,6 +106,24 @@ export function generationsOf(
79
106
  return out;
80
107
  }
81
108
 
109
+ /**
110
+ * The value each key a save writes plain will show, by its name after the
111
+ * save: what the list shows of it until it is read back.
112
+ */
113
+ export function plainValuesOf(
114
+ active: readonly ActiveSecret[],
115
+ drafts: readonly SecretDraft[],
116
+ changes: Readonly<Record<string, SecretChange>>,
117
+ ): Map<string, string> {
118
+ const out = new Map<string, string>();
119
+ for (const draft of drafts) if (draft.plain === true && draft.recipe === undefined) out.set(draft.key.trim(), draft.value);
120
+ for (const entry of active) {
121
+ const change = secretChangeFor(changes, entry.key);
122
+ if (change !== undefined && !change.archived && change.value !== null && change.plain === true && change.recipe === undefined) out.set(change.key.trim(), change.value);
123
+ }
124
+ return out;
125
+ }
126
+
82
127
  type SecretEditOperations = {
83
128
  rename: (key: string, nextKey: string) => Promise<void>;
84
129
  /** One transaction: every key in it lands, or none does. */
@@ -26,6 +26,7 @@ import {
26
26
  companionsOf,
27
27
  hasSecretEditConflict,
28
28
  secretChangeFor,
29
+ valueEdit,
29
30
  type Companion,
30
31
  type SecretChange,
31
32
  type SecretDraft,
@@ -655,6 +656,7 @@ function EnvironmentLedger({
655
656
  lent={lentBy.get(entry.key) ?? []}
656
657
  // A personal config holds values only: no reference.
657
658
  environments={personal ? [] : readable}
659
+ personal={personal}
658
660
  status={state}
659
661
  // Not while its save is on its way.
660
662
  disabled={state.state === 'pending'}
@@ -698,6 +700,7 @@ function EnvironmentLedger({
698
700
  key={draft.id}
699
701
  draft={draft}
700
702
  existingVersion={versionOf(draft.key)}
703
+ personal={personal}
701
704
  disabled={false}
702
705
  onChange={(patch) =>
703
706
  setDrafts((rows) =>
@@ -1000,6 +1003,7 @@ function ValueField({
1000
1003
  autoFocus,
1001
1004
  onEscape,
1002
1005
  generate,
1006
+ plain = false,
1003
1007
  }: {
1004
1008
  label: string;
1005
1009
  value: string;
@@ -1018,6 +1022,8 @@ function ValueField({
1018
1022
  companion: Companion | undefined;
1019
1023
  onUse: (use: GeneratedUse) => void;
1020
1024
  };
1025
+ /** A plain value, no secret: shown as it is typed. */
1026
+ plain?: boolean;
1021
1027
  }) {
1022
1028
  const [shown, setShown] = useState(false);
1023
1029
  const [generating, setGenerating] = useState(false);
@@ -1037,7 +1043,7 @@ function ValueField({
1037
1043
  };
1038
1044
  const field = {
1039
1045
  className: 'input input-mono',
1040
- masked: !shown,
1046
+ masked: !shown && !plain,
1041
1047
  'aria-label': label,
1042
1048
  placeholder,
1043
1049
  value,
@@ -1099,15 +1105,18 @@ function ValueField({
1099
1105
  <Generate size={14} />
1100
1106
  </button>
1101
1107
  </Tip>
1102
- <button
1103
- type="button"
1104
- className="btn btn-quiet btn-sm btn-icon input-addon"
1105
- aria-label={shown ? 'Mask the value' : 'Show the value'}
1106
- aria-pressed={shown}
1107
- onClick={() => setShown((current) => !current)}
1108
- >
1109
- {shown ? <EyeOff size={14} /> : <Eye size={14} />}
1110
- </button>
1108
+ {/* A plain value shows as it is: nothing to mask. */}
1109
+ {!plain && (
1110
+ <button
1111
+ type="button"
1112
+ className="btn btn-quiet btn-sm btn-icon input-addon"
1113
+ aria-label={shown ? 'Mask the value' : 'Show the value'}
1114
+ aria-pressed={shown}
1115
+ onClick={() => setShown((current) => !current)}
1116
+ >
1117
+ {shown ? <EyeOff size={14} /> : <Eye size={14} />}
1118
+ </button>
1119
+ )}
1111
1120
  <GenerateValue
1112
1121
  open={generating}
1113
1122
  onOpenChange={setGenerating}
@@ -1182,6 +1191,7 @@ function SecretRow({
1182
1191
  versionOf,
1183
1192
  saveReady,
1184
1193
  onMarkArchive,
1194
+ personal,
1185
1195
  }: {
1186
1196
  number: number;
1187
1197
  project: string;
@@ -1223,6 +1233,8 @@ function SecretRow({
1223
1233
  versionOf: (key: string) => number | null;
1224
1234
  saveReady: boolean;
1225
1235
  onMarkArchive: () => void;
1236
+ /** In a personal config, whose values are its owner's alone: never plain. */
1237
+ personal: boolean;
1226
1238
  }) {
1227
1239
  const [reads, dispatch] = useReducer(rowReads, noReads);
1228
1240
  const { reveal, revealing, error, copyError } = reads;
@@ -1254,6 +1266,13 @@ function SecretRow({
1254
1266
  // And where that version is held: a reset, an override or a new reference changes it under the same number.
1255
1267
  const readFrom = `${inherited ? parent!.from : '.'}:${reference?.source ?? ''}`;
1256
1268
  const holderPath = `${project}/${environment}/${entry.key}`;
1269
+ // A plain value is no secret: listed as it is, shown inline and copied with no read.
1270
+ const rowPlain = entry.value !== null;
1271
+ // What the edit writes: plain or not as the row is, until the toggle says otherwise; in a personal config, a secret.
1272
+ const plainNow = change.value !== null ? change.plain === true : rowPlain && !personal;
1273
+ // The version the edit started from, by id: what a stored secret made plain replaces (`valueEdit`).
1274
+ const [startedAt, setStartedAt] = useState<string | undefined>(undefined);
1275
+ const from = () => ({ start: editBase?.value ?? '', plain: rowPlain, startedAt });
1257
1276
  // The current value, loaded on request as the starting point for an edit.
1258
1277
  // It is not a change until it is edited: saving it untouched would append a
1259
1278
  // version identical to the one it came from.
@@ -1298,6 +1317,7 @@ function SecretRow({
1298
1317
  }
1299
1318
 
1300
1319
  async function fetchValue(): Promise<string> {
1320
+ if (entry.value !== null) return entry.value;
1301
1321
  const { values } = await coffre.secrets.reveal(`${project}/${environment}/${entry.key}`);
1302
1322
  return values[entry.key];
1303
1323
  }
@@ -1348,7 +1368,9 @@ function SecretRow({
1348
1368
  const [focusName, setFocusName] = useState(false);
1349
1369
  async function startEdit({ name = false } = {}) {
1350
1370
  setFocusName(name);
1351
- if (canRead) {
1371
+ setStartedAt(entry.versionId ?? undefined);
1372
+ if (entry.value !== null) setBase({ value: entry.value, version: readVersion, from: readFrom, at: Date.now() });
1373
+ else if (canRead) {
1352
1374
  setOpening(true);
1353
1375
  const value = await readValue({ show: false });
1354
1376
  setOpening(false);
@@ -1412,6 +1434,7 @@ function SecretRow({
1412
1434
  <div className="key-cell">
1413
1435
  <span>{breakAfterUnderscores(entry.key)}</span>
1414
1436
  {generated !== null && <RecipeMark generated={generated} />}
1437
+ {rowPlain && <span className="tag" title="Not a secret: shown to whoever reads this environment">Plain</span>}
1415
1438
  {leaving && <span className="tag tag-red">Will be archived</span>}
1416
1439
  {parent !== null && <Standing project={project} secretKey={entry.key} parent={parent} />}
1417
1440
  {lent.length > 0 && (
@@ -1440,11 +1463,12 @@ function SecretRow({
1440
1463
  value={change.value ?? editBase?.value ?? ''}
1441
1464
  start={editBase?.value}
1442
1465
  placeholder={canReveal ? 'Value' : 'New value; the current one is hidden from you'}
1466
+ plain={plainNow}
1443
1467
  disabled={disabled}
1444
1468
  autoFocus={!focusName}
1445
1469
  // A value typed over a generated one has no recipe, and a private key's no longer matches its public key.
1446
1470
  onChange={(value) =>
1447
- onPatch({ value: value === (editBase?.value ?? '') ? null : value, companion: undefined, recipe: undefined })
1471
+ onPatch(valueEdit(change, from(), value, plainNow))
1448
1472
  }
1449
1473
  onEscape={onUndo}
1450
1474
  generate={{
@@ -1452,9 +1476,22 @@ function SecretRow({
1452
1476
  name: change.key,
1453
1477
  renamable: false,
1454
1478
  companion: change.companion,
1455
- onUse: ({ value, companion, recipe }) => onPatch({ value, companion, recipe }),
1479
+ // A generated value is a secret.
1480
+ onUse: ({ value, companion, recipe }) => onPatch({ value, companion, recipe, plain: false }),
1456
1481
  }}
1457
1482
  />
1483
+ {/* Nor over a reference, whose value is its source's: no version of its own guards making it plain. */}
1484
+ {!personal && reference === null && (
1485
+ <PlainToggle
1486
+ plain={plainNow}
1487
+ disabled={disabled}
1488
+ // The value as it stands, written the other way.
1489
+ onToggle={() => onPatch(valueEdit(change, from(), change.value ?? editBase?.value ?? '', !plainNow))}
1490
+ />
1491
+ )}
1492
+ {plainNow && !rowPlain && editBase === null && (
1493
+ <span className="edit-note">Type its value: a stored secret is never shown, and so never made plain</span>
1494
+ )}
1458
1495
  <CompanionNote companion={change.companion} versionOf={versionOf} />
1459
1496
  {!overridden && parent !== null && (
1460
1497
  <span className="edit-note">Saved here, over {parent.from}'s value</span>
@@ -1465,6 +1502,8 @@ function SecretRow({
1465
1502
  </span>
1466
1503
  )}
1467
1504
  </div>
1505
+ ) : rowPlain && !leaving ? (
1506
+ <span className="revealed-value plain-value">{entry.value === '' ? '(empty)' : entry.value}</span>
1468
1507
  ) : shown !== null && !leaving ? (
1469
1508
  <div
1470
1509
  className="revealed"
@@ -1526,7 +1565,7 @@ function SecretRow({
1526
1565
  takes read there too. */}
1527
1566
  <SecretReadOnly canReveal={canRead}>
1528
1567
  <CopyButton variant="act" copier={copier} onCopy={copyValue} label={`Copy ${entry.key}`} />
1529
- <Tip label={shown === null ? 'Reveal' : 'Hide'}>
1568
+ {!rowPlain && <Tip label={shown === null ? 'Reveal' : 'Hide'}>
1530
1569
  <button
1531
1570
  className="act act-icon act-accent"
1532
1571
  onClick={toggleReveal}
@@ -1541,7 +1580,7 @@ function SecretRow({
1541
1580
  <EyeOff size={15} />
1542
1581
  )}
1543
1582
  </button>
1544
- </Tip>
1583
+ </Tip>}
1545
1584
  </SecretReadOnly>
1546
1585
  {canWrite && (
1547
1586
  <Tip label={inherited ? `Override ${parent!.from}'s` : 'Edit'}>
@@ -1996,6 +2035,26 @@ function Written({ entry, rotateAfterDays }: { entry: SecretKey; rotateAfterDays
1996
2035
  * from the list to add to it, and only ever accepted one key at a time; a row
1997
2036
  * in place accepts as many as you want to queue.
1998
2037
  */
2038
+ /**
2039
+ * Whether the value being written is plain, no secret: an account's id,
2040
+ * which whoever reads the environment then sees as it is, and its apps get
2041
+ * as it is under stand-ins. Off, it is a secret, as every value is unless
2042
+ * this says otherwise.
2043
+ */
2044
+ function PlainToggle({ plain, disabled, onToggle }: { plain: boolean; disabled: boolean; onToggle: () => void }) {
2045
+ return (
2046
+ <span className="edit-note">
2047
+ <button type="button" className="act plain-toggle" aria-pressed={plain} disabled={disabled} onClick={onToggle}>
2048
+ <span className="plain-toggle-box" aria-hidden>
2049
+ {plain && <Check size={11} />}
2050
+ </span>
2051
+ Plain value
2052
+ </button>
2053
+ {plain && 'shown to whoever reads this environment'}
2054
+ </span>
2055
+ );
2056
+ }
2057
+
1999
2058
  function DraftRow({
2000
2059
  draft,
2001
2060
  existingVersion,
@@ -2005,6 +2064,7 @@ function DraftRow({
2005
2064
  onSave,
2006
2065
  versionOf,
2007
2066
  saveReady,
2067
+ personal,
2008
2068
  }: {
2009
2069
  draft: SecretDraft;
2010
2070
  existingVersion: number | null;
@@ -2016,6 +2076,8 @@ function DraftRow({
2016
2076
  /** The current version of a key in this environment, for a companion's note. */
2017
2077
  versionOf: (key: string) => number | null;
2018
2078
  saveReady: boolean;
2079
+ /** In a personal config, whose values are its owner's alone: never plain. */
2080
+ personal: boolean;
2019
2081
  }) {
2020
2082
  const [touched, setTouched] = useState(false);
2021
2083
  const trimmed = draft.key.trim();
@@ -2062,6 +2124,7 @@ function DraftRow({
2062
2124
  <ValueField
2063
2125
  label={`Value for ${trimmed === '' ? 'the new secret' : trimmed}`}
2064
2126
  value={draft.value}
2127
+ plain={draft.plain === true}
2065
2128
  placeholder="Value"
2066
2129
  disabled={disabled}
2067
2130
  // A value typed over a generated one has no recipe, and a private key's no longer matches its public key.
@@ -2071,9 +2134,17 @@ function DraftRow({
2071
2134
  name: draft.key,
2072
2135
  renamable: true,
2073
2136
  companion: draft.companion,
2074
- onUse: ({ value, name, companion, recipe }) => onChange({ key: name, value, companion, recipe }),
2137
+ // A generated value is a secret.
2138
+ onUse: ({ value, name, companion, recipe }) => onChange({ key: name, value, companion, recipe, plain: false }),
2075
2139
  }}
2076
2140
  />
2141
+ {!personal && (
2142
+ <PlainToggle
2143
+ plain={draft.plain === true}
2144
+ disabled={disabled}
2145
+ onToggle={() => onChange({ plain: draft.plain !== true, companion: undefined, recipe: undefined })}
2146
+ />
2147
+ )}
2077
2148
  <CompanionNote companion={draft.companion} versionOf={versionOf} />
2078
2149
  </div>
2079
2150
  </div>
@@ -2656,6 +2656,34 @@ table.claims-table td {
2656
2656
  color: var(--red);
2657
2657
  }
2658
2658
 
2659
+ /* Whether a value is written plain, no secret: a checkbox's box and its label, as one button. */
2660
+ .plain-toggle {
2661
+ display: inline-flex;
2662
+ align-items: center;
2663
+ gap: 0.375rem;
2664
+ color: var(--ink-2);
2665
+ }
2666
+
2667
+ .plain-toggle-box {
2668
+ display: inline-grid;
2669
+ place-items: center;
2670
+ width: 0.8125rem;
2671
+ height: 0.8125rem;
2672
+ border: 1px solid var(--edge);
2673
+ border-radius: 0.1875rem;
2674
+ }
2675
+
2676
+ .plain-toggle[aria-pressed='true'] .plain-toggle-box {
2677
+ border-color: var(--accent);
2678
+ background: var(--accent);
2679
+ color: var(--panel);
2680
+ }
2681
+
2682
+ /* A plain value, listed as it is: a revealed one's type, with no timer. */
2683
+ .plain-value {
2684
+ color: var(--ink-2);
2685
+ }
2686
+
2659
2687
  .version-shift {
2660
2688
  font-family: var(--font-mono);
2661
2689
  font-size: 0.78125rem;