@ai-matrx/vault 0.1.30 → 0.1.32
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/CHANGELOG.md +9 -0
- package/dist/bitwarden-json-worker-client-5XC3VGLL.js +14 -0
- package/dist/bitwarden-json-worker-client-5XC3VGLL.js.map +1 -0
- package/dist/chunk-IJVSAR5M.js +469 -0
- package/dist/chunk-IJVSAR5M.js.map +1 -0
- package/dist/csv-import-worker-client-UPGOR4TX.js +10 -0
- package/dist/csv-import-worker-client-UPGOR4TX.js.map +1 -0
- package/dist/identity.cjs +338 -0
- package/dist/identity.cjs.map +1 -0
- package/dist/identity.d.cts +152 -0
- package/dist/identity.d.ts +152 -0
- package/dist/identity.js +18 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.cts +3 -150
- package/dist/index.d.ts +3 -150
- package/dist/index.js +1555 -2005
- package/dist/index.js.map +1 -1
- package/dist/keepass-xml-worker-client-NKUQ7IDA.js +14 -0
- package/dist/keepass-xml-worker-client-NKUQ7IDA.js.map +1 -0
- package/dist/onepux-worker-client-3GDLM4BG.js +14 -0
- package/dist/onepux-worker-client-3GDLM4BG.js.map +1 -0
- package/dist/proton-pass-worker-client-6E77NB63.js +14 -0
- package/dist/proton-pass-worker-client-6E77NB63.js.map +1 -0
- package/package.json +16 -6
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* CONFIRM IT'S YOU. The server shows or exports a secret only after a sign-in from the last few
|
|
6
|
+
* minutes (`recent_auth_required`). Every host signs people in with Supabase, so the one way to
|
|
7
|
+
* produce a fresh sign-in lives here, over the host's own auth client — whichever way the person
|
|
8
|
+
* signs in: Google (or any connected provider), a password, or a code sent to their email.
|
|
9
|
+
*/
|
|
10
|
+
/** How a person can prove it is them again. Ordered by what the account actually uses. */
|
|
11
|
+
type IdentityMethod = "provider" | "password" | "email_code" | "dev";
|
|
12
|
+
interface IdentityAccount {
|
|
13
|
+
email: string | null;
|
|
14
|
+
/** Connected sign-in providers on the account (`google`, `github`, …), never `email`. */
|
|
15
|
+
providers: readonly string[];
|
|
16
|
+
hasPassword: boolean;
|
|
17
|
+
}
|
|
18
|
+
interface VaultIdentity {
|
|
19
|
+
account(): Promise<IdentityAccount>;
|
|
20
|
+
/**
|
|
21
|
+
* Confirms with that provider. On the web it leaves the page and comes back to the same address
|
|
22
|
+
* (resolves with nothing: the page is going away). A host that confirms IN PLACE (the desktop's
|
|
23
|
+
* Touch ID, a browser sign-in it waits for) resolves `"confirmed"`, and the gate closes and runs
|
|
24
|
+
* the refused call again — one confirmation, never a second click.
|
|
25
|
+
*/
|
|
26
|
+
withProvider(provider: string): Promise<void | "confirmed">;
|
|
27
|
+
withPassword(password: string): Promise<void>;
|
|
28
|
+
sendEmailCode(): Promise<void>;
|
|
29
|
+
withEmailCode(code: string): Promise<void>;
|
|
30
|
+
/** A host-only path with no human step (the playground's dev server). */
|
|
31
|
+
dev?: () => Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Run once when the page loads. After a provider confirmation left the page and came back, it
|
|
34
|
+
* checks the SAME person is signed in. A different account is signed out of this device and the
|
|
35
|
+
* sentence to show is returned; otherwise null.
|
|
36
|
+
*/
|
|
37
|
+
checkReturn?: () => Promise<string | null>;
|
|
38
|
+
}
|
|
39
|
+
/** The slice of supabase-js `auth` this needs, so the package never depends on supabase-js itself. */
|
|
40
|
+
interface SupabaseAuthLike {
|
|
41
|
+
getUser(): Promise<{
|
|
42
|
+
data: {
|
|
43
|
+
user: {
|
|
44
|
+
id: string;
|
|
45
|
+
email?: string | null;
|
|
46
|
+
identities?: {
|
|
47
|
+
provider: string;
|
|
48
|
+
}[] | null;
|
|
49
|
+
app_metadata?: {
|
|
50
|
+
providers?: string[];
|
|
51
|
+
};
|
|
52
|
+
} | null;
|
|
53
|
+
};
|
|
54
|
+
error: unknown;
|
|
55
|
+
}>;
|
|
56
|
+
signInWithPassword(c: {
|
|
57
|
+
email: string;
|
|
58
|
+
password: string;
|
|
59
|
+
}): Promise<{
|
|
60
|
+
data: {
|
|
61
|
+
user: {
|
|
62
|
+
id: string;
|
|
63
|
+
} | null;
|
|
64
|
+
};
|
|
65
|
+
error: {
|
|
66
|
+
message: string;
|
|
67
|
+
} | null;
|
|
68
|
+
}>;
|
|
69
|
+
signInWithOtp(c: {
|
|
70
|
+
email: string;
|
|
71
|
+
options?: {
|
|
72
|
+
shouldCreateUser?: boolean;
|
|
73
|
+
};
|
|
74
|
+
}): Promise<{
|
|
75
|
+
error: {
|
|
76
|
+
message: string;
|
|
77
|
+
} | null;
|
|
78
|
+
}>;
|
|
79
|
+
verifyOtp(c: {
|
|
80
|
+
email: string;
|
|
81
|
+
token: string;
|
|
82
|
+
type: "email";
|
|
83
|
+
}): Promise<{
|
|
84
|
+
data: {
|
|
85
|
+
user: {
|
|
86
|
+
id: string;
|
|
87
|
+
} | null;
|
|
88
|
+
};
|
|
89
|
+
error: {
|
|
90
|
+
message: string;
|
|
91
|
+
} | null;
|
|
92
|
+
}>;
|
|
93
|
+
signInWithOAuth(c: {
|
|
94
|
+
provider: never;
|
|
95
|
+
options?: {
|
|
96
|
+
redirectTo?: string;
|
|
97
|
+
};
|
|
98
|
+
}): Promise<{
|
|
99
|
+
error: {
|
|
100
|
+
message: string;
|
|
101
|
+
} | null;
|
|
102
|
+
}>;
|
|
103
|
+
/** Used only when the host gives no `onDifferentPerson`: ends THIS device's session, never others. */
|
|
104
|
+
signOut?(o: {
|
|
105
|
+
scope: "local";
|
|
106
|
+
}): Promise<{
|
|
107
|
+
error: unknown;
|
|
108
|
+
}>;
|
|
109
|
+
}
|
|
110
|
+
/** Where the person confirming is remembered while the page is away at the provider. */
|
|
111
|
+
interface ReturnStore {
|
|
112
|
+
getItem(key: string): string | null;
|
|
113
|
+
setItem(key: string, value: string): void;
|
|
114
|
+
removeItem(key: string): void;
|
|
115
|
+
}
|
|
116
|
+
interface SupabaseIdentityOptions {
|
|
117
|
+
/** The host's accepted OAuth return address carrying this page. */
|
|
118
|
+
redirectTo?: () => string;
|
|
119
|
+
dev?: () => Promise<void>;
|
|
120
|
+
/**
|
|
121
|
+
* A provider confirmation came back signed in as someone else. The host ends that session on THIS
|
|
122
|
+
* device only (its own device-scoped sign-out) and tells the person; `message` says what happened.
|
|
123
|
+
* Without it the package signs out locally through `auth.signOut({ scope: "local" })`.
|
|
124
|
+
*/
|
|
125
|
+
onDifferentPerson?: (message: string) => Promise<void> | void;
|
|
126
|
+
/** Default: the tab's `sessionStorage`. */
|
|
127
|
+
store?: ReturnStore;
|
|
128
|
+
/** Default `Date.now`. */
|
|
129
|
+
now?: () => number;
|
|
130
|
+
}
|
|
131
|
+
/** The key the expected person is kept under across the provider's redirect. */
|
|
132
|
+
declare const CONFIRM_RETURN_KEY = "matrx-vault:confirming-as";
|
|
133
|
+
/** THE identity confirmation for every host: give it the host's `supabase.auth`. */
|
|
134
|
+
declare function createSupabaseIdentity(auth: SupabaseAuthLike, options?: SupabaseIdentityOptions): VaultIdentity;
|
|
135
|
+
/** True when the server refused because the sign-in is not recent enough. */
|
|
136
|
+
declare function needsRecentSignIn(e: unknown): boolean;
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Wrap any call that shows, copies or exports a secret. When the server answers "sign in again",
|
|
140
|
+
* the person confirms it is them (Google, password, or an emailed code) and the call runs again —
|
|
141
|
+
* they never see a dead "Authentication required" in the row.
|
|
142
|
+
*/
|
|
143
|
+
type Confirmed = <T>(run: () => Promise<T>) => Promise<T>;
|
|
144
|
+
declare function useConfirmed(): Confirmed;
|
|
145
|
+
declare function IdentityGate({ identity, children }: {
|
|
146
|
+
identity: VaultIdentity | undefined;
|
|
147
|
+
children: ReactNode;
|
|
148
|
+
}): react.JSX.Element;
|
|
149
|
+
/** True for the rejection a canceled confirmation produces (callers stay quiet about it). */
|
|
150
|
+
declare const wasCancelled: (e: unknown) => boolean;
|
|
151
|
+
|
|
152
|
+
export { CONFIRM_RETURN_KEY, type Confirmed, type IdentityAccount, IdentityGate, type IdentityMethod, type ReturnStore, type SupabaseAuthLike, type SupabaseIdentityOptions, type VaultIdentity, createSupabaseIdentity, needsRecentSignIn, useConfirmed, wasCancelled };
|
package/dist/identity.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
CONFIRM_RETURN_KEY,
|
|
4
|
+
IdentityGate,
|
|
5
|
+
createSupabaseIdentity,
|
|
6
|
+
needsRecentSignIn,
|
|
7
|
+
useConfirmed,
|
|
8
|
+
wasCancelled
|
|
9
|
+
} from "./chunk-IJVSAR5M.js";
|
|
10
|
+
export {
|
|
11
|
+
CONFIRM_RETURN_KEY,
|
|
12
|
+
IdentityGate,
|
|
13
|
+
createSupabaseIdentity,
|
|
14
|
+
needsRecentSignIn,
|
|
15
|
+
useConfirmed,
|
|
16
|
+
wasCancelled
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=identity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
3
2
|
import { Look } from '@ai-matrx/design-system';
|
|
3
|
+
import { VaultIdentity } from './identity.cjs';
|
|
4
|
+
export { CONFIRM_RETURN_KEY, Confirmed, IdentityAccount, IdentityGate, IdentityMethod, ReturnStore, SupabaseAuthLike, SupabaseIdentityOptions, createSupabaseIdentity, needsRecentSignIn, useConfirmed, wasCancelled } from './identity.cjs';
|
|
4
5
|
import { KnobClient } from '@ai-matrx/data/knobs';
|
|
5
6
|
import * as account from '@ai-matrx/api/account';
|
|
6
7
|
import { Api } from '@ai-matrx/api';
|
|
@@ -277,140 +278,6 @@ interface ActivityPort {
|
|
|
277
278
|
downloadFile(item: VaultItem, attachment: VaultAttachment): Promise<Uint8Array>;
|
|
278
279
|
}
|
|
279
280
|
|
|
280
|
-
/**
|
|
281
|
-
* CONFIRM IT'S YOU. The server shows or exports a secret only after a sign-in from the last few
|
|
282
|
-
* minutes (`recent_auth_required`). Every host signs people in with Supabase, so the one way to
|
|
283
|
-
* produce a fresh sign-in lives here, over the host's own auth client — whichever way the person
|
|
284
|
-
* signs in: Google (or any connected provider), a password, or a code sent to their email.
|
|
285
|
-
*/
|
|
286
|
-
/** How a person can prove it is them again. Ordered by what the account actually uses. */
|
|
287
|
-
type IdentityMethod = "provider" | "password" | "email_code" | "dev";
|
|
288
|
-
interface IdentityAccount {
|
|
289
|
-
email: string | null;
|
|
290
|
-
/** Connected sign-in providers on the account (`google`, `github`, …), never `email`. */
|
|
291
|
-
providers: readonly string[];
|
|
292
|
-
hasPassword: boolean;
|
|
293
|
-
}
|
|
294
|
-
interface VaultIdentity {
|
|
295
|
-
account(): Promise<IdentityAccount>;
|
|
296
|
-
/**
|
|
297
|
-
* Confirms with that provider. On the web it leaves the page and comes back to the same address
|
|
298
|
-
* (resolves with nothing: the page is going away). A host that confirms IN PLACE (the desktop's
|
|
299
|
-
* Touch ID, a browser sign-in it waits for) resolves `"confirmed"`, and the gate closes and runs
|
|
300
|
-
* the refused call again — one confirmation, never a second click.
|
|
301
|
-
*/
|
|
302
|
-
withProvider(provider: string): Promise<void | "confirmed">;
|
|
303
|
-
withPassword(password: string): Promise<void>;
|
|
304
|
-
sendEmailCode(): Promise<void>;
|
|
305
|
-
withEmailCode(code: string): Promise<void>;
|
|
306
|
-
/** A host-only path with no human step (the playground's dev server). */
|
|
307
|
-
dev?: () => Promise<void>;
|
|
308
|
-
/**
|
|
309
|
-
* Run once when the page loads. After a provider confirmation left the page and came back, it
|
|
310
|
-
* checks the SAME person is signed in. A different account is signed out of this device and the
|
|
311
|
-
* sentence to show is returned; otherwise null.
|
|
312
|
-
*/
|
|
313
|
-
checkReturn?: () => Promise<string | null>;
|
|
314
|
-
}
|
|
315
|
-
/** The slice of supabase-js `auth` this needs, so the package never depends on supabase-js itself. */
|
|
316
|
-
interface SupabaseAuthLike {
|
|
317
|
-
getUser(): Promise<{
|
|
318
|
-
data: {
|
|
319
|
-
user: {
|
|
320
|
-
id: string;
|
|
321
|
-
email?: string | null;
|
|
322
|
-
identities?: {
|
|
323
|
-
provider: string;
|
|
324
|
-
}[] | null;
|
|
325
|
-
app_metadata?: {
|
|
326
|
-
providers?: string[];
|
|
327
|
-
};
|
|
328
|
-
} | null;
|
|
329
|
-
};
|
|
330
|
-
error: unknown;
|
|
331
|
-
}>;
|
|
332
|
-
signInWithPassword(c: {
|
|
333
|
-
email: string;
|
|
334
|
-
password: string;
|
|
335
|
-
}): Promise<{
|
|
336
|
-
data: {
|
|
337
|
-
user: {
|
|
338
|
-
id: string;
|
|
339
|
-
} | null;
|
|
340
|
-
};
|
|
341
|
-
error: {
|
|
342
|
-
message: string;
|
|
343
|
-
} | null;
|
|
344
|
-
}>;
|
|
345
|
-
signInWithOtp(c: {
|
|
346
|
-
email: string;
|
|
347
|
-
options?: {
|
|
348
|
-
shouldCreateUser?: boolean;
|
|
349
|
-
};
|
|
350
|
-
}): Promise<{
|
|
351
|
-
error: {
|
|
352
|
-
message: string;
|
|
353
|
-
} | null;
|
|
354
|
-
}>;
|
|
355
|
-
verifyOtp(c: {
|
|
356
|
-
email: string;
|
|
357
|
-
token: string;
|
|
358
|
-
type: "email";
|
|
359
|
-
}): Promise<{
|
|
360
|
-
data: {
|
|
361
|
-
user: {
|
|
362
|
-
id: string;
|
|
363
|
-
} | null;
|
|
364
|
-
};
|
|
365
|
-
error: {
|
|
366
|
-
message: string;
|
|
367
|
-
} | null;
|
|
368
|
-
}>;
|
|
369
|
-
signInWithOAuth(c: {
|
|
370
|
-
provider: never;
|
|
371
|
-
options?: {
|
|
372
|
-
redirectTo?: string;
|
|
373
|
-
};
|
|
374
|
-
}): Promise<{
|
|
375
|
-
error: {
|
|
376
|
-
message: string;
|
|
377
|
-
} | null;
|
|
378
|
-
}>;
|
|
379
|
-
/** Used only when the host gives no `onDifferentPerson`: ends THIS device's session, never others. */
|
|
380
|
-
signOut?(o: {
|
|
381
|
-
scope: "local";
|
|
382
|
-
}): Promise<{
|
|
383
|
-
error: unknown;
|
|
384
|
-
}>;
|
|
385
|
-
}
|
|
386
|
-
/** Where the person confirming is remembered while the page is away at the provider. */
|
|
387
|
-
interface ReturnStore {
|
|
388
|
-
getItem(key: string): string | null;
|
|
389
|
-
setItem(key: string, value: string): void;
|
|
390
|
-
removeItem(key: string): void;
|
|
391
|
-
}
|
|
392
|
-
interface SupabaseIdentityOptions {
|
|
393
|
-
/** The host's accepted OAuth return address carrying this page. */
|
|
394
|
-
redirectTo?: () => string;
|
|
395
|
-
dev?: () => Promise<void>;
|
|
396
|
-
/**
|
|
397
|
-
* A provider confirmation came back signed in as someone else. The host ends that session on THIS
|
|
398
|
-
* device only (its own device-scoped sign-out) and tells the person; `message` says what happened.
|
|
399
|
-
* Without it the package signs out locally through `auth.signOut({ scope: "local" })`.
|
|
400
|
-
*/
|
|
401
|
-
onDifferentPerson?: (message: string) => Promise<void> | void;
|
|
402
|
-
/** Default: the tab's `sessionStorage`. */
|
|
403
|
-
store?: ReturnStore;
|
|
404
|
-
/** Default `Date.now`. */
|
|
405
|
-
now?: () => number;
|
|
406
|
-
}
|
|
407
|
-
/** The key the expected person is kept under across the provider's redirect. */
|
|
408
|
-
declare const CONFIRM_RETURN_KEY = "matrx-vault:confirming-as";
|
|
409
|
-
/** THE identity confirmation for every host: give it the host's `supabase.auth`. */
|
|
410
|
-
declare function createSupabaseIdentity(auth: SupabaseAuthLike, options?: SupabaseIdentityOptions): VaultIdentity;
|
|
411
|
-
/** True when the server refused because the sign-in is not recent enough. */
|
|
412
|
-
declare function needsRecentSignIn(e: unknown): boolean;
|
|
413
|
-
|
|
414
281
|
/** One account's one-time password as the server reports it. Metadata only: never a seed. */
|
|
415
282
|
interface AuthenticatorEntry {
|
|
416
283
|
itemId: string;
|
|
@@ -1450,20 +1317,6 @@ interface ApiVaultPortOptions {
|
|
|
1450
1317
|
}
|
|
1451
1318
|
declare function createApiVaultPort(hostApi: Api, options?: ApiVaultPortOptions): VaultPort;
|
|
1452
1319
|
|
|
1453
|
-
/**
|
|
1454
|
-
* Wrap any call that shows, copies or exports a secret. When the server answers "sign in again",
|
|
1455
|
-
* the person confirms it is them (Google, password, or an emailed code) and the call runs again —
|
|
1456
|
-
* they never see a dead "Authentication required" in the row.
|
|
1457
|
-
*/
|
|
1458
|
-
type Confirmed = <T>(run: () => Promise<T>) => Promise<T>;
|
|
1459
|
-
declare function useConfirmed(): Confirmed;
|
|
1460
|
-
declare function IdentityGate({ identity, children }: {
|
|
1461
|
-
identity: VaultIdentity | undefined;
|
|
1462
|
-
children: ReactNode;
|
|
1463
|
-
}): react.JSX.Element;
|
|
1464
|
-
/** True for the rejection a canceled confirmation produces (callers stay quiet about it). */
|
|
1465
|
-
declare const wasCancelled: (e: unknown) => boolean;
|
|
1466
|
-
|
|
1467
1320
|
/** Reads the organization's ceilings. Raw knob values are fine: they are validated here. */
|
|
1468
1321
|
type GeneratorLimitsSource = () => Promise<{
|
|
1469
1322
|
maxPasswordLength?: unknown;
|
|
@@ -1556,4 +1409,4 @@ declare function holdingsDoorIsAbsent(code: string | undefined | null): boolean;
|
|
|
1556
1409
|
*/
|
|
1557
1410
|
declare function emptyReadAlarm(total: number, emptyIds: readonly string[], holdings: Holdings): string | null;
|
|
1558
1411
|
|
|
1559
|
-
export { type ApiVaultPortOptions, BACKUP_PASSPHRASE_MIN_KNOB, CATEGORIES,
|
|
1412
|
+
export { type ApiVaultPortOptions, BACKUP_PASSPHRASE_MIN_KNOB, CATEGORIES, type CategoryId, type CopyOptions, DEFAULT_LOCATION, type DefinitionField, type FieldHandling, type FieldKind, GenerateButton, HIDDEN_ITEM_TAG, HOLDINGS_DOOR_MIGRATION, type HoldingRow, type Holdings, type ItemDraft, LOCKED_MESSAGE, type NoticeKind, type Notify, REVEAL_SECONDS_KNOB, type RowItemAction, type RowMenuEntry, type RowMenuEntryKind, type SaveResult, type TotpReading, type UriMatchMode, type UrlGuess, type VaultAgentScope, VaultApp, type VaultAppProps, type VaultAttachment, type VaultAuthenticator, type VaultClipboard, type VaultCopied, type VaultCustomField, type VaultDefinition, type VaultField, type VaultHostCapabilities, VaultIdentity, type VaultInventory, type VaultItem, type VaultItemCapabilities, type VaultKnobs, type VaultLayout, type VaultLocation, type VaultLock, VaultLockedError, type VaultOrganizationRef, type VaultOwner, type VaultPort, type VaultSelection, type VaultSnapshot, type VaultSort, type VaultUserStateDoor, categoryOf, copiedLine, copyValue, createApiVaultPort, createVaultKnobs, emptyReadAlarm, guardPort, holdingsDoorIsAbsent, inferFromUrl, isHiddenItem, itemIdAt, locationFromParams, locationToParams, loginSiteOf, matchesQuery, parseDefinitions, positiveKnob, providerOf, rowMenuEntriesAt, siteDomainOf, sortItems, useDisposable, vaultInventoryScope, vaultItemFacts };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
3
2
|
import { Look } from '@ai-matrx/design-system';
|
|
3
|
+
import { VaultIdentity } from './identity.js';
|
|
4
|
+
export { CONFIRM_RETURN_KEY, Confirmed, IdentityAccount, IdentityGate, IdentityMethod, ReturnStore, SupabaseAuthLike, SupabaseIdentityOptions, createSupabaseIdentity, needsRecentSignIn, useConfirmed, wasCancelled } from './identity.js';
|
|
4
5
|
import { KnobClient } from '@ai-matrx/data/knobs';
|
|
5
6
|
import * as account from '@ai-matrx/api/account';
|
|
6
7
|
import { Api } from '@ai-matrx/api';
|
|
@@ -277,140 +278,6 @@ interface ActivityPort {
|
|
|
277
278
|
downloadFile(item: VaultItem, attachment: VaultAttachment): Promise<Uint8Array>;
|
|
278
279
|
}
|
|
279
280
|
|
|
280
|
-
/**
|
|
281
|
-
* CONFIRM IT'S YOU. The server shows or exports a secret only after a sign-in from the last few
|
|
282
|
-
* minutes (`recent_auth_required`). Every host signs people in with Supabase, so the one way to
|
|
283
|
-
* produce a fresh sign-in lives here, over the host's own auth client — whichever way the person
|
|
284
|
-
* signs in: Google (or any connected provider), a password, or a code sent to their email.
|
|
285
|
-
*/
|
|
286
|
-
/** How a person can prove it is them again. Ordered by what the account actually uses. */
|
|
287
|
-
type IdentityMethod = "provider" | "password" | "email_code" | "dev";
|
|
288
|
-
interface IdentityAccount {
|
|
289
|
-
email: string | null;
|
|
290
|
-
/** Connected sign-in providers on the account (`google`, `github`, …), never `email`. */
|
|
291
|
-
providers: readonly string[];
|
|
292
|
-
hasPassword: boolean;
|
|
293
|
-
}
|
|
294
|
-
interface VaultIdentity {
|
|
295
|
-
account(): Promise<IdentityAccount>;
|
|
296
|
-
/**
|
|
297
|
-
* Confirms with that provider. On the web it leaves the page and comes back to the same address
|
|
298
|
-
* (resolves with nothing: the page is going away). A host that confirms IN PLACE (the desktop's
|
|
299
|
-
* Touch ID, a browser sign-in it waits for) resolves `"confirmed"`, and the gate closes and runs
|
|
300
|
-
* the refused call again — one confirmation, never a second click.
|
|
301
|
-
*/
|
|
302
|
-
withProvider(provider: string): Promise<void | "confirmed">;
|
|
303
|
-
withPassword(password: string): Promise<void>;
|
|
304
|
-
sendEmailCode(): Promise<void>;
|
|
305
|
-
withEmailCode(code: string): Promise<void>;
|
|
306
|
-
/** A host-only path with no human step (the playground's dev server). */
|
|
307
|
-
dev?: () => Promise<void>;
|
|
308
|
-
/**
|
|
309
|
-
* Run once when the page loads. After a provider confirmation left the page and came back, it
|
|
310
|
-
* checks the SAME person is signed in. A different account is signed out of this device and the
|
|
311
|
-
* sentence to show is returned; otherwise null.
|
|
312
|
-
*/
|
|
313
|
-
checkReturn?: () => Promise<string | null>;
|
|
314
|
-
}
|
|
315
|
-
/** The slice of supabase-js `auth` this needs, so the package never depends on supabase-js itself. */
|
|
316
|
-
interface SupabaseAuthLike {
|
|
317
|
-
getUser(): Promise<{
|
|
318
|
-
data: {
|
|
319
|
-
user: {
|
|
320
|
-
id: string;
|
|
321
|
-
email?: string | null;
|
|
322
|
-
identities?: {
|
|
323
|
-
provider: string;
|
|
324
|
-
}[] | null;
|
|
325
|
-
app_metadata?: {
|
|
326
|
-
providers?: string[];
|
|
327
|
-
};
|
|
328
|
-
} | null;
|
|
329
|
-
};
|
|
330
|
-
error: unknown;
|
|
331
|
-
}>;
|
|
332
|
-
signInWithPassword(c: {
|
|
333
|
-
email: string;
|
|
334
|
-
password: string;
|
|
335
|
-
}): Promise<{
|
|
336
|
-
data: {
|
|
337
|
-
user: {
|
|
338
|
-
id: string;
|
|
339
|
-
} | null;
|
|
340
|
-
};
|
|
341
|
-
error: {
|
|
342
|
-
message: string;
|
|
343
|
-
} | null;
|
|
344
|
-
}>;
|
|
345
|
-
signInWithOtp(c: {
|
|
346
|
-
email: string;
|
|
347
|
-
options?: {
|
|
348
|
-
shouldCreateUser?: boolean;
|
|
349
|
-
};
|
|
350
|
-
}): Promise<{
|
|
351
|
-
error: {
|
|
352
|
-
message: string;
|
|
353
|
-
} | null;
|
|
354
|
-
}>;
|
|
355
|
-
verifyOtp(c: {
|
|
356
|
-
email: string;
|
|
357
|
-
token: string;
|
|
358
|
-
type: "email";
|
|
359
|
-
}): Promise<{
|
|
360
|
-
data: {
|
|
361
|
-
user: {
|
|
362
|
-
id: string;
|
|
363
|
-
} | null;
|
|
364
|
-
};
|
|
365
|
-
error: {
|
|
366
|
-
message: string;
|
|
367
|
-
} | null;
|
|
368
|
-
}>;
|
|
369
|
-
signInWithOAuth(c: {
|
|
370
|
-
provider: never;
|
|
371
|
-
options?: {
|
|
372
|
-
redirectTo?: string;
|
|
373
|
-
};
|
|
374
|
-
}): Promise<{
|
|
375
|
-
error: {
|
|
376
|
-
message: string;
|
|
377
|
-
} | null;
|
|
378
|
-
}>;
|
|
379
|
-
/** Used only when the host gives no `onDifferentPerson`: ends THIS device's session, never others. */
|
|
380
|
-
signOut?(o: {
|
|
381
|
-
scope: "local";
|
|
382
|
-
}): Promise<{
|
|
383
|
-
error: unknown;
|
|
384
|
-
}>;
|
|
385
|
-
}
|
|
386
|
-
/** Where the person confirming is remembered while the page is away at the provider. */
|
|
387
|
-
interface ReturnStore {
|
|
388
|
-
getItem(key: string): string | null;
|
|
389
|
-
setItem(key: string, value: string): void;
|
|
390
|
-
removeItem(key: string): void;
|
|
391
|
-
}
|
|
392
|
-
interface SupabaseIdentityOptions {
|
|
393
|
-
/** The host's accepted OAuth return address carrying this page. */
|
|
394
|
-
redirectTo?: () => string;
|
|
395
|
-
dev?: () => Promise<void>;
|
|
396
|
-
/**
|
|
397
|
-
* A provider confirmation came back signed in as someone else. The host ends that session on THIS
|
|
398
|
-
* device only (its own device-scoped sign-out) and tells the person; `message` says what happened.
|
|
399
|
-
* Without it the package signs out locally through `auth.signOut({ scope: "local" })`.
|
|
400
|
-
*/
|
|
401
|
-
onDifferentPerson?: (message: string) => Promise<void> | void;
|
|
402
|
-
/** Default: the tab's `sessionStorage`. */
|
|
403
|
-
store?: ReturnStore;
|
|
404
|
-
/** Default `Date.now`. */
|
|
405
|
-
now?: () => number;
|
|
406
|
-
}
|
|
407
|
-
/** The key the expected person is kept under across the provider's redirect. */
|
|
408
|
-
declare const CONFIRM_RETURN_KEY = "matrx-vault:confirming-as";
|
|
409
|
-
/** THE identity confirmation for every host: give it the host's `supabase.auth`. */
|
|
410
|
-
declare function createSupabaseIdentity(auth: SupabaseAuthLike, options?: SupabaseIdentityOptions): VaultIdentity;
|
|
411
|
-
/** True when the server refused because the sign-in is not recent enough. */
|
|
412
|
-
declare function needsRecentSignIn(e: unknown): boolean;
|
|
413
|
-
|
|
414
281
|
/** One account's one-time password as the server reports it. Metadata only: never a seed. */
|
|
415
282
|
interface AuthenticatorEntry {
|
|
416
283
|
itemId: string;
|
|
@@ -1450,20 +1317,6 @@ interface ApiVaultPortOptions {
|
|
|
1450
1317
|
}
|
|
1451
1318
|
declare function createApiVaultPort(hostApi: Api, options?: ApiVaultPortOptions): VaultPort;
|
|
1452
1319
|
|
|
1453
|
-
/**
|
|
1454
|
-
* Wrap any call that shows, copies or exports a secret. When the server answers "sign in again",
|
|
1455
|
-
* the person confirms it is them (Google, password, or an emailed code) and the call runs again —
|
|
1456
|
-
* they never see a dead "Authentication required" in the row.
|
|
1457
|
-
*/
|
|
1458
|
-
type Confirmed = <T>(run: () => Promise<T>) => Promise<T>;
|
|
1459
|
-
declare function useConfirmed(): Confirmed;
|
|
1460
|
-
declare function IdentityGate({ identity, children }: {
|
|
1461
|
-
identity: VaultIdentity | undefined;
|
|
1462
|
-
children: ReactNode;
|
|
1463
|
-
}): react.JSX.Element;
|
|
1464
|
-
/** True for the rejection a canceled confirmation produces (callers stay quiet about it). */
|
|
1465
|
-
declare const wasCancelled: (e: unknown) => boolean;
|
|
1466
|
-
|
|
1467
1320
|
/** Reads the organization's ceilings. Raw knob values are fine: they are validated here. */
|
|
1468
1321
|
type GeneratorLimitsSource = () => Promise<{
|
|
1469
1322
|
maxPasswordLength?: unknown;
|
|
@@ -1556,4 +1409,4 @@ declare function holdingsDoorIsAbsent(code: string | undefined | null): boolean;
|
|
|
1556
1409
|
*/
|
|
1557
1410
|
declare function emptyReadAlarm(total: number, emptyIds: readonly string[], holdings: Holdings): string | null;
|
|
1558
1411
|
|
|
1559
|
-
export { type ApiVaultPortOptions, BACKUP_PASSPHRASE_MIN_KNOB, CATEGORIES,
|
|
1412
|
+
export { type ApiVaultPortOptions, BACKUP_PASSPHRASE_MIN_KNOB, CATEGORIES, type CategoryId, type CopyOptions, DEFAULT_LOCATION, type DefinitionField, type FieldHandling, type FieldKind, GenerateButton, HIDDEN_ITEM_TAG, HOLDINGS_DOOR_MIGRATION, type HoldingRow, type Holdings, type ItemDraft, LOCKED_MESSAGE, type NoticeKind, type Notify, REVEAL_SECONDS_KNOB, type RowItemAction, type RowMenuEntry, type RowMenuEntryKind, type SaveResult, type TotpReading, type UriMatchMode, type UrlGuess, type VaultAgentScope, VaultApp, type VaultAppProps, type VaultAttachment, type VaultAuthenticator, type VaultClipboard, type VaultCopied, type VaultCustomField, type VaultDefinition, type VaultField, type VaultHostCapabilities, VaultIdentity, type VaultInventory, type VaultItem, type VaultItemCapabilities, type VaultKnobs, type VaultLayout, type VaultLocation, type VaultLock, VaultLockedError, type VaultOrganizationRef, type VaultOwner, type VaultPort, type VaultSelection, type VaultSnapshot, type VaultSort, type VaultUserStateDoor, categoryOf, copiedLine, copyValue, createApiVaultPort, createVaultKnobs, emptyReadAlarm, guardPort, holdingsDoorIsAbsent, inferFromUrl, isHiddenItem, itemIdAt, locationFromParams, locationToParams, loginSiteOf, matchesQuery, parseDefinitions, positiveKnob, providerOf, rowMenuEntriesAt, siteDomainOf, sortItems, useDisposable, vaultInventoryScope, vaultItemFacts };
|