@coffre/ui 0.15.0 → 0.16.1

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 (139) hide show
  1. package/dist/audit-sentences.d.ts +56 -0
  2. package/dist/audit-sentences.js +886 -0
  3. package/dist/audit-sentences.js.map +1 -0
  4. package/dist/chunks/audit-sentence-C8NnAdjF.js +48 -0
  5. package/dist/chunks/audit-sentence-C8NnAdjF.js.map +1 -0
  6. package/dist/chunks/{connected-apps-CGUQlFMx.js → connected-apps-6sMSgQ9U.js} +5 -5
  7. package/dist/chunks/{connected-apps-CGUQlFMx.js.map → connected-apps-6sMSgQ9U.js.map} +1 -1
  8. package/dist/chunks/{delete-place-CswZ-meh.js → delete-place-T469tSN9.js} +5 -5
  9. package/dist/chunks/{delete-place-CswZ-meh.js.map → delete-place-T469tSN9.js.map} +1 -1
  10. package/dist/chunks/{directory-DrswWQLT.js → directory-B_gVf7UL.js} +18 -17
  11. package/dist/chunks/directory-B_gVf7UL.js.map +1 -0
  12. package/dist/chunks/{folders-A6sbR_PG.js → folders-CVYauIDz.js} +3 -3
  13. package/dist/chunks/{folders-A6sbR_PG.js.map → folders-CVYauIDz.js.map} +1 -1
  14. package/dist/chunks/{grants-C0cb2oii.js → grants-Dn_EW2XW.js} +8 -8
  15. package/dist/chunks/grants-Dn_EW2XW.js.map +1 -0
  16. package/dist/chunks/{multi-combobox-B3SEv1gq.js → multi-combobox-fbBRzi9z.js} +3 -3
  17. package/dist/chunks/{multi-combobox-B3SEv1gq.js.map → multi-combobox-fbBRzi9z.js.map} +1 -1
  18. package/dist/chunks/{offboarding-C1jbG_dk.js → offboarding-CXM464J_.js} +81 -80
  19. package/dist/chunks/offboarding-CXM464J_.js.map +1 -0
  20. package/dist/chunks/{page-CfhC9Hp1.js → page-Cb0ZjGda.js} +7 -12
  21. package/dist/chunks/page-Cb0ZjGda.js.map +1 -0
  22. package/dist/chunks/{personal-tokens-xC9wulhg.js → personal-tokens-CSHMlRHy.js} +7 -7
  23. package/dist/chunks/personal-tokens-CSHMlRHy.js.map +1 -0
  24. package/dist/chunks/{principal-CI17XK13.js → principal-BKJxbAtE.js} +2 -2
  25. package/dist/chunks/{principal-CI17XK13.js.map → principal-BKJxbAtE.js.map} +1 -1
  26. package/dist/chunks/{principal-page-CdSeftGD.js → principal-page-COPmTDVW.js} +132 -19
  27. package/dist/chunks/principal-page-COPmTDVW.js.map +1 -0
  28. package/dist/chunks/{project-page-CHxjBE97.js → project-page-g5_n46Nz.js} +3 -3
  29. package/dist/chunks/{project-page-CHxjBE97.js.map → project-page-g5_n46Nz.js.map} +1 -1
  30. package/dist/chunks/protected-DEWeOrmI.js +77 -0
  31. package/dist/chunks/protected-DEWeOrmI.js.map +1 -0
  32. package/dist/chunks/{queries-D1JuimTu.js → queries-D4_o-bz3.js} +22 -155
  33. package/dist/chunks/queries-D4_o-bz3.js.map +1 -0
  34. package/dist/chunks/{references-D5llUGQL.js → references-wTh_DT0M.js} +27 -23
  35. package/dist/chunks/references-wTh_DT0M.js.map +1 -0
  36. package/dist/chunks/{role-field-CoCv8wse.js → role-field-BiP09qfN.js} +5 -5
  37. package/dist/chunks/role-field-BiP09qfN.js.map +1 -0
  38. package/dist/chunks/{row-state-CYH7kZHl.js → row-state-CYhtmUkc.js} +3 -3
  39. package/dist/chunks/{row-state-CYH7kZHl.js.map → row-state-CYhtmUkc.js.map} +1 -1
  40. package/dist/chunks/{signin-errors-TlQmQe0t.js → signin-errors-BMnox7XD.js} +5 -19
  41. package/dist/chunks/signin-errors-BMnox7XD.js.map +1 -0
  42. package/dist/chunks/{theme-rF44Wbmm.js → theme-imSolE1q.js} +3 -3
  43. package/dist/chunks/{theme-rF44Wbmm.js.map → theme-imSolE1q.js.map} +1 -1
  44. package/dist/chunks/{ui-CGdORVzW.js → ui-Q_Eczt7m.js} +7 -3
  45. package/dist/chunks/{ui-CGdORVzW.js.map → ui-Q_Eczt7m.js.map} +1 -1
  46. package/dist/chunks/{use-action-BxrHTBZw.js → use-action-BfnN-De2.js} +3 -3
  47. package/dist/chunks/{use-action-BxrHTBZw.js.map → use-action-BfnN-De2.js.map} +1 -1
  48. package/dist/chunks/{use-change-BorW2R6C.js → use-change-Cc0X4sF3.js} +6 -4
  49. package/dist/chunks/use-change-Cc0X4sF3.js.map +1 -0
  50. package/dist/chunks/{use-roles-BZnJ9Cq0.js → use-roles-stcv2QFj.js} +13 -56
  51. package/dist/chunks/use-roles-stcv2QFj.js.map +1 -0
  52. package/dist/chunks/{use-shell-CPskgi1k.js → use-shell-DMhLa2sh.js} +3 -3
  53. package/dist/chunks/{use-shell-CPskgi1k.js.map → use-shell-DMhLa2sh.js.map} +1 -1
  54. package/dist/index.d.ts +23 -55
  55. package/dist/index.js +12 -31
  56. package/dist/index.js.map +1 -1
  57. package/dist/pages/account.js +12 -12
  58. package/dist/pages/account.js.map +1 -1
  59. package/dist/pages/approval.js +2 -2
  60. package/dist/pages/audit.js +173 -196
  61. package/dist/pages/audit.js.map +1 -1
  62. package/dist/pages/device-login.js +2 -2
  63. package/dist/pages/environment.js +445 -252
  64. package/dist/pages/environment.js.map +1 -1
  65. package/dist/pages/login.js +6 -15
  66. package/dist/pages/login.js.map +1 -1
  67. package/dist/pages/oauth-authorize.js +2 -2
  68. package/dist/pages/project-access.js +11 -11
  69. package/dist/pages/project-environments.js +359 -28
  70. package/dist/pages/project-environments.js.map +1 -1
  71. package/dist/pages/project-settings.js +8 -8
  72. package/dist/pages/project.js +3 -3
  73. package/dist/pages/projects.js +8 -8
  74. package/dist/pages/service-account.js +19 -16
  75. package/dist/pages/service-account.js.map +1 -1
  76. package/dist/pages/service-accounts.js +6 -7
  77. package/dist/pages/service-accounts.js.map +1 -1
  78. package/dist/pages/settings.d.ts +1 -6
  79. package/dist/pages/settings.js +155 -286
  80. package/dist/pages/settings.js.map +1 -1
  81. package/dist/pages/unregistered.js +2 -2
  82. package/dist/pages/user.js +7 -8
  83. package/dist/pages/user.js.map +1 -1
  84. package/dist/pages/users.js +6 -7
  85. package/dist/pages/users.js.map +1 -1
  86. package/package.json +8 -3
  87. package/src/components/actions-log.tsx +8 -61
  88. package/src/components/directory.tsx +10 -9
  89. package/src/components/grants.tsx +2 -2
  90. package/src/components/icons.tsx +0 -2
  91. package/src/components/offboarding.tsx +9 -16
  92. package/src/components/page.tsx +2 -3
  93. package/src/components/personal-tokens.tsx +5 -2
  94. package/src/components/principal-page.tsx +5 -4
  95. package/src/components/protected.tsx +39 -52
  96. package/src/components/references.tsx +18 -7
  97. package/src/components/role-editor.tsx +68 -99
  98. package/src/components/role-field.tsx +1 -1
  99. package/src/components/trusted-workloads.tsx +6 -5
  100. package/src/components/ui.tsx +5 -0
  101. package/src/lib/audit-proofs.ts +51 -0
  102. package/src/lib/audit-sentences.ts +490 -529
  103. package/src/lib/bindings.ts +6 -0
  104. package/src/lib/changes.ts +3 -1
  105. package/src/lib/coffre.ts +2 -2
  106. package/src/lib/queries.ts +19 -168
  107. package/src/lib/reveal.ts +32 -5
  108. package/src/lib/roles.ts +10 -36
  109. package/src/lib/row-reads.ts +2 -2
  110. package/src/lib/signin-errors.ts +5 -33
  111. package/src/options.ts +3 -19
  112. package/src/pages/account.tsx +1 -1
  113. package/src/pages/audit.tsx +151 -228
  114. package/src/pages/environment.tsx +373 -247
  115. package/src/pages/login.tsx +2 -4
  116. package/src/pages/project-environments.tsx +322 -20
  117. package/src/pages/service-accounts.tsx +1 -1
  118. package/src/pages/settings.tsx +49 -134
  119. package/src/pages/user.tsx +2 -2
  120. package/src/pages/users.tsx +1 -1
  121. package/src/parity.ts +11 -20
  122. package/src/styles/globals.css +107 -273
  123. package/dist/chunks/actions-log-DupYCEyV.js +0 -1134
  124. package/dist/chunks/actions-log-DupYCEyV.js.map +0 -1
  125. package/dist/chunks/directory-DrswWQLT.js.map +0 -1
  126. package/dist/chunks/environment-actions-8rL9Cw6X.js +0 -576
  127. package/dist/chunks/environment-actions-8rL9Cw6X.js.map +0 -1
  128. package/dist/chunks/grants-C0cb2oii.js.map +0 -1
  129. package/dist/chunks/offboarding-C1jbG_dk.js.map +0 -1
  130. package/dist/chunks/page-CfhC9Hp1.js.map +0 -1
  131. package/dist/chunks/personal-tokens-xC9wulhg.js.map +0 -1
  132. package/dist/chunks/principal-page-CdSeftGD.js.map +0 -1
  133. package/dist/chunks/queries-D1JuimTu.js.map +0 -1
  134. package/dist/chunks/references-D5llUGQL.js.map +0 -1
  135. package/dist/chunks/role-field-CoCv8wse.js.map +0 -1
  136. package/dist/chunks/signin-errors-TlQmQe0t.js.map +0 -1
  137. package/dist/chunks/use-change-BorW2R6C.js.map +0 -1
  138. package/dist/chunks/use-roles-BZnJ9Cq0.js.map +0 -1
  139. package/src/components/environment-actions.tsx +0 -508
