@coffre/ui 0.14.7 → 0.16.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.
- package/dist/audit-sentences.d.ts +56 -0
- package/dist/audit-sentences.js +886 -0
- package/dist/audit-sentences.js.map +1 -0
- package/dist/chunks/audit-sentence-C8NnAdjF.js +48 -0
- package/dist/chunks/audit-sentence-C8NnAdjF.js.map +1 -0
- package/dist/chunks/{connected-apps-IJdunsu8.js → connected-apps-6sMSgQ9U.js} +5 -5
- package/dist/chunks/{connected-apps-IJdunsu8.js.map → connected-apps-6sMSgQ9U.js.map} +1 -1
- package/dist/chunks/{delete-place-dIVoK87I.js → delete-place-T469tSN9.js} +5 -5
- package/dist/chunks/{delete-place-dIVoK87I.js.map → delete-place-T469tSN9.js.map} +1 -1
- package/dist/chunks/{directory-BM8yoiJN.js → directory-B_gVf7UL.js} +13 -12
- package/dist/chunks/{directory-BM8yoiJN.js.map → directory-B_gVf7UL.js.map} +1 -1
- package/dist/chunks/{folders-D3A1NGpt.js → folders-CVYauIDz.js} +3 -3
- package/dist/chunks/{folders-D3A1NGpt.js.map → folders-CVYauIDz.js.map} +1 -1
- package/dist/chunks/{grants-CjVmOgb2.js → grants-Dn_EW2XW.js} +6 -6
- package/dist/chunks/{grants-CjVmOgb2.js.map → grants-Dn_EW2XW.js.map} +1 -1
- package/dist/chunks/{multi-combobox-B0JzP1QN.js → multi-combobox-fbBRzi9z.js} +3 -3
- package/dist/chunks/{multi-combobox-B0JzP1QN.js.map → multi-combobox-fbBRzi9z.js.map} +1 -1
- package/dist/chunks/{offboarding-DbozhPym.js → offboarding-CXM464J_.js} +19 -13
- package/dist/chunks/offboarding-CXM464J_.js.map +1 -0
- package/dist/chunks/{page-JTORvh-N.js → page-Cb0ZjGda.js} +2 -2
- package/dist/chunks/{page-JTORvh-N.js.map → page-Cb0ZjGda.js.map} +1 -1
- package/dist/chunks/{personal-tokens-zWZOzLIC.js → personal-tokens-CSHMlRHy.js} +7 -7
- package/dist/chunks/personal-tokens-CSHMlRHy.js.map +1 -0
- package/dist/chunks/{principal-DFBswTBr.js → principal-BKJxbAtE.js} +2 -2
- package/dist/chunks/{principal-DFBswTBr.js.map → principal-BKJxbAtE.js.map} +1 -1
- package/dist/chunks/{principal-page-jJ0RVFg8.js → principal-page-COPmTDVW.js} +20 -17
- package/dist/chunks/principal-page-COPmTDVW.js.map +1 -0
- package/dist/chunks/{project-page-BjwEoXfU.js → project-page-g5_n46Nz.js} +3 -3
- package/dist/chunks/{project-page-BjwEoXfU.js.map → project-page-g5_n46Nz.js.map} +1 -1
- package/dist/chunks/{protected-y7KVhtHd.js → protected-DEWeOrmI.js} +7 -7
- package/dist/chunks/{protected-y7KVhtHd.js.map → protected-DEWeOrmI.js.map} +1 -1
- package/dist/chunks/{queries-2jdgTwfZ.js → queries-D4_o-bz3.js} +11 -88
- package/dist/chunks/queries-D4_o-bz3.js.map +1 -0
- package/dist/chunks/{references-CRT2BsOS.js → references-wTh_DT0M.js} +27 -23
- package/dist/chunks/references-wTh_DT0M.js.map +1 -0
- package/dist/chunks/{role-field-DswIpPqY.js → role-field-BiP09qfN.js} +4 -4
- package/dist/chunks/{role-field-DswIpPqY.js.map → role-field-BiP09qfN.js.map} +1 -1
- package/dist/chunks/{row-state-xtRGFnDc.js → row-state-CYhtmUkc.js} +3 -3
- package/dist/chunks/{row-state-xtRGFnDc.js.map → row-state-CYhtmUkc.js.map} +1 -1
- package/dist/chunks/{signin-errors-TlQmQe0t.js → signin-errors-BMnox7XD.js} +5 -19
- package/dist/chunks/signin-errors-BMnox7XD.js.map +1 -0
- package/dist/chunks/{theme-Ck45wzWB.js → theme-imSolE1q.js} +3 -3
- package/dist/chunks/{theme-Ck45wzWB.js.map → theme-imSolE1q.js.map} +1 -1
- package/dist/chunks/{ui-D-blFWfx.js → ui-Q_Eczt7m.js} +7 -3
- package/dist/chunks/{ui-D-blFWfx.js.map → ui-Q_Eczt7m.js.map} +1 -1
- package/dist/chunks/{use-action-CXEFFjx5.js → use-action-BfnN-De2.js} +3 -3
- package/dist/chunks/{use-action-CXEFFjx5.js.map → use-action-BfnN-De2.js.map} +1 -1
- package/dist/chunks/{use-change-BC4xo02c.js → use-change-Cc0X4sF3.js} +6 -4
- package/dist/chunks/use-change-Cc0X4sF3.js.map +1 -0
- package/dist/chunks/{use-roles-DswiNxBk.js → use-roles-stcv2QFj.js} +3 -3
- package/dist/chunks/{use-roles-DswiNxBk.js.map → use-roles-stcv2QFj.js.map} +1 -1
- package/dist/chunks/{use-shell-zpjE_MKh.js → use-shell-DMhLa2sh.js} +3 -3
- package/dist/chunks/{use-shell-zpjE_MKh.js.map → use-shell-DMhLa2sh.js.map} +1 -1
- package/dist/index.d.ts +22 -10
- package/dist/index.js +7 -7
- package/dist/pages/account.js +11 -11
- package/dist/pages/approval.js +2 -2
- package/dist/pages/audit.js +163 -152
- package/dist/pages/audit.js.map +1 -1
- package/dist/pages/device-login.js +2 -2
- package/dist/pages/environment.js +67 -35
- package/dist/pages/environment.js.map +1 -1
- package/dist/pages/login.js +6 -15
- package/dist/pages/login.js.map +1 -1
- package/dist/pages/oauth-authorize.js +2 -2
- package/dist/pages/project-access.js +11 -11
- package/dist/pages/project-environments.js +12 -12
- package/dist/pages/project-settings.js +8 -8
- package/dist/pages/project.js +3 -3
- package/dist/pages/projects.js +8 -8
- package/dist/pages/service-account.js +19 -15
- package/dist/pages/service-account.js.map +1 -1
- package/dist/pages/service-accounts.js +5 -5
- package/dist/pages/settings.js +26 -37
- package/dist/pages/settings.js.map +1 -1
- package/dist/pages/unregistered.js +2 -2
- package/dist/pages/user.js +7 -7
- package/dist/pages/user.js.map +1 -1
- package/dist/pages/users.js +5 -5
- package/package.json +8 -3
- package/src/components/directory.tsx +5 -4
- package/src/components/offboarding.tsx +9 -9
- package/src/components/personal-tokens.tsx +5 -2
- package/src/components/principal-page.tsx +4 -3
- package/src/components/references.tsx +18 -7
- package/src/components/trusted-workloads.tsx +6 -5
- package/src/components/ui.tsx +5 -0
- package/src/lib/audit-proofs.ts +51 -0
- package/src/lib/audit-sentences.ts +473 -509
- package/src/lib/bindings.ts +6 -0
- package/src/lib/changes.ts +3 -1
- package/src/lib/coffre.ts +2 -2
- package/src/lib/queries.ts +9 -94
- package/src/lib/reveal.ts +32 -5
- package/src/lib/row-reads.ts +2 -2
- package/src/lib/signin-errors.ts +5 -33
- package/src/pages/audit.tsx +145 -182
- package/src/pages/environment.tsx +21 -20
- package/src/pages/login.tsx +2 -4
- package/src/pages/settings.tsx +6 -10
- package/src/pages/user.tsx +2 -2
- package/src/parity.ts +0 -2
- package/src/styles/globals.css +18 -2
- package/dist/chunks/audit-sentence-JgJEwQEC.js +0 -969
- package/dist/chunks/audit-sentence-JgJEwQEC.js.map +0 -1
- package/dist/chunks/offboarding-DbozhPym.js.map +0 -1
- package/dist/chunks/personal-tokens-zWZOzLIC.js.map +0 -1
- package/dist/chunks/principal-page-jJ0RVFg8.js.map +0 -1
- package/dist/chunks/queries-2jdgTwfZ.js.map +0 -1
- package/dist/chunks/references-CRT2BsOS.js.map +0 -1
- package/dist/chunks/signin-errors-TlQmQe0t.js.map +0 -1
- package/dist/chunks/use-change-BC4xo02c.js.map +0 -1
|
@@ -23,8 +23,6 @@ export function referenceProblem(state: ReferenceView['state']): string | null {
|
|
|
23
23
|
return null;
|
|
24
24
|
case 'broken':
|
|
25
25
|
return 'Broken';
|
|
26
|
-
case 'replaced':
|
|
27
|
-
return 'No value';
|
|
28
26
|
case 'source_archived':
|
|
29
27
|
return 'Source archived';
|
|
30
28
|
case 'source_deleted':
|
|
@@ -36,6 +34,17 @@ export function referenceProblem(state: ReferenceView['state']): string | null {
|
|
|
36
34
|
}
|
|
37
35
|
}
|
|
38
36
|
|
|
37
|
+
/** Who made a reference and how long ago, after `lead`: nothing where its row says no one. */
|
|
38
|
+
function MadeBy({ reference, lead }: { reference: { createdBy: string | null; createdAt: string | null }; lead: string }) {
|
|
39
|
+
if (reference.createdBy === null || reference.createdAt === null) return null;
|
|
40
|
+
return (
|
|
41
|
+
<>
|
|
42
|
+
{lead}
|
|
43
|
+
{reference.createdBy.replace(/^user:/, '')} <Timestamp iso={reference.createdAt} display="relative" />
|
|
44
|
+
</>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
39
48
|
/** A secret's path as a link to it, when you can open it there. */
|
|
40
49
|
function SecretPath({ path, open }: { path: string; open: boolean }) {
|
|
41
50
|
const [project, environment, key] = path.split('/') as [string, string, string];
|
|
@@ -84,8 +93,8 @@ export function LentReferences({ references, onBreak }: { references: ListedRefe
|
|
|
84
93
|
{references.map((reference) => (
|
|
85
94
|
<li key={reference.id}>
|
|
86
95
|
<span>
|
|
87
|
-
Read through <SecretPath path={reference.holder} open={false}
|
|
88
|
-
<
|
|
96
|
+
Read through <SecretPath path={reference.holder} open={false} />
|
|
97
|
+
<MadeBy reference={reference} lead=", made by " />
|
|
89
98
|
{reference.readers !== null && (
|
|
90
99
|
<span className="cell-muted">
|
|
91
100
|
{' '}
|
|
@@ -225,9 +234,11 @@ export function ReferencesInto({ project }: { project: string }) {
|
|
|
225
234
|
<td data-label="Read through">
|
|
226
235
|
<span className="cell-stack">
|
|
227
236
|
<span className="mono">{reference.holder}</span>
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
237
|
+
{reference.createdBy !== null && (
|
|
238
|
+
<small className="cell-muted">
|
|
239
|
+
<MadeBy reference={reference} lead="Made by " />
|
|
240
|
+
</small>
|
|
241
|
+
)}
|
|
231
242
|
</span>
|
|
232
243
|
</td>
|
|
233
244
|
<td data-label="Readers">
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
listedIds,
|
|
14
14
|
listingGap,
|
|
15
15
|
planned,
|
|
16
|
+
reached,
|
|
16
17
|
summary,
|
|
17
18
|
type Form,
|
|
18
19
|
type GitHubLookup,
|
|
@@ -86,7 +87,7 @@ export function TrustedWorkloads({ serviceId, bindings, grants }: { serviceId: s
|
|
|
86
87
|
</span>
|
|
87
88
|
</span>
|
|
88
89
|
</td>
|
|
89
|
-
<td>{
|
|
90
|
+
<td>{reached(binding.scope)}</td>
|
|
90
91
|
<td className="nowrap">
|
|
91
92
|
<span className="cell-stack">
|
|
92
93
|
<Timestamp iso={binding.createdAt} />
|
|
@@ -379,12 +380,12 @@ function Exposure({ events }: { events: string[] }) {
|
|
|
379
380
|
|
|
380
381
|
/** What the bindings a plan replaces reached, beside what the new one reaches: the same, unless the person chose again. */
|
|
381
382
|
function Reached({ plan, bindings }: { plan: BindingPlan; bindings: BindingView[] }) {
|
|
382
|
-
const
|
|
383
|
+
const before = [...new Set(plan.replaces.flatMap((replaced) => {
|
|
383
384
|
const scope = bindings.find((binding) => binding.id === replaced.id)?.scope;
|
|
384
|
-
return scope === undefined ? [] : [
|
|
385
|
+
return scope === undefined ? [] : [reached(scope)];
|
|
385
386
|
}))];
|
|
386
|
-
if (
|
|
387
|
-
return <> {plan.replaces.length === 1 ? 'It' : 'They'} reached {
|
|
387
|
+
if (before.every((words) => words === credentialScopeInWords(plan.scope))) return <> This one reaches what {plan.replaces.length === 1 ? 'it' : 'they'} did.</>;
|
|
388
|
+
return <> {plan.replaces.length === 1 ? 'It' : 'They'} reached {before.join('; ')}: this one reaches what it says above.</>;
|
|
388
389
|
}
|
|
389
390
|
|
|
390
391
|
function TrustWorkload({ serviceId, grants, bindings }: { serviceId: string; grants: HeldGrant[]; bindings: BindingView[] }) {
|
package/src/components/ui.tsx
CHANGED
|
@@ -462,6 +462,11 @@ function relative(iso: string, now: number, style: 'long' | 'narrow' = 'long'):
|
|
|
462
462
|
return RELATIVE[style].format(Math.round(delta / divisor), unit);
|
|
463
463
|
}
|
|
464
464
|
|
|
465
|
+
/** "200 of 1,240" in a list's title, when it stops short of all of them; nothing otherwise. */
|
|
466
|
+
export function ofAll(listed: number, total: number | null): string {
|
|
467
|
+
return total === null || total <= listed ? '' : ` (${listed.toLocaleString('en-US')} of ${total.toLocaleString('en-US')})`;
|
|
468
|
+
}
|
|
469
|
+
|
|
465
470
|
/** A UTC time as the log writes it: `2026-10-17 08:45:13`, to the millisecond when `precise`. */
|
|
466
471
|
export function absolute(iso: string, precise: boolean): string {
|
|
467
472
|
return iso.replace('T', ' ').replace('Z', '').slice(0, precise ? 23 : 19);
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { AuditEntryView, RouteOutput } from '@coffre/client';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* What the audit page says of each entry it shows (docs/design/0.16.md,
|
|
5
|
+
* "Pages"): `GET /audit` proves it against the head the vault signed, in
|
|
6
|
+
* the same answer, and the page shows that, one state a row:
|
|
7
|
+
*
|
|
8
|
+
* proven the vault signed it as it is, where it is
|
|
9
|
+
* unproven past the head: signed since the vault read it, or put
|
|
10
|
+
* there by a writer; the page cannot tell which, and a
|
|
11
|
+
* check against a newer head settles the first
|
|
12
|
+
* failed within the head and not what it signed
|
|
13
|
+
*/
|
|
14
|
+
export type Proof = AuditEntryView['proof'];
|
|
15
|
+
export type Head = RouteOutput<'GET /audit'>['head'];
|
|
16
|
+
|
|
17
|
+
/** A batch's, or a read's: its worst entry's. */
|
|
18
|
+
export function proofOf(proofs: readonly Proof[]): Proof {
|
|
19
|
+
return proofs.includes('failed') ? 'failed' : proofs.includes('unproven') ? 'unproven' : 'proven';
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The entries the page has seen proven, by the head that proved them: a
|
|
24
|
+
* head is its size and signing time, which its MAC covers.
|
|
25
|
+
*/
|
|
26
|
+
export type Proved = Map<string, Set<number>>;
|
|
27
|
+
|
|
28
|
+
const headKey = (head: NonNullable<Head>) => `${head.size}@${head.signedAt}`;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Each entry's proof as the page shows it: the answer's, except that one
|
|
32
|
+
* proven before under this same head and now not is failed. Under one head
|
|
33
|
+
* an entry proves or does not for good: only its tree and leaf, columns a
|
|
34
|
+
* writer edits, can move it past the head, so the page never shows an entry
|
|
35
|
+
* proven and later not proven against the same head. Another head is
|
|
36
|
+
* another answer: one put back from before covers less, and the page shows
|
|
37
|
+
* what it covers.
|
|
38
|
+
*/
|
|
39
|
+
export function shownProofs(proved: Proved, head: Head, entries: readonly AuditEntryView[]): Map<number, Proof> {
|
|
40
|
+
const seen = head === null ? undefined : proved.get(headKey(head));
|
|
41
|
+
return new Map(entries.map((entry) => [entry.seq, entry.proof === 'unproven' && seen?.has(entry.seq) ? 'failed' : entry.proof]));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Notes what an answer proved, under its head. */
|
|
45
|
+
export function remember(proved: Proved, head: Head, entries: readonly AuditEntryView[]): void {
|
|
46
|
+
if (head === null) return;
|
|
47
|
+
const key = headKey(head);
|
|
48
|
+
const seen = proved.get(key) ?? new Set<number>();
|
|
49
|
+
for (const entry of entries) if (entry.proof === 'proven') seen.add(entry.seq);
|
|
50
|
+
proved.set(key, seen);
|
|
51
|
+
}
|