@coffre/ui 0.6.1 → 0.7.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 (119) hide show
  1. package/dist/chunks/{audit-sentence-CUUMshIp.js → audit-sentence-C1_gRxWW.js} +91 -26
  2. package/dist/chunks/audit-sentence-C1_gRxWW.js.map +1 -0
  3. package/dist/chunks/{connected-apps-DTpatjge.js → connected-apps-Bn5rEoV2.js} +4 -4
  4. package/dist/chunks/{connected-apps-DTpatjge.js.map → connected-apps-Bn5rEoV2.js.map} +1 -1
  5. package/dist/chunks/{delete-place-SOOYVt6A.js → delete-place-CQCDHkne.js} +4 -4
  6. package/dist/chunks/{delete-place-SOOYVt6A.js.map → delete-place-CQCDHkne.js.map} +1 -1
  7. package/dist/chunks/{directory-DrtdKny2.js → directory-BQNOdze_.js} +22 -19
  8. package/dist/chunks/directory-BQNOdze_.js.map +1 -0
  9. package/dist/chunks/{folders-hR2Lnk0k.js → folders-Dw240WMJ.js} +2 -2
  10. package/dist/chunks/{folders-hR2Lnk0k.js.map → folders-Dw240WMJ.js.map} +1 -1
  11. package/dist/chunks/{grants-DDBui9YD.js → grants-CJIBrkod.js} +5 -5
  12. package/dist/chunks/{grants-DDBui9YD.js.map → grants-CJIBrkod.js.map} +1 -1
  13. package/dist/chunks/multi-combobox-CsIXihuc.js +99 -0
  14. package/dist/chunks/multi-combobox-CsIXihuc.js.map +1 -0
  15. package/dist/chunks/{offboarding-C7ECW5o0.js → offboarding-CrgwaetA.js} +4 -4
  16. package/dist/chunks/offboarding-CrgwaetA.js.map +1 -0
  17. package/dist/chunks/personal-tokens-B8rkT-DI.js +138 -0
  18. package/dist/chunks/personal-tokens-B8rkT-DI.js.map +1 -0
  19. package/dist/chunks/{principal-page-CB6dAABC.js → principal-page-DDmmV1KQ.js} +37 -27
  20. package/dist/chunks/principal-page-DDmmV1KQ.js.map +1 -0
  21. package/dist/chunks/{project-page-BHNUvr2L.js → project-page-BI--vjt3.js} +2 -2
  22. package/dist/chunks/{project-page-BHNUvr2L.js.map → project-page-BI--vjt3.js.map} +1 -1
  23. package/dist/chunks/{queries-DgQo3mC-.js → queries-epz4MIuW.js} +103 -18
  24. package/dist/chunks/queries-epz4MIuW.js.map +1 -0
  25. package/dist/chunks/{references-BQc35Q9g.js → references-DImfw0cz.js} +4 -4
  26. package/dist/chunks/{references-BQc35Q9g.js.map → references-DImfw0cz.js.map} +1 -1
  27. package/dist/chunks/{role-field-BfWRCqzl.js → role-field-C1KhNaIR.js} +2 -2
  28. package/dist/chunks/{role-field-BfWRCqzl.js.map → role-field-C1KhNaIR.js.map} +1 -1
  29. package/dist/chunks/{row-state-Zf3kZVhd.js → row-state-BsIHspy4.js} +2 -2
  30. package/dist/chunks/{row-state-Zf3kZVhd.js.map → row-state-BsIHspy4.js.map} +1 -1
  31. package/dist/chunks/{theme-B6-V9JvY.js → theme-3b4DnCow.js} +2 -2
  32. package/dist/chunks/{theme-B6-V9JvY.js.map → theme-3b4DnCow.js.map} +1 -1
  33. package/dist/chunks/{ui-Br-dNUTc.js → ui-2kwXXfrX.js} +95 -22
  34. package/dist/chunks/ui-2kwXXfrX.js.map +1 -0
  35. package/dist/chunks/{use-action-DthL5hL8.js → use-action-BB-RcHo1.js} +2 -2
  36. package/dist/chunks/{use-action-DthL5hL8.js.map → use-action-BB-RcHo1.js.map} +1 -1
  37. package/dist/chunks/{use-change-By4cG8bT.js → use-change-CQyDpCqw.js} +323 -31
  38. package/dist/chunks/use-change-CQyDpCqw.js.map +1 -0
  39. package/dist/chunks/{use-shell-D6kjSPls.js → use-shell-C_NmvCt_.js} +2 -2
  40. package/dist/chunks/{use-shell-D6kjSPls.js.map → use-shell-C_NmvCt_.js.map} +1 -1
  41. package/dist/index.d.ts +46 -164
  42. package/dist/index.js +143 -129
  43. package/dist/index.js.map +1 -1
  44. package/dist/pages/account.d.ts +1 -1
  45. package/dist/pages/account.js +29 -12
  46. package/dist/pages/account.js.map +1 -1
  47. package/dist/pages/approval.js +1 -1
  48. package/dist/pages/audit.js +96 -90
  49. package/dist/pages/audit.js.map +1 -1
  50. package/dist/pages/device-login.js +1 -1
  51. package/dist/pages/environment.js +949 -412
  52. package/dist/pages/environment.js.map +1 -1
  53. package/dist/pages/login.js +2 -2
  54. package/dist/pages/oauth-authorize.js +1 -1
  55. package/dist/pages/project-access.js +9 -9
  56. package/dist/pages/project-access.js.map +1 -1
  57. package/dist/pages/project-environments.js +112 -64
  58. package/dist/pages/project-environments.js.map +1 -1
  59. package/dist/pages/project-settings.d.ts +1 -1
  60. package/dist/pages/project-settings.js +54 -75
  61. package/dist/pages/project-settings.js.map +1 -1
  62. package/dist/pages/project.js +3 -7
  63. package/dist/pages/project.js.map +1 -1
  64. package/dist/pages/projects.js +50 -77
  65. package/dist/pages/projects.js.map +1 -1
  66. package/dist/pages/service-account.js +284 -160
  67. package/dist/pages/service-account.js.map +1 -1
  68. package/dist/pages/service-accounts.js +4 -4
  69. package/dist/pages/settings.js +5 -5
  70. package/dist/pages/unregistered.js +1 -1
  71. package/dist/pages/user.js +5 -5
  72. package/dist/pages/users.js +4 -4
  73. package/package.json +3 -3
  74. package/src/components/actions-log.tsx +3 -2
  75. package/src/components/command-palette.tsx +4 -5
  76. package/src/components/directory.tsx +7 -14
  77. package/src/components/generate-value.tsx +15 -7
  78. package/src/components/missing.tsx +63 -67
  79. package/src/components/offboarding.tsx +1 -1
  80. package/src/components/personal-tokens.tsx +131 -0
  81. package/src/components/principal-page.tsx +30 -17
  82. package/src/components/regenerate.tsx +72 -0
  83. package/src/components/service-tokens.tsx +5 -14
  84. package/src/components/shell.tsx +79 -75
  85. package/src/components/trusted-workloads.tsx +179 -19
  86. package/src/components/ui.tsx +35 -25
  87. package/src/lib/audit-sentences.ts +100 -12
  88. package/src/lib/bindings.ts +41 -3
  89. package/src/lib/changes.ts +215 -29
  90. package/src/lib/clipboard.ts +40 -0
  91. package/src/lib/copy-attempts.ts +103 -0
  92. package/src/lib/dismissal.ts +24 -0
  93. package/src/lib/generate.ts +3 -146
  94. package/src/lib/optimistic.ts +3 -1
  95. package/src/lib/queries.ts +121 -17
  96. package/src/lib/recipes.ts +63 -0
  97. package/src/lib/reveal.ts +7 -1
  98. package/src/lib/row-reads.ts +64 -0
  99. package/src/lib/secret-edit-batch.ts +64 -5
  100. package/src/options.ts +43 -51
  101. package/src/pages/account.tsx +27 -5
  102. package/src/pages/audit.tsx +38 -31
  103. package/src/pages/environment.tsx +655 -121
  104. package/src/pages/project-access.tsx +1 -1
  105. package/src/pages/project-environments.tsx +92 -45
  106. package/src/pages/project-settings.tsx +9 -20
  107. package/src/pages/project.tsx +1 -5
  108. package/src/pages/projects.tsx +13 -28
  109. package/src/parity.ts +20 -4
  110. package/src/styles/globals.css +143 -131
  111. package/dist/chunks/audit-sentence-CUUMshIp.js.map +0 -1
  112. package/dist/chunks/directory-DrtdKny2.js.map +0 -1
  113. package/dist/chunks/offboarding-C7ECW5o0.js.map +0 -1
  114. package/dist/chunks/principal-page-CB6dAABC.js.map +0 -1
  115. package/dist/chunks/project-environments-lEzFHUt4.js +0 -11
  116. package/dist/chunks/project-environments-lEzFHUt4.js.map +0 -1
  117. package/dist/chunks/queries-DgQo3mC-.js.map +0 -1
  118. package/dist/chunks/ui-Br-dNUTc.js.map +0 -1
  119. package/dist/chunks/use-change-By4cG8bT.js.map +0 -1