@@ -1,41 +1,54 @@
1
- import { O as wholeTrees, k as withTrees, r as chainUnknown, w as shownChain, x as queries } from "../chunks/queries-D1JuimTu.js";
2
- import { c as Notice, f as Toggletip, i as EmptyState, l as Spinner, m as absolute, u as Timestamp } from "../chunks/ui-CGdORVzW.js";
3
- import { F as Ledger, M as Info, S as Clock, Z as ShieldCheck, at as User, b as ChevronRight, ct as X, et as SlashCircle, f as Activity, i as PageHeader, m as AlertTriangle, n as ClosedDoor, u as useCoffre } from "../chunks/page-CfhC9Hp1.js";
1
+ import { y as queries } from "../chunks/queries-D4_o-bz3.js";
2
+ import { c as Notice, f as Toggletip, i as EmptyState, m as absolute, u as Timestamp } from "../chunks/ui-Q_Eczt7m.js";
3
+ import { $ as SlashCircle, P as Ledger, S as Clock, X as ShieldCheck, b as ChevronRight, f as Activity, i as PageHeader, it as User, m as AlertTriangle, n as ClosedDoor, st as X, u as useCoffre } from "../chunks/page-Cb0ZjGda.js";
4
+ import { decidedBy, describe, lines, perSecret, runLabel, who } from "../audit-sentences.js";
4
5
  import { t as pageRoute } from "../chunks/page-route-Drfw7lmn.js";
