@modelprofile.com/authswitch 6.2.0 → 6.4.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_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/authority-contract.d.ts +142 -0
- package/dist_ts/authority-contract.js +3 -0
- package/dist_ts/authority-runtime-contract.d.ts +32 -0
- package/dist_ts/authority-runtime-contract.js +2 -0
- package/dist_ts/classes.authoritybroker.d.ts +73 -0
- package/dist_ts/classes.authoritybroker.js +548 -0
- package/dist_ts/classes.authorityclient.d.ts +34 -0
- package/dist_ts/classes.authorityclient.js +200 -0
- package/dist_ts/classes.authoritydaemon.d.ts +26 -0
- package/dist_ts/classes.authoritydaemon.js +249 -0
- package/dist_ts/classes.authoritydatabase.d.ts +94 -0
- package/dist_ts/classes.authoritydatabase.js +736 -0
- package/dist_ts/classes.authorityframing.d.ts +8 -0
- package/dist_ts/classes.authorityframing.js +22 -0
- package/dist_ts/classes.authoritymodels.d.ts +215 -0
- package/dist_ts/classes.authoritymodels.js +818 -0
- package/dist_ts/classes.authoritysecrets.d.ts +9 -0
- package/dist_ts/classes.authoritysecrets.js +30 -0
- package/dist_ts/classes.authorityservice.d.ts +28 -0
- package/dist_ts/classes.authorityservice.js +71 -0
- package/dist_ts/classes.cli.d.ts +56 -0
- package/dist_ts/classes.cli.js +238 -63
- package/dist_ts/classes.codexpreuse.js +2 -2
- package/dist_ts/classes.tui.js +51 -2
- package/dist_ts/index.d.ts +2 -0
- package/dist_ts/index.js +26 -1
- package/dist_ts/plugins.d.ts +9 -2
- package/dist_ts/plugins.js +10 -3
- package/dist_ts/preuse.d.ts +89 -2
- package/dist_ts/preuse.js +107 -2
- package/package.json +17 -3
- package/readme.md +118 -16
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/authority-contract.ts +109 -0
- package/ts/authority-runtime-contract.ts +27 -0
- package/ts/classes.authoritybroker.ts +530 -0
- package/ts/classes.authorityclient.ts +183 -0
- package/ts/classes.authoritydaemon.ts +219 -0
- package/ts/classes.authoritydatabase.ts +725 -0
- package/ts/classes.authorityframing.ts +21 -0
- package/ts/classes.authoritymodels.ts +367 -0
- package/ts/classes.authoritysecrets.ts +27 -0
- package/ts/classes.authorityservice.ts +83 -0
- package/ts/classes.cli.ts +236 -54
- package/ts/classes.codexpreuse.ts +1 -1
- package/ts/classes.tui.ts +39 -2
- package/ts/index.ts +25 -0
- package/ts/plugins.ts +9 -2
- package/ts/preuse.ts +141 -3
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { type IStoredAuthorityAccount, type IStoredAuthorityBinding, type IStoredAuthorityEnrollment, type IStoredAuthorityEvent, type IStoredAuthorityGrant, type IStoredAuthorityHandoff, type IStoredAuthorityMeta, type IStoredAuthorityMigrationLedger } from './classes.authoritymodels.js';
|
|
2
|
+
export interface IAuthSwitchAuthorityDatabaseOptions {
|
|
3
|
+
dataDirectory: string;
|
|
4
|
+
socketPath: string;
|
|
5
|
+
}
|
|
6
|
+
/** Separate account, grant, binding and journal records; the only global record is a revision counter. */
|
|
7
|
+
export declare class AuthSwitchAuthorityDatabase {
|
|
8
|
+
private readonly options;
|
|
9
|
+
private engine?;
|
|
10
|
+
private database?;
|
|
11
|
+
private started;
|
|
12
|
+
constructor(options: IAuthSwitchAuthorityDatabaseOptions);
|
|
13
|
+
private privateDirectory;
|
|
14
|
+
start(): Promise<void>;
|
|
15
|
+
private db;
|
|
16
|
+
private transaction;
|
|
17
|
+
readMeta(): Promise<IStoredAuthorityMeta>;
|
|
18
|
+
readAccount(id: string): Promise<IStoredAuthorityAccount | null>;
|
|
19
|
+
readBinding(id: string): Promise<IStoredAuthorityBinding | null>;
|
|
20
|
+
/** One consistent authorization view. Callers must not combine separate binding and grant reads. */
|
|
21
|
+
readBindingContext(id: string): Promise<{
|
|
22
|
+
binding: IStoredAuthorityBinding | null;
|
|
23
|
+
account: IStoredAuthorityAccount | null;
|
|
24
|
+
grant: IStoredAuthorityGrant | null;
|
|
25
|
+
}>;
|
|
26
|
+
readGrant(id: string): Promise<IStoredAuthorityGrant | null>;
|
|
27
|
+
readEnrollment(id: string): Promise<IStoredAuthorityEnrollment | null>;
|
|
28
|
+
readHandoff(id: string): Promise<IStoredAuthorityHandoff | null>;
|
|
29
|
+
readMigrationLedger(id: string): Promise<IStoredAuthorityMigrationLedger | null>;
|
|
30
|
+
migrationLedgerByStatus(status: IStoredAuthorityMigrationLedger['status'], after: string | null, limit?: number): Promise<IStoredAuthorityMigrationLedger[]>;
|
|
31
|
+
readAccountAndPrimaryGrant(id: string): Promise<{
|
|
32
|
+
account: IStoredAuthorityAccount | null;
|
|
33
|
+
grant: IStoredAuthorityGrant | null;
|
|
34
|
+
}>;
|
|
35
|
+
page(accountAfter: string | null, bindingAfter: string | null, limit: number): Promise<{
|
|
36
|
+
meta: IStoredAuthorityMeta;
|
|
37
|
+
accounts: Array<{
|
|
38
|
+
account: IStoredAuthorityAccount;
|
|
39
|
+
grant: IStoredAuthorityGrant | null;
|
|
40
|
+
}>;
|
|
41
|
+
bindings: IStoredAuthorityBinding[];
|
|
42
|
+
nextAccountCursor: string | null;
|
|
43
|
+
nextBindingCursor: string | null;
|
|
44
|
+
}>;
|
|
45
|
+
grantsByState(state: IStoredAuthorityGrant['state'], after: string | null, limit?: number): Promise<IStoredAuthorityGrant[]>;
|
|
46
|
+
grantsForAccount(accountId: string, after: string | null, limit?: number): Promise<IStoredAuthorityGrant[]>;
|
|
47
|
+
eventsAfter(revision: number, limit?: number): Promise<IStoredAuthorityEvent[]>;
|
|
48
|
+
private appendEvent;
|
|
49
|
+
private persistAccount;
|
|
50
|
+
private persistGrant;
|
|
51
|
+
/** Atomic account/grant enrollment or reauthentication. Both records become visible together. */
|
|
52
|
+
changeAccountAndGrant(updateId: string, accountId: string, grantId: string, change: (account: IStoredAuthorityAccount | null, grant: IStoredAuthorityGrant | null) => {
|
|
53
|
+
account: IStoredAuthorityAccount;
|
|
54
|
+
grant: IStoredAuthorityGrant;
|
|
55
|
+
}): Promise<{
|
|
56
|
+
meta: IStoredAuthorityMeta;
|
|
57
|
+
account: IStoredAuthorityAccount;
|
|
58
|
+
grant: IStoredAuthorityGrant;
|
|
59
|
+
}>;
|
|
60
|
+
/** Grant transition and public account revision share a transaction and one event. */
|
|
61
|
+
changeGrant(updateId: string, grantId: string, change: (grant: IStoredAuthorityGrant, account: IStoredAuthorityAccount) => IStoredAuthorityGrant): Promise<{
|
|
62
|
+
meta: IStoredAuthorityMeta;
|
|
63
|
+
account: IStoredAuthorityAccount;
|
|
64
|
+
grant: IStoredAuthorityGrant;
|
|
65
|
+
}>;
|
|
66
|
+
/** Add a distinct per-purpose grant without replacing the account's primary grant. */
|
|
67
|
+
changeSecondaryGrant(updateId: string, accountId: string, grantId: string, change: (grant: IStoredAuthorityGrant | null, account: IStoredAuthorityAccount) => IStoredAuthorityGrant): Promise<{
|
|
68
|
+
account: IStoredAuthorityAccount;
|
|
69
|
+
grant: IStoredAuthorityGrant;
|
|
70
|
+
}>;
|
|
71
|
+
/** Remove all managed grants in one transaction; native owners must be stopped and handed off first. */
|
|
72
|
+
removeAccountAndGrants(updateId: string, accountId: string, expectedRevision: number, statusObservedAt: string): Promise<IStoredAuthorityAccount>;
|
|
73
|
+
changeAccount(updateId: string, accountId: string, change: (draft: IStoredAuthorityAccount | null) => IStoredAuthorityAccount): Promise<{
|
|
74
|
+
meta: IStoredAuthorityMeta;
|
|
75
|
+
account: IStoredAuthorityAccount;
|
|
76
|
+
}>;
|
|
77
|
+
changeBinding(updateId: string, bindingId: string, accountId: string, change: (draft: IStoredAuthorityBinding | null, account: IStoredAuthorityAccount, grant: IStoredAuthorityGrant | null) => IStoredAuthorityBinding): Promise<{
|
|
78
|
+
meta: IStoredAuthorityMeta;
|
|
79
|
+
binding: IStoredAuthorityBinding;
|
|
80
|
+
}>;
|
|
81
|
+
/** Enrollment metadata is sealed by the caller and cannot become detached from an account. */
|
|
82
|
+
changeEnrollment(updateId: string, enrollmentId: string, accountId: string, change: (current: IStoredAuthorityEnrollment | null) => IStoredAuthorityEnrollment): Promise<IStoredAuthorityEnrollment>;
|
|
83
|
+
/** Journal and grant advance together; no intermediate phase may expose an active daemon grant. */
|
|
84
|
+
changeHandoffAndGrant(updateId: string, handoffId: string, grantId: string, change: (current: IStoredAuthorityHandoff | null, grant: IStoredAuthorityGrant, account: IStoredAuthorityAccount) => {
|
|
85
|
+
handoff: IStoredAuthorityHandoff;
|
|
86
|
+
grant: IStoredAuthorityGrant;
|
|
87
|
+
}): Promise<{
|
|
88
|
+
handoff: IStoredAuthorityHandoff;
|
|
89
|
+
grant: IStoredAuthorityGrant;
|
|
90
|
+
}>;
|
|
91
|
+
/** Ledger transitions never silently replace an active credential or waive backup proof. */
|
|
92
|
+
changeMigrationLedger(updateId: string, ledgerId: string, change: (current: IStoredAuthorityMigrationLedger | null) => IStoredAuthorityMigrationLedger): Promise<IStoredAuthorityMigrationLedger>;
|
|
93
|
+
stop(): Promise<void>;
|
|
94
|
+
}
|