package/src/options.ts CHANGED
@@ -24,17 +24,20 @@ import { memberRef, uiResult } from './lib/coffre';
24
24
  import { stringsOf } from './lib/search';
25
25
  import {
26
26
  hasAppsTab,
27
- loadAccess,
28
27
  loadDirectory,
28
+ loadEnvironment,
29
29
  loadMember,
30
+ loadPrincipal,
30
31
  loadProject,
31
32
  loadServiceDirectory,
32
33
  loadSettings,
34
+ loadSignIn,
33
35
  loadShell,
34
36
  projectOf,
35
37
  queries,
36
- signInWays,
38
+ tabOpens,
37
39
  type AuditSearch,
40
+ type Freshness,
38
41
  } from './lib/queries';
39
42
  import type { Permission } from './shared/models';
40
43
  import { loginSearch } from './lib/signin-errors';
@@ -154,29 +157,20 @@ export const environment = {
154
157
  validateSearch: (search: Record<string, unknown>): { filter?: string } => ({
155
158
  filter: typeof search.filter === 'string' && search.filter !== '' ? search.filter : undefined,
156
159
  }),
157
- loader: async ({ context, params }: Loader<{ project: string; environment: string }>) => {
160
+ loader: ({ context, params }: Loader<{ project: string; environment: string }>) => {
158
161
  const { coffre, queryClient } = coffreOf(context);
159
- const secrets = await queryClient.fetchQuery(queries.secrets(coffre, params));
160
- // Then, for whoever reads it, the references that read its secrets from
161
- // elsewhere and the keys it lacks, rendered with them. Asked only then,
162
- // so a refused visit is one refusal in the log, not three.
163
- if (secrets.ok) {
164
- await Promise.all([
165
- queryClient.fetchQuery(queries.references(coffre, `${params.project}/${params.environment}`)),
166
- queryClient.fetchQuery(queries.missing(coffre, params)),
167
- ]);
168
- }
169
- return secrets;
162
+ return loadEnvironment(queryClient, coffre, params);
170
163
  },
171
164
  };
172
165
 
173
166
  /** `/audit`. */
174
167
  export const audit = {
175
168
  // Filters live in the URL so a finding can cite the exact view it came from.
169
+ // Denials always include detail: a refused sign-in is one.
176
170
  validateSearch: (search: Record<string, unknown>): AuditSearch => ({
177
171
  decision: search.decision === 'deny' ? 'deny' : undefined,
178
172
  actorId: typeof search.actorId === 'string' && search.actorId !== '' ? search.actorId : undefined,
179
- detail: search.detail === '1' ? '1' : undefined,
173
+ detail: search.detail === '1' || search.decision === 'deny' ? '1' : undefined,
180
174
  }),
181
175
  loaderDeps: ({ search }: { search: AuditSearch }) => search,
182
176
  // The entries only: the verification is asked for once the page is up
@@ -195,28 +189,27 @@ export const users = {
195
189
  },
196
190
  };
197
191
 
198
- /** `/users/$user`, the layout of a user's tabs: who they are to the instance, for owners. */
192
+ /**
193
+ * `/users/$user`, the layout of a user's tabs: who they are to the instance,
194
+ * for owners, and their access, for whoever manages it. Its tabs read what
195
+ * it read from the cache (`Freshness`), so each opens at once.
196
+ */
199
197
  export const user = {
200
198
  loader: ({ context, params }: Loader<{ user: string }>) => {
201
199
  const { coffre, queryClient } = coffreOf(context);
202
- return loadMember(queryClient, coffre, memberRef('user', params.user));
200
+ return loadPrincipal(queryClient, coffre, 'user', params.user);
203
201
  },
204
202
  };
205
203
 
206
- /** `/users/$user/`, their access on every project where you manage it. */
207
- export const userAccess = {
208
- loader: ({ context, params }: Loader<{ user: string }>) => {
209
- const { coffre, queryClient } = coffreOf(context);
210
- return loadAccess(queryClient, coffre, memberRef('user', params.user));
211
- },
212
- };
204
+ /** `/users/$user/`, their access on every project where you manage it, which its layout reads. */
205
+ export const userAccess = {};
213
206
 
214
207
  /** `/users/$user/activity`, for whoever reads the audit log; the others are sent to the first tab. */
215
208
  export const userActivity = {
216
209
  loader: async ({ context, params }: Loader<{ user: string }>) => {
217
210
  const { coffre, queryClient } = coffreOf(context);
218
- const shell = await loadShell(queryClient, coffre);
219
- if (!shell.capabilities.canReadAudit) throw redirect({ to: '/users/$user', params });
211
+ const reads = async (freshness: Freshness) => (await loadShell(queryClient, coffre, freshness)).capabilities.canReadAudit;
212
+ if (!(await tabOpens(reads))) throw redirect({ to: '/users/$user', params });
220
213
  },
221
214
  };
222
215
 
@@ -229,9 +222,14 @@ export const userActivity = {
229
222
  export const userApps = {
230
223
  loader: async ({ context, params }: Loader<{ user: string }>) => {
231
224
  const { coffre, queryClient } = coffreOf(context);
232
- const shell = await loadShell(queryClient, coffre);
233
- const report = await loadMember(queryClient, coffre, memberRef('user', params.user));
234
- if (!hasAppsTab(shell, report)) throw redirect({ to: '/users/$user', params });
225
+ const has = async (freshness: Freshness) => {
226
+ const [shell, report] = await Promise.all([
227
+ loadShell(queryClient, coffre, freshness),
228
+ loadMember(queryClient, coffre, memberRef('user', params.user), freshness),
229
+ ]);
230
+ return hasAppsTab(shell, report);
231
+ };
232
+ if (!(await tabOpens(has))) throw redirect({ to: '/users/$user', params });
235
233
  },
236
234
  };
237
235
 
@@ -245,13 +243,14 @@ export const serviceAccounts = {
245
243
 
246
244
  /**
247
245
  * `/service-accounts/$account`, the layout of a service account's tabs: who
248
- * it is to the instance, for owners, and what it holds, for whoever manages it.
246
+ * it is to the instance, for owners, what it holds, and how it signs in, for
247
+ * whoever manages it. Its tabs read what it read from the cache
248
+ * (`Freshness`), so each opens at once.
249
249
  */
250
250
  export const serviceAccount = {
251
- loader: async ({ context, params }: Loader<{ account: string }>) => {
251
+ loader: ({ context, params }: Loader<{ account: string }>) => {
252
252
  const { coffre, queryClient } = coffreOf(context);
253
- const member = memberRef('service', params.account);
254
- await Promise.all([loadMember(queryClient, coffre, member), loadAccess(queryClient, coffre, member)]);
253
+ return loadPrincipal(queryClient, coffre, 'service', params.account);
255
254
  },
256
255
  };
257
256
 
@@ -263,31 +262,20 @@ export const serviceAccount = {
263
262
  export const serviceAccountSignIn = {
264
263
  loader: async ({ context, params }: Loader<{ account: string }>) => {
265
264
  const { coffre, queryClient } = coffreOf(context);
266
- const member = memberRef('service', params.account);
267
- const [shell, access] = await Promise.all([loadShell(queryClient, coffre), loadAccess(queryClient, coffre, member)]);
268
- const ways = signInWays(shell, access);
269
- if (ways === null) throw redirect({ to: '/service-accounts/$account/access', params });
270
- await Promise.all([
271
- queryClient.fetchQuery(queries.credentials(coffre, member, ways.tokens)),
272
- queryClient.fetchQuery(queries.bindings(coffre, member, ways.workloads)),
273
- ]);
265
+ const shows = async (freshness: Freshness) => (await loadSignIn(queryClient, coffre, memberRef('service', params.account), freshness)) !== null;
266
+ if (!(await tabOpens(shows))) throw redirect({ to: '/service-accounts/$account/access', params });
274
267
  },
275
268
  };
276
269
 
277
- /** `/service-accounts/$account/access`. */
278
- export const serviceAccountAccess = {
279
- loader: ({ context, params }: Loader<{ account: string }>) => {
280
- const { coffre, queryClient } = coffreOf(context);
281
- return loadAccess(queryClient, coffre, memberRef('service', params.account));
282
- },
283
- };
270
+ /** `/service-accounts/$account/access`, which its layout reads. */
271
+ export const serviceAccountAccess = {};
284
272
 
285
273
  /** `/service-accounts/$account/activity`, as a user's. */
286
274
  export const serviceAccountActivity = {
287
275
  loader: async ({ context, params }: Loader<{ account: string }>) => {
288
276
  const { coffre, queryClient } = coffreOf(context);
289
- const shell = await loadShell(queryClient, coffre);
290
- if (!shell.capabilities.canReadAudit) throw redirect({ to: '/service-accounts/$account', params });
277
+ const reads = async (freshness: Freshness) => (await loadShell(queryClient, coffre, freshness)).capabilities.canReadAudit;
278
+ if (!(await tabOpens(reads))) throw redirect({ to: '/service-accounts/$account', params });
291
279
  },
292
280
  };
293
281
 
@@ -335,7 +323,11 @@ export const accountSessions = {
335
323
  loader: async ({ context }: Loader) => {
336
324
  const { coffre, queryClient } = coffreOf(context);
337
325
  if (!(await ownSignIn(context))) throw redirect({ to: '/account' });
338
- await queryClient.fetchQuery(queries.sessions(coffre));
326
+ const { principal } = await loadShell(queryClient, coffre);
327
+ await Promise.all([
328
+ queryClient.fetchQuery(queries.sessions(coffre)),
329
+ ...(principal?.type === 'user' ? [queryClient.fetchQuery(queries.credentials(coffre, memberRef('user', principal.id), true))] : []),
330
+ ]);
339
331
  },
340
332
  };
341
333
 
@@ -12,13 +12,14 @@ import { ConfirmButton, CopyButton, EmptyState, ErrorLine, Notice, Timestamp } f
12
12
  import { Link as LinkIcon, Monitor, ProviderMark, SignOut, Sun, Terminal, User, X } from '../components/icons';
13
13
  import { signinErrorMessage } from '../lib/signin-errors';
14
14
  import { useOneTime } from '../lib/one-time';
15
- import { useCoffre } from '../lib/coffre';
15
+ import { memberRef, useCoffre } from '../lib/coffre';
16
16
  import { useMounted } from '../lib/mounted';
17
- import { disconnectApp, endSession, unlinkIdentity } from '../lib/changes';
17
+ import { disconnectApp, endSession, revokeCredential, unlinkIdentity } from '../lib/changes';
18
18
  import { queries } from '../lib/queries';
19
19
  import { useChange, useChangeStatus } from '../lib/use-change';
20
20
  import { RowFailure, RowPending, rowClass } from '../components/row-state';
21
21
  import { ConnectedAppsCard } from '../components/connected-apps';
22
+ import { PersonalTokensCard } from '../components/personal-tokens';
22
23
  import { pageRoute } from '../lib/page-route';
23
24
  import type { accountProfile } from '../options';
24
25
 
@@ -107,12 +108,33 @@ export function AccountProfilePage() {
107
108
  );
108
109
  }
109
110
 
110
- /** Where you are signed in, browsers and command lines. */
111
+ /** Where you are signed in, browsers and command lines, and the personal tokens that act as you. */
111
112
  export function AccountSessionsPage() {
112
- const { auth } = useShell();
113
+ const { auth, principal } = useShell();
113
114
  const { data: sessions } = useSuspenseQuery(queries.sessions(useCoffre()));
114
115
  if (!sessions.ok) return <ErrorLine error={sessions.error} />;
115
- return <Sessions sessions={sessions.sessions} providers={auth.signin?.providers ?? []} />;
116
+ return (
117
+ <>
118
+ <Sessions sessions={sessions.sessions} providers={auth.signin?.providers ?? []} />
119
+ {principal?.type === 'user' && <PersonalTokens email={principal.id} />}
120
+ </>
121
+ );
122
+ }
123
+
124
+ /** The personal tokens you made, for a script or an agent: each acts as you, within what it reaches, until it expires or you revoke it. */
125
+ function PersonalTokens({ email }: { email: string }) {
126
+ const client = useCoffre();
127
+ const member = memberRef('user', email);
128
+ const { data: tokens } = useSuspenseQuery(queries.credentials(client, member, true));
129
+ return (
130
+ <PersonalTokensCard
131
+ tokens={tokens === null ? [] : tokens.ok ? tokens.tokens : { error: tokens.error }}
132
+ change={revokeCredential(client, member)}
133
+ description="Tokens that act as you, for a script or an agent, within what each reaches and never beyond what you hold. Every entry one makes names it."
134
+ empty="Make one with the CLI, for an hour unless told:"
135
+ emptyActions={<CopyLine value="coffre tokens issue --label cursor-agent --scope <project>/<environment>=viewer --expires-in 4h" label="Copy the command" />}
136
+ />
137
+ );
116
138
  }
117
139
 
118
140
  /** How to connect Claude, then the apps you connected. */
@@ -8,11 +8,12 @@ import {
8
8
  decidedBy,
9
9
  describe,
10
10
  lines,
11
+ perSecret,
11
12
  runLabel,
12
13
  who,
13
14
  type Part,
14
15
  } from '../lib/audit-sentences';
15
- import { EmptyState, Notice, Spinner, Timestamp, Toggletip } from '../components/ui';
16
+ import { absolute, EmptyState, Notice, Spinner, Timestamp, Toggletip } from '../components/ui';
16
17
  import { memberName, Sentence } from '../components/audit-sentence';
17
18
  import { ClosedDoor, PageHeader } from '../components/page';
18
19
  import {
@@ -87,7 +88,7 @@ export function AuditPage() {
87
88
  ; <code>coffre audit</code> lists them all.
88
89
  </>
89
90
  ) : (
90
- ': it may be detail, which Show detail lists.'
91
+ ': it may be detail, which Everything lists.'
91
92
  )}
92
93
  </>
93
94
  )}
@@ -96,16 +97,18 @@ export function AuditPage() {
96
97
  )}
97
98
 
98
99
  <div className="toolbar">
99
- <nav className="segmented" aria-label="Filter by decision">
100
- {/* `exact` compares the whole search, not a subset of it: otherwise
101
- "All events" for one actor also counts as active while that
102
- actor's denials are showing, and both halves light up. */}
103
- <Link to="/audit" search={{ ...filters, decision: undefined, detail: search.detail }} activeOptions={{ exact: true, includeSearch: false }}>
104
- All events
100
+ {/* One control for what the log lists. `exact` holds each link to the
101
+ whole search, so only the view shown lights up. */}
102
+ <nav className="segmented" aria-label="Show">
103
+ <Link to="/audit" search={{ actorId }} activeOptions={{ exact: true }}>
104
+ Actions
105
105
  </Link>
106
- <Link to="/audit" search={{ ...filters, decision: 'deny', detail: search.detail }} activeOptions={{ exact: true, includeSearch: false }}>
106
+ <Link to="/audit" search={{ actorId, detail: '1' }} activeOptions={{ exact: true }}>
107
+ Everything
108
+ </Link>
109
+ <Link to="/audit" search={{ actorId, decision: 'deny', detail: '1' }} activeOptions={{ exact: true }}>
107
110
  <SlashCircle size={13} />
108
- Denials only
111
+ Denials
109
112
  </Link>
110
113
  </nav>
111
114
 
@@ -120,16 +123,6 @@ export function AuditPage() {
120
123
  <X size={13} />
121
124
  </Link>
122
125
  )}