5
- import { a as decidedBy, c as perSecret, i as memberName, l as runLabel, n as ReadsLag, o as describe, r as Sentence, s as lines, u as who } from "../chunks/actions-log-DupYCEyV.js";
6
- import { useState } from "react";
6
+ import { n as memberName, t as Sentence } from "../chunks/audit-sentence-C8NnAdjF.js";
7
+ import { useEffect, useRef, useState } from "react";
7
8
  import { Link } from "@tanstack/react-router";
8
9
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
9
10
  import { useSuspenseQuery } from "@tanstack/react-query";
11
+ //#region src/lib/audit-proofs.ts
12
+ /** A batch's, or a read's: its worst entry's. */
13
+ function proofOf(proofs) {
14
+ return proofs.includes("failed") ? "failed" : proofs.includes("unproven") ? "unproven" : "proven";
15
+ }
16
+ var headKey = (head) => `${head.size}@${head.signedAt}`;
17
+ /**
18
+ * Each entry's proof as the page shows it: the answer's, except that one
19
+ * proven before under this same head and now not is failed. Under one head
20
+ * an entry proves or does not for good: only its tree and leaf, columns a
21
+ * writer edits, can move it past the head, so the page never shows an entry
22
+ * proven and later not proven against the same head. Another head is
23
+ * another answer: one put back from before covers less, and the page shows
24
+ * what it covers.
25
+ */
26
+ function shownProofs(proved, head, entries) {
27
+ const seen = head === null ? void 0 : proved.get(headKey(head));
28
+ return new Map(entries.map((entry) => [entry.seq, entry.proof === "unproven" && seen?.has(entry.seq) ? "failed" : entry.proof]));
29
+ }
30
+ /** Notes what an answer proved, under its head. */
31
+ function remember(proved, head, entries) {
32
+ if (head === null) return;
33
+ const key = headKey(head);
34
+ const seen = proved.get(key) ?? /* @__PURE__ */ new Set();
35
+ for (const entry of entries) if (entry.proof === "proven") seen.add(entry.seq);
36
+ proved.set(key, seen);
37
+ }
38
+ //#endregion
10
39
  //#region src/pages/audit.tsx
11
40
  var Route = pageRoute();
12
41
  function AuditPage() {
13
42
  const search = Route.useSearch();
14
43
  const client = useCoffre();
15
- const { data: result } = useSuspenseQuery(queries.auditEntries(client, search));
16
- const verification = useSuspenseQuery(queries.auditChain(client));
17
- const [whole, setWhole] = useState(null);
18
- const chain = shownChain(verification.data, whole);
19
- const [walked, setWalked] = useState(null);
20
- const [walkFailed, setWalkFailed] = useState(null);
21
- const walkWhole = async () => {
22
- setWalked({ through: null });
23
- setWalkFailed(null);
24
- setWhole(null);
25
- let verdict;
26
- try {
27
- const trees = Promise.allSettled([wholeTrees(client)]);
28
- verdict = withTrees(await client.audit.verifyWhole((stretch) => setWalked({ through: stretch.through })), true, (await trees)[0]);
29
- } catch (error) {
30
- verdict = chainUnknown(error);
31
- }
32
- if (verdict.integrity === "unknown") setWalkFailed(verdict.problem);
33
- else if (verdict.integrity === "owners-only") setWalkFailed("the request was refused (HTTP 403)");
34
- else setWhole(verdict);
35
- setWalked(null);
36
- };
44
+ const entries = useSuspenseQuery(queries.auditEntries(client, search));
45
+ const result = entries.data;
46
+ const proved = useRef(/* @__PURE__ */ new Map());
47
+ const proofs = result.ok ? shownProofs(proved.current, result.head, result.entries) : /* @__PURE__ */ new Map();
48
+ useEffect(() => {
49
+ if (result.ok) remember(proved.current, result.head, result.entries);
50
+ }, [result]);
37
51
  const { decision, actorId } = search;
38
- const detail = search.detail === "1";
39
52
  const deniedOnly = decision === "deny";
40
53
  if (!result.ok) return /* @__PURE__ */ jsx(ClosedDoor, {
41
54
  icon: /* @__PURE__ */ jsx(Ledger, { size: 18 }),
@@ -43,8 +56,26 @@ function AuditPage() {
43
56
  title: "The audit log is closed to you",
44
57
  children: result.error
45
58
  });
46
- const broken = chain?.integrity === "broken" ? chain : null;
47
- const breakAt = broken?.failedAtSeq ?? null;
59
+ const proof = (entry) => proofs.get(entry.seq) ?? entry.proof;
60
+ const failed = result.entries.filter((entry) => proof(entry) === "failed");
61
+ const counts = {
62
+ failed: failed.length,
63
+ unproven: result.entries.filter((entry) => proof(entry) === "unproven").length,
64
+ proven: result.entries.filter((entry) => proof(entry) === "proven").length
65
+ };
66
+ const signed = result.head === null ? null : `${absolute(result.head.signedAt, false)} UTC`;
67
+ const holes = result.holes ?? [];
68
+ const gone = (kind) => {
69
+ const found = holes.filter((hole) => hole[kind] > 0);
70
+ const count = found.reduce((sum, hole) => sum + hole[kind], 0);
71
+ return {
72
+ count,
73
+ places: found.length === 1 ? where(found[0]) : `, in ${found.length} places`,
74
+ entries: `${count.toLocaleString("en")} ${count === 1 ? "entry" : "entries"}`
75
+ };
76
+ };
77
+ const removed = gone("kept");
78
+ const pruned = gone("aging");
48
79
  const shown = lines(result.entries);
49
80
  const filters = {
50
81
  decision,
@@ -57,40 +88,55 @@ function AuditPage() {
57
88
  className: "chain-live",
58
89
  "aria-live": "polite",
59
90
  "aria-atomic": "true",
60
- children: /* @__PURE__ */ jsx(ChainStatus, {
61
- chain,
62
- walked,
63
- walkFailed,
64
- retrying: verification.isFetching,
65
- onRetry: () => void verification.refetch(),
66
- onWalk: () => void walkWhole()
91
+ children: /* @__PURE__ */ jsx(ProofStatus, {
92
+ head: result.head,
93
+ counts,
94
+ pruned: pruned.count > 0,
95
+ checking: entries.isFetching,
96
+ onCheck: () => void entries.refetch()
67
97
  })
68
98
  })
69
99
  }),
70
- broken !== null && /* @__PURE__ */ jsx("div", {
100
+ failed.length > 0 && /* @__PURE__ */ jsx("div", {
71
101
  style: { marginBottom: "1.25rem" },
72
102
  children: /* @__PURE__ */ jsxs(Notice, {
73
103
  tone: "bad",
74
104
  children: [
75
105
  /* @__PURE__ */ jsx("strong", { children: "Treat this as an incident." }),
76
106
  " ",
77
- broken.failedAtSeq === null ? `The log does not verify, found by the ${broken.author}'s check: ${broken.reason}.` : `The log breaks at entry ${broken.failedAtSeq}, found by the ${broken.author}'s check: ${broken.reason}.`,
78
- " ",
79
- broken.through !== null && `Every entry through ${broken.through} holds. `,
80
- "Something with direct access to the database has changed what it records",
81
- broken.failedAtSeq === null ? "" : `, and nothing from entry ${broken.failedAtSeq} on can be relied on`,
82
- " until that is explained.",
83
- breakAt !== null && !result.entries.some((entry) => breaksAt(entry, breakAt)) && /* @__PURE__ */ jsxs(Fragment$1, { children: [
84
- " ",
85
- "Entry ",
86
- breakAt,
87
- " is not among the entries below",
88
- detail ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
89
- "; ",
90
- /* @__PURE__ */ jsx("code", { children: "coffre audit" }),
91
- " lists them all."
92
- ] }) : ": it may be detail, which Everything lists."
93
- ] })
107
+ failed.length === 1 ? `Entry ${failed[0].seq} is` : `${failed.length} entries below are`,
108
+ " not what the vault signed",
109
+ signed === null ? "" : ` in the head it signed at ${signed}`,
110
+ ". Something with direct access to the database has changed what the log records, and ",
111
+ failed.length === 1 ? "that entry" : "those entries",
112
+ " can’t be relied on until that is explained."
113
+ ]
114
+ })
115
+ }),
116
+ removed.count > 0 && /* @__PURE__ */ jsx("div", {
117
+ style: { marginBottom: "1.25rem" },
118
+ children: /* @__PURE__ */ jsxs(Notice, {
119
+ tone: "bad",
120
+ children: [
121
+ /* @__PURE__ */ jsx("strong", { children: "Treat this as an incident." }),
122
+ " The log lacks ",
123
+ removed.entries,
124
+ " the vault’s head numbers",
125
+ removed.places,
126
+ ". Nothing prunes these entries: something with direct access to the database removed them."
127
+ ]
128
+ })
129
+ }),
130
+ pruned.count > 0 && /* @__PURE__ */ jsx("div", {
131
+ style: { marginBottom: "1.25rem" },
132
+ children: /* @__PURE__ */ jsxs(Notice, {
133
+ tone: "warn",
134
+ children: [
135
+ "The log lacks ",
136
+ pruned.entries,
137
+ " the vault’s head numbers",
138
+ pruned.places,
139
+ ", all of the kind it prunes with age. A prune while the page read the log does this, and checking again settles it; entries that stay missing were removed by something with direct access to the database."
94
140
  ]
95
141
  })
96
142
  }),
@@ -145,10 +191,6 @@ function AuditPage() {
145
191
  ]
146
192
  })]