123
-
124
- <Link
125
- className="detail-toggle"
126
- to="/audit"
127
- search={{ ...filters, detail: detail ? undefined : '1' }}
128
- aria-pressed={detail}
129
- >
130
- <span className="switch" aria-hidden="true" />
131
- Show detail
132
- </Link>
133
126
  </div>
134
127
 
135
128
  <section className="card card-wide" aria-label="Audit entries">
@@ -190,7 +183,11 @@ export function AuditPage() {
190
183
  type Entry = AuditEntryView;
191
184
  type Filters = { decision?: 'deny'; actorId?: string };
192
185
 
193
- /** One action: an entry, or a batch of them under one operation, which opens to each. */
186
+ /**
187
+ * One action: an entry, or a batch of them under one operation, which opens
188
+ * to each; a read of several secrets, logged as one entry, opens to each
189
+ * secret, under its entry's number.
190
+ */
194
191
  function Line({
195
192
  batch,
196
193
  filters,
@@ -207,13 +204,18 @@ function Line({
207
204
  const lead = batch[0]!;
208
205
  const sentence = describe(batch);
209
206
  const seqs = batch.map((entry) => entry.seq);
210
- const grouped = batch.length > 1;
207
+ const each = batch.flatMap(perSecret);
208
+ const grouped = each.length > 1;
209
+ const [unit, units] = each.length === batch.length ? ['entry', 'entries'] : ['secret', 'secrets'];
210
+ // A read of several breaks at its first secret's row.
211
+ const breakRow = each.findIndex((entry) => entry.seq === breakAt);
212
+ const [first, last] = [Math.min(...seqs), Math.max(...seqs)];
211
213
 
212
214
  return (
213
215
  <>
214
216
  <Row
215
217
  entry={lead}
216
- seq={grouped ? `${Math.min(...seqs)}–${Math.max(...seqs)}` : String(lead.seq)}
218
+ seq={first === last ? String(first) : `${first}–${last}`}
217
219
  parts={sentence.parts}
218
220
  refused={sentence.refused}
219
221
  decided={decidedBy(batch)}
@@ -227,7 +229,7 @@ function Line({
227
229
  type="button"
228
230
  className="batch-toggle"
229
231
  aria-expanded={open}
230
- aria-label={open ? 'Hide each entry' : `Show each of ${batch.length} entries`}
232
+ aria-label={open ? `Hide each ${unit}` : `Show each of ${each.length} ${units}`}
231
233
  onClick={() => setOpen(!open)}
232
234
  >
233
235
  <ChevronRight size={14} />
@@ -237,11 +239,11 @@ function Line({
237
239
  />
238
240
  {grouped &&
239
241
  open &&
240
- batch.map((entry) => {
242
+ each.map((entry, i) => {
241
243
  const one = describe([entry]);
242
244
  return (
243
245
  <Row
244
- key={entry.seq}
246
+ key={`${entry.seq}:${i}`}
245
247
  entry={entry}
246
248
  seq={String(entry.seq)}
247
249
  parts={one.parts}
@@ -249,7 +251,7 @@ function Line({
249
251
  decided={decidedBy([entry])}
250
252
  filters={filters}
251
253
  detail={detail}
252
- breaks={entry.seq === breakAt}
254
+ breaks={i === breakRow}
253
255
  marked={false}
254
256
  child
255
257
  />
@@ -322,6 +324,12 @@ function Row({
322
324
  {runLabel(entry.run)}
323
325
  </small>
324
326
  )}
327
+ {entry.token != null && (
328
+ // The personal token the person made the request with, by the label it was made with.
329
+ <small className="actor-run" title={`Personal token ${entry.token.id}`}>
330
+ via token “{entry.token.label}”
331
+ </small>
332
+ )}
325
333
  </td>
326
334
  <td className="cell-sentence" data-label="What they did">
327
335
  <span className="sentence">
@@ -431,10 +439,9 @@ function ChainStatus({ chain, onRetry }: { chain: ChainResult | undefined; onRet
431
439
  <Toggletip
432
440
  align="end"
433
441
  label={
434
- `Every entry through ${chain.through ?? 0} holds, under the app's key and the vault's.` +
435
- (chain.checkpoint === null
436
- ? ' Not checkpointed yet: the vault signs the log every few minutes.'
437
- : ` The vault last signed it through entry ${chain.checkpoint.seq}, at ${chain.checkpoint.signedAt}.`)
442
+ chain.checkpoint === null
443
+ ? 'Audit log verified by the app and vault keys, not signed yet.'
444
+ : `Audit log verified by the app and vault keys, last signature at ${absolute(chain.checkpoint.signedAt, false)} UTC.`
438
445
  }
439
446
  >
440
447
  <button type="button" className="chain-seal">