147
193
  }),
148
- /* @__PURE__ */ jsx(ReadsLag, {
149
- reads: result.reads,
150
- omitted: result.readsOmitted
151
- }),
152
194
  /* @__PURE__ */ jsx("section", {
153
195
  className: "card card-wide",
154
196
  "aria-label": "Audit entries",
@@ -194,36 +236,27 @@ function AuditPage() {
194
236
  batch,
195
237
  filters,
196
238
  detail: search.detail,
197
- breakAt
198
- }, entryKey(batch[0]))) })]
239
+ proof
240
+ }, batch[0].seq)) })]
199
241
  })
200
242
  })
201
243
  })
202
244
  ] });
203
245
  }
204
- /** Where the chain breaks is an entry of 0.14's: 0.15's sealed log numbers its changes apart, and says no entry of its own. */
205
- function breaksAt(entry, seq) {
206
- return entry.log !== "0.15" && entry.seq === seq;
207
- }
208
- /** An entry by its log and number: 0.14's chain and 0.15's sealed log each number theirs. */
209
- function entryKey(entry) {
210
- return `${entry.log}:${entry.seq}`;
211
- }
212
246
  /**
213
247
  * One action: an entry, or a batch of them under one operation, which opens
214
248
  * to each; a read of several secrets, logged as one entry, opens to each
215
249
  * secret, under its entry's number.
216
250
  */
217
- function Line({ batch, filters, detail, breakAt }) {
218
- const breaksInside = breakAt !== null && batch.some((entry) => breaksAt(entry, breakAt));
219
- const [open, setOpen] = useState(breaksInside);
251
+ function Line({ batch, filters, detail, proof }) {
252
+ const shown = proofOf(batch.map(proof));
253
+ const [open, setOpen] = useState(shown === "failed");
220
254
  const lead = batch[0];
221
255
  const sentence = describe(batch);
222
256
  const seqs = batch.map((entry) => entry.seq);
223
257
  const each = batch.flatMap(perSecret);
224
258
  const grouped = each.length > 1;
225
259
  const [unit, units] = each.length === batch.length ? ["entry", "entries"] : ["secret", "secrets"];
226
- const breakRow = each.findIndex((entry) => breakAt !== null && breaksAt(entry, breakAt));
227
260
  const [first, last] = [Math.min(...seqs), Math.max(...seqs)];
228
261
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Row, {
229
262
  entry: lead,
@@ -233,8 +266,7 @@ function Line({ batch, filters, detail, breakAt }) {
233
266
  decided: decidedBy(batch),
234
267
  filters,
235
268
  detail,
236
- breaks: breaksInside && !grouped,
237
- marked: breaksInside,
269
+ proof: shown,
238
270
  toggle: grouped ? /* @__PURE__ */ jsx("button", {
239
271
  type: "button",
240
272
  className: "batch-toggle",
@@ -253,32 +285,28 @@ function Line({ batch, filters, detail, breakAt }) {
253
285
  decided: decidedBy([entry]),
254
286
  filters,
255
287
  detail,
256
- breaks: i === breakRow,
257
- marked: false,
288
+ proof: proof(entry),
258
289
  child: true
259
- }, `${entryKey(entry)}:${i}`);
290
+ }, `${entry.seq}:${i}`);
260
291
  })] });
261
292
  }
262
- function Row({ entry, seq, parts, refused, decided, filters, detail, breaks, marked, toggle, child = false }) {
293
+ function Row({ entry, seq, parts, refused, decided, filters, detail, proof, toggle, child = false }) {
263
294
  const actor = who(entry);
264
295
  const classes = [
265
296
  refused && "is-denied",
266
- (breaks || marked) && "is-break",
297
+ proof === "failed" && "is-break",
267
298
  child && "is-child",
268
299
  entry.detail && "is-detail",
269
- (entry.action === "vault.tampered" || entry.forged === true) && "is-tampered"
300
+ entry.action === "vault.tampered" && "is-tampered"
270
301
  ].filter(Boolean);
271
302
  return /* @__PURE__ */ jsxs("tr", {
272
303
  className: classes.length === 0 ? void 0 : classes.join(" "),
304
+ "data-proof": proof,
273
305
  children: [
274
- /* @__PURE__ */ jsxs("td", {
306
+ /* @__PURE__ */ jsx("td", {
275
307
  className: "n",
276
308
  "data-label": "Sequence",
277
- title: entry.log === "0.15" ? `Entry ${entry.seq} of the sealed log, which numbers its own` : void 0,
278
- children: [seq, entry.log === "0.15" && /* @__PURE__ */ jsx("small", {
279
- className: "n-log",
280
- children: "sealed"
281
- })]
309
+ children: seq
282
310
  }),
283
311
  /* @__PURE__ */ jsx("td", {
284
312
  className: "nowrap cell-mono",
@@ -313,7 +341,7 @@ function Row({ entry, seq, parts, refused, decided, filters, detail, breaks, mar
313
341
  }),
314
342
  entry.run !== null && /* @__PURE__ */ jsx("small", {
315
343
  className: "actor-run",
316
- title: entry.run.log === "0.15" ? `Signed in at change ${entry.run.exchangeSeq} of the sealed log` : `Exchanged in entry ${entry.run.exchangeSeq}`,
344
+ title: `Exchanged in entry ${entry.run.exchangeSeq}`,
317
345
  children: runLabel(entry.run)
318
346
  }),
319
347
  entry.token != null && /* @__PURE__ */ jsxs("small", {
@@ -327,21 +355,22 @@ function Row({ entry, seq, parts, refused, decided, filters, detail, breaks, mar
327
355
  })
328
356
  ]
329
357
  }),
330
- /* @__PURE__ */ jsxs("td", {
358
+ /* @__PURE__ */ jsx("td", {
331
359
  className: "cell-sentence",
332
360
  "data-label": "What they did",
333
- children: [/* @__PURE__ */ jsxs("span", {
361
+ children: /* @__PURE__ */ jsxs("span", {
334
362
  className: "sentence",
335
363
  children: [
336
364
  toggle,
337
- (entry.action === "vault.tampered" || entry.forged === true) && /* @__PURE__ */ jsx(AlertTriangle, { size: 13 }),
365
+ entry.action === "vault.tampered" && /* @__PURE__ */ jsx(AlertTriangle, { size: 13 }),
338
366
  /* @__PURE__ */ jsx(Sentence, { parts }),
339
- breaks && /* @__PURE__ */ jsx(BreakMark, {})
367
+ proof === "failed" && /* @__PURE__ */ jsx(BreakMark, {}),
368
+ proof === "unproven" && /* @__PURE__ */ jsx("span", {
369
+ className: "unproven-mark",
370
+ children: "not proven"
371
+ })
340
372
  ]
341
- }), entry.forged === true && /* @__PURE__ */ jsx("small", {
342
- className: "actor-run",
343
- children: "Forged: the vault does not vouch for this entry"
344
- })]
373
+ })
345
374
  }),
346
375
  /* @__PURE__ */ jsx("td", {
347
376
  className: "nowrap",
@@ -358,136 +387,84 @@ function Row({ entry, seq, parts, refused, decided, filters, detail, breaks, mar
358
387
  ]
359
388
  });
360
389
  }
361
- /** The entry the log breaks at, said in words as well as in red. */
390
+ /** An entry that is not what the vault signed, said in words as well as in red. */
362
391
  function BreakMark() {
363
392
  return /* @__PURE__ */ jsxs("span", {
364
393
  className: "break-mark",
365
- children: [/* @__PURE__ */ jsx(AlertTriangle, { size: 11 }), "breaks here"]
394
+ children: [/* @__PURE__ */ jsx(AlertTriangle, { size: 11 }), "not as signed"]
366
395
  });
367
396
  }
397
+ /** Where a hole is, between the entries found around it. */
398
+ function where(hole) {
399
+ if (hole.above !== null && hole.below !== null) return ` between entries ${hole.below} and ${hole.above}`;
400
+ if (hole.below !== null) return ` after entry ${hole.below}`;
401
+ if (hole.above !== null) return ` before entry ${hole.above}`;
402
+ return "";
403
+ }
368
404
  /**
369
- * Whether the log still verifies, beside the title.
370
- *
371
- * This replaced a card with a "Verify chain" button on it. A green result you
372
- * have to ask for is reassurance rather than evidence: it is checked when
373
- * someone is already feeling confident, and not on the morning it would have
374
- * mattered. Recomputing on load makes the claim continuous.
405
+ * What the entries shown prove, beside the title: rendered with the page,
406
+ * from the answer that listed them, never a loading state.
375
407
  *
376
- * On load it checks what was written since the newest checkpoint, which
377
- * vouches for everything before, so it is quick however long the log. The
378
- * walk from the first entry, which checks again what the checkpoints vouch
379
- * for, is there to ask for, a stretch a request, with how far it has got.
380
- * The check on load is rendered with the page, never a loading state; a
381
- * check that could not run says so and offers to run again, rather than
382
- * passing for a broken log.
408
+ * The vault vouches for a head of the log in the page's own call, and the
409
+ * server proves each entry shown against it from the tiles. So the claim is
410
+ * about what is on screen, every time it is shown, however long the log.
411
+ * An entry past the head is not proven: signed since the vault's read, or
412
+ * put there by a writer, which the page cannot tell apart; checking again,
413
+ * against a newer head, settles the first.
383
414
  */
384
- function ChainStatus({ chain, walked, walkFailed, retrying, onRetry, onWalk }) {
385
- if (walked !== null) return /* @__PURE__ */ jsxs("span", {
386
- className: "chain-note",
387
- role: "status",
388
- children: [/* @__PURE__ */ jsx(Spinner, { size: 14 }), walked.through === null ? "Verifying from the first entry…" : `Verified through ${walked.through.toLocaleString("en")}…`]
415
+ function ProofStatus({ head, counts, pruned, checking, onCheck }) {
416
+ const plural = (n) => `${n.toLocaleString("en")} ${n === 1 ? "entry" : "entries"}`;
417
+ const again = /* @__PURE__ */ jsx("button", {
418
+ type: "button",
419
+ className: "btn btn-sm",
420
+ disabled: checking,
421
+ onClick: onCheck,
422
+ children: "Check again"
389
423
  });
390
- if (chain.integrity === "owners-only") return /* @__PURE__ */ jsx(Toggletip, {
391
- align: "end",
392
- label: "Only auditors, admins and owners of the whole instance can check the log: it takes every entry, and you see only your projects'.",
393
- children: /* @__PURE__ */ jsxs("button", {
394
- type: "button",
395
- className: "chain-note",
396
- children: [/* @__PURE__ */ jsx(Info, { size: 14 }), "Verified by owners"]
397
- })
424
+ if (counts.failed > 0) return /* @__PURE__ */ jsxs("div", {
425
+ className: "chain",
426
+ children: [/* @__PURE__ */ jsxs("span", {
427
+ className: "chain-flag chain-flag-bad",
428
+ children: [
429
+ /* @__PURE__ */ jsx(AlertTriangle, { size: 14 }),
430
+ plural(counts.failed),
431
+ " not as signed"
432
+ ]
433
+ }), (counts.unproven > 0 || pruned) && again]
398
434
  });
399
- if (chain.integrity === "unknown") return /* @__PURE__ */ jsxs("div", {
435
+ if (head === null) return /* @__PURE__ */ jsxs("div", {
400
436
  className: "chain",
401
437
  children: [/* @__PURE__ */ jsx(Toggletip, {
402
438
  align: "end",
403
- label: `coffre could not check the log: ${chain.problem}. The entries below are unverified.`,
439
+ label: "The vault vouched for no head of the log: it has signed none yet, or the one in the database is not one it signed. No entry below is proven.",
404
440
  children: /* @__PURE__ */ jsxs("button", {
405
441
  type: "button",
406
442
  className: "chain-flag chain-flag-warn",
407
- children: [/* @__PURE__ */ jsx(AlertTriangle, { size: 14 }), "Couldn’t verify"]
443
+ children: [/* @__PURE__ */ jsx(AlertTriangle, { size: 14 }), "Not proven"]
408
444
  })
409
- }), /* @__PURE__ */ jsx("button", {
410
- type: "button",
411
- className: "btn btn-sm",
412
- disabled: retrying,
413
- onClick: onRetry,
414
- children: "Retry"
415
- })]
445
+ }), again]
416
446
  });
417
- if (chain.integrity === "broken") return /* @__PURE__ */ jsxs("span", {
418
- className: "chain-flag chain-flag-bad",
419
- children: [/* @__PURE__ */ jsx(AlertTriangle, { size: 14 }), chain.failedAtSeq === null ? "Log does not verify" : `Log broken at ${chain.failedAtSeq}`]
420
- });
421
- const signed = chain.checkpoint === null ? null : `${absolute(chain.checkpoint.signedAt, false)} UTC`;
422
- const verified = chain.whole ? `Audit log verified from its first entry by the app and vault keys${signed === null ? ", not signed yet" : `, last signature at ${signed}`}.` : signed === null ? "Audit log verified by the app and vault keys, not signed yet." : `What was written since the last checkpoint verified by the app and vault keys; the checkpoint, signed at ${signed}, vouches for everything before it, as each was checked when it was written.`;
423
- const trees = chain.trees;
424
- const sealed = trees?.checkpoint == null ? null : `its checkpoint of ${absolute(new Date(trees.checkpoint.at).toISOString(), false)} UTC`;
425
- const sealedLog = trees === null ? "" : ` The sealed log: ${sealed === null ? "nothing sealed yet" : sealed}, and every entry since, verified.`;
426
- const unchecked = chain.treesFailed !== null;
447
+ const signed = `${absolute(head.signedAt, false)} UTC`;
427
448
  return /* @__PURE__ */ jsxs("div", {
428
449
  className: "chain",
429
450
  children: [
430
- chain.pending > 0 && /* @__PURE__ */ jsx(Toggletip, {
431
- align: "end",
432
- label: "Keys released through KMS whose outcome the vault has not logged yet. Each settles within seconds, or is logged as failed.",
433
- children: /* @__PURE__ */ jsxs("button", {
434
- type: "button",
435
- className: "chain-note",
436
- role: "status",
437
- children: [
438
- chain.pending,
439
- " key operation",
440
- chain.pending === 1 ? "" : "s",
441
- " in flight"
442
- ]
443
- })
444
- }),
445
- chain.remaining > 0 && /* @__PURE__ */ jsx(Toggletip, {
451
+ counts.unproven > 0 && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Toggletip, {
446
452
  align: "end",
447
- label: `Verified through entry ${chain.through?.toLocaleString("en") ?? "none"}. The checkpoints are catching up with the log, a stretch every five minutes, and a check goes no further than they have.`,
453
+ label: `Past the head the vault signed at ${signed}, of ${head.size.toLocaleString("en")} entries: signed since, or put there by something with direct access to the database. Checking again, against a newer head, settles the first.`,
448
454
  children: /* @__PURE__ */ jsxs("button", {
449
455
  type: "button",
450
456
  className: "chain-note",
451
- role: "status",
452
- children: [
453
- chain.remaining.toLocaleString("en"),
454
- " newer ",
455
- chain.remaining === 1 ? "entry" : "entries",
456
- " to verify"
457
- ]
458
- })
459
- }),
460
- walkFailed !== null && /* @__PURE__ */ jsx(Toggletip, {
461
- align: "end",
462
- label: `coffre could not walk the whole log: ${walkFailed}. The verdict beside it, from the newest checkpoint, stands.`,
463
- children: /* @__PURE__ */ jsxs("button", {
464
- type: "button",
465
- className: "chain-flag chain-flag-warn",
466
- children: [/* @__PURE__ */ jsx(AlertTriangle, { size: 14 }), "Whole log not checked"]
457
+ children: [plural(counts.unproven), " not proven"]
467
458
  })
468
- }),
469
- unchecked && /* @__PURE__ */ jsx(Toggletip, {
470
- align: "end",
471
- label: `${chain.treesFailed}. The rest of the log's verdict stands.`,
472
- children: /* @__PURE__ */ jsxs("button", {
473
- type: "button",
474
- className: "chain-flag chain-flag-warn",
475
- children: [/* @__PURE__ */ jsx(AlertTriangle, { size: 14 }), chain.treesBehind && chain.trees !== null ? `Sealed log not checked to the head (${chain.trees.pending.toLocaleString("en")}+ entries pending)` : "Sealed log not checked"]
476
- })
477
- }),
478
- !chain.whole && chain.remaining === 0 && /* @__PURE__ */ jsx("button", {
479
- type: "button",
480
- className: "btn btn-sm",
481
- onClick: onWalk,
482
- children: "Verify whole log"
483
- }),
484
- chain.remaining === 0 && !unchecked && /* @__PURE__ */ jsx(Toggletip, {
459
+ }), again] }),
460
+ pruned && counts.unproven === 0 && again,
461
+ counts.proven > 0 && /* @__PURE__ */ jsx(Toggletip, {
485
462
  align: "end",
486
- label: `${verified}${sealedLog}`,
463
+ label: `Each entry below the vault’s head, signed at ${signed}, is proven against it: what it records is what the vault signed, where it signed it.`,
487
464
  children: /* @__PURE__ */ jsxs("button", {
488
465
  type: "button",
489
466
  className: "chain-seal",
490
- children: [/* @__PURE__ */ jsx(ShieldCheck, { size: 14 }), "Verified"]
467
+ children: [/* @__PURE__ */ jsx(ShieldCheck, { size: 14 }), "Proven"]
491
468
  })
492
469
  })
493
470
  ]