@camstack/core 0.1.33 → 0.1.35
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/auth/api-key-manager.d.ts +2 -2
- package/dist/auth/api-key-manager.d.ts.map +1 -1
- package/dist/auth/auth-manager.d.ts +70 -3
- package/dist/auth/auth-manager.d.ts.map +1 -1
- package/dist/auth/totp-manager.d.ts +53 -0
- package/dist/auth/totp-manager.d.ts.map +1 -0
- package/dist/auth/user-manager.d.ts +3 -3
- package/dist/auth/user-manager.d.ts.map +1 -1
- package/dist/builtins/auth-orchestrator/auth-orchestrator.addon.d.ts.map +1 -1
- package/dist/builtins/auth-orchestrator/auth-orchestrator.addon.js +29 -9
- package/dist/builtins/auth-orchestrator/auth-orchestrator.addon.js.map +1 -1
- package/dist/builtins/auth-orchestrator/auth-orchestrator.addon.mjs +29 -9
- package/dist/builtins/auth-orchestrator/auth-orchestrator.addon.mjs.map +1 -1
- package/dist/builtins/local-auth/auth-schema.d.ts +14 -0
- package/dist/builtins/local-auth/auth-schema.d.ts.map +1 -1
- package/dist/builtins/local-auth/local-auth.addon.d.ts +1 -0
- package/dist/builtins/local-auth/local-auth.addon.d.ts.map +1 -1
- package/dist/builtins/local-auth/local-auth.addon.js +1014 -22
- package/dist/builtins/local-auth/local-auth.addon.js.map +1 -1
- package/dist/builtins/local-auth/local-auth.addon.mjs +1025 -33
- package/dist/builtins/local-auth/local-auth.addon.mjs.map +1 -1
- package/dist/builtins/platform-probe/hardware-encoder-probe.d.ts +14 -0
- package/dist/builtins/platform-probe/hardware-encoder-probe.d.ts.map +1 -0
- package/dist/builtins/platform-probe/index.d.ts +2 -0
- package/dist/builtins/platform-probe/index.d.ts.map +1 -1
- package/dist/builtins/platform-probe/index.js +198 -5
- package/dist/builtins/platform-probe/index.js.map +1 -1
- package/dist/builtins/platform-probe/index.mjs +198 -6
- package/dist/builtins/platform-probe/index.mjs.map +1 -1
- package/dist/builtins/sqlite-storage/sqlite-settings-backend.d.ts +8 -0
- package/dist/builtins/sqlite-storage/sqlite-settings-backend.d.ts.map +1 -1
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +27 -21
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.js.map +1 -1
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +27 -21
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +558 -94
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +558 -94
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { AuthManager } from './auth-manager.js';
|
|
2
|
-
import { ApiKeyRecord,
|
|
2
|
+
import { ApiKeyRecord, SettingsStoreClient } from '@camstack/types';
|
|
3
3
|
export type { ApiKeyRecord };
|
|
4
4
|
interface CreateApiKeyInput {
|
|
5
5
|
label: string;
|
|
6
|
-
|
|
6
|
+
isAdmin?: boolean;
|
|
7
7
|
allowedProviders?: string[] | '*';
|
|
8
8
|
allowedDevices?: Record<string, string[] | '*'>;
|
|
9
9
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-key-manager.d.ts","sourceRoot":"","sources":["../../src/auth/api-key-manager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAEpD,OAAO,KAAK,EAAE,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"api-key-manager.d.ts","sourceRoot":"","sources":["../../src/auth/api-key-manager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAEpD,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAGxE,YAAY,EAAE,YAAY,EAAE,CAAA;AAE5B,UAAU,iBAAiB;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,gBAAgB,CAAC,EAAE,MAAM,EAAE,GAAG,GAAG,CAAA;IACjC,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC,CAAA;CAChD;AAID,MAAM,WAAW,mBAAmB;IAClC,QAAQ,IAAI,mBAAmB,CAAA;CAChC;AAMD,qBAAa,aAAa;IAEtB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,IAAI;gBADJ,aAAa,EAAE,mBAAmB,EAClC,IAAI,EAAE,WAAW;IAGpC,OAAO,KAAK,KAAK,GAEhB;IAEK,MAAM,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,YAAY,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAkBlF,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAa1D,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,WAAW,CAAC,EAAE,CAAC;IASrD,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIjC,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;CAKzD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export type {
|
|
1
|
+
import { TokenPayload, IScopedLogger } from '@camstack/types';
|
|
2
|
+
export type { TokenPayload };
|
|
3
3
|
export type AuthConfigReader = {
|
|
4
4
|
get<T>(path: string): T;
|
|
5
5
|
update(section: string, data: Record<string, unknown>): void;
|
|
@@ -25,8 +25,75 @@ export declare class AuthManager {
|
|
|
25
25
|
*/
|
|
26
26
|
createServiceToken(opts: {
|
|
27
27
|
readonly agentId: string;
|
|
28
|
-
readonly role?: string;
|
|
29
28
|
readonly expiresIn?: string;
|
|
30
29
|
}): string;
|
|
30
|
+
/**
|
|
31
|
+
* Mint a short-lived HMAC-signed bridge token used by SSO-style auth
|
|
32
|
+
* providers (OIDC, SAML, magic-link, …) to hand the post-callback
|
|
33
|
+
* claims to `/api/auth/sso/finish` without trusting unsigned query
|
|
34
|
+
* parameters. The endpoint verifies the token signature with the same
|
|
35
|
+
* `jwtSecret` and only then mints the user session JWT. This closes
|
|
36
|
+
* the privilege-escalation gap where any client could craft a
|
|
37
|
+
* `?isAdmin=1` link to `/sso/finish` and become admin.
|
|
38
|
+
*
|
|
39
|
+
* The payload carries `kind: 'sso-bridge'` so `verifySsoBridgeToken`
|
|
40
|
+
* can reject session tokens reused as bridge tokens (and vice versa).
|
|
41
|
+
* TTL defaults to 5 minutes — long enough to survive the IdP
|
|
42
|
+
* redirect bounce, short enough that a leaked URL stops being useful
|
|
43
|
+
* before the operator notices.
|
|
44
|
+
*/
|
|
45
|
+
signSsoBridgeToken(payload: SsoBridgeClaims, ttlSec?: number): string;
|
|
46
|
+
/**
|
|
47
|
+
* Verify + decode a bridge token minted by `signSsoBridgeToken`.
|
|
48
|
+
* Returns `null` for invalid signature, expired token, or wrong
|
|
49
|
+
* `kind` claim. Never throws — the consumer ( `/sso/finish`) treats
|
|
50
|
+
* `null` as 400 Bad Request.
|
|
51
|
+
*/
|
|
52
|
+
verifySsoBridgeToken(token: string): SsoBridgeClaims | null;
|
|
53
|
+
/**
|
|
54
|
+
* Mint a TOTP challenge token bridging the two-step login flow:
|
|
55
|
+
*
|
|
56
|
+
* 1. POST /login → password OK + user has 2FA → returns
|
|
57
|
+
* `{requiresTotp: true, challengeToken: '...'}` (this token).
|
|
58
|
+
* 2. POST /login/totp-verify → operator types 6-digit code →
|
|
59
|
+
* server verifies challenge token + code → mints the real
|
|
60
|
+
* session JWT.
|
|
61
|
+
*
|
|
62
|
+
* The token carries `kind: 'totp-challenge'` so it can't be confused
|
|
63
|
+
* with a regular session token, plus the `userId` + `username` +
|
|
64
|
+
* `isAdmin` claims that will end up in the final session if the code
|
|
65
|
+
* verifies. TTL defaults to 5 minutes — long enough to type the code,
|
|
66
|
+
* short enough that an abandoned login can't be picked up later.
|
|
67
|
+
*/
|
|
68
|
+
signTotpChallengeToken(payload: TotpChallengeClaims, ttlSec?: number): string;
|
|
69
|
+
/**
|
|
70
|
+
* Verify + decode a TOTP challenge token. Returns `null` for any
|
|
71
|
+
* failure (invalid signature, expired, wrong `kind`, missing
|
|
72
|
+
* claims). The caller MUST also verify the 6-digit code against
|
|
73
|
+
* `totpManager.verify(userId, code)` before minting the real
|
|
74
|
+
* session — this method validates the bridge transport only.
|
|
75
|
+
*/
|
|
76
|
+
verifyTotpChallengeToken(token: string): TotpChallengeClaims | null;
|
|
77
|
+
}
|
|
78
|
+
export interface SsoBridgeClaims {
|
|
79
|
+
readonly userId: string;
|
|
80
|
+
readonly username: string;
|
|
81
|
+
readonly isAdmin: boolean;
|
|
82
|
+
readonly provider: string;
|
|
83
|
+
readonly email?: string;
|
|
84
|
+
readonly displayName?: string;
|
|
85
|
+
/**
|
|
86
|
+
* Public HTTPS URL of the hub that minted the token. Carried verbatim
|
|
87
|
+
* through sign/verify; consumed by cloud-mode OAuth proxies (e.g. the
|
|
88
|
+
* Alexa Lambda) which need to know which hub to forward to without
|
|
89
|
+
* keeping per-user routing state. Optional — only the cloud-mode
|
|
90
|
+
* issuers set it.
|
|
91
|
+
*/
|
|
92
|
+
readonly hubUrl?: string;
|
|
93
|
+
}
|
|
94
|
+
export interface TotpChallengeClaims {
|
|
95
|
+
readonly userId: string;
|
|
96
|
+
readonly username: string;
|
|
97
|
+
readonly isAdmin: boolean;
|
|
31
98
|
}
|
|
32
99
|
//# sourceMappingURL=auth-manager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-manager.d.ts","sourceRoot":"","sources":["../../src/auth/auth-manager.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"auth-manager.d.ts","sourceRoot":"","sources":["../../src/auth/auth-manager.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAYlE,YAAY,EAAE,YAAY,EAAE,CAAA;AAE5B,MAAM,MAAM,gBAAgB,GAAG;IAC7B,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,CAAA;IACvB,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;CAC7D,CAAA;AAED,qBAAa,WAAW;IAIV,OAAO,CAAC,QAAQ,CAAC,MAAM;IAHnC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAQ;IAClC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAe;gBAET,MAAM,EAAE,gBAAgB,EAAE,MAAM,GAAE,aAA0B;IAczF,SAAS,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,EAAE,KAAK,GAAG,KAAK,CAAC,GAAG,MAAM;IAI7D,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY;IAIlC,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAI/C,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAIvE,cAAc,IAAI;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE;IAOjE,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO;IAK1D;;;OAGG;IACH,kBAAkB,CAAC,IAAI,EAAE;QACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;QACxB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAC5B,GAAG,MAAM;IAuBV;;;;;;;;;;;;;;OAcG;IACH,kBAAkB,CAAC,OAAO,EAAE,eAAe,EAAE,MAAM,GAAE,MAAY,GAAG,MAAM;IAc1E;;;;;OAKG;IACH,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI;IA4B3D;;;;;;;;;;;;;;OAcG;IACH,sBAAsB,CAAC,OAAO,EAAE,mBAAmB,EAAE,MAAM,GAAE,MAAY,GAAG,MAAM;IAalF;;;;;;OAMG;IACH,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,mBAAmB,GAAG,IAAI;CAepE;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;IAC7B;;;;;;OAMG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CACzB;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAC1B"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { SettingsStoreClient } from '@camstack/types';
|
|
2
|
+
export interface TotpSetupResult {
|
|
3
|
+
readonly secret: string;
|
|
4
|
+
readonly otpauthUrl: string;
|
|
5
|
+
}
|
|
6
|
+
export interface TotpStatus {
|
|
7
|
+
readonly enabled: boolean;
|
|
8
|
+
readonly confirmedAt: number | null;
|
|
9
|
+
}
|
|
10
|
+
export declare class TotpManager {
|
|
11
|
+
private readonly store;
|
|
12
|
+
private readonly opts;
|
|
13
|
+
constructor(store: SettingsStoreClient, opts?: {
|
|
14
|
+
/** ±N 30-second windows tolerated. Default 1 = ±30 s clock skew. */
|
|
15
|
+
readonly window?: number;
|
|
16
|
+
});
|
|
17
|
+
/**
|
|
18
|
+
* Begin enrollment. Always generates a fresh secret — calling `setup`
|
|
19
|
+
* a second time on the same user replaces any pending half-enrollment
|
|
20
|
+
* (the user must rescan the QR / re-enter the secret).
|
|
21
|
+
*
|
|
22
|
+
* The user identity (`label`) is what an authenticator displays as
|
|
23
|
+
* the account name; we use the supplied `username` for human-readable
|
|
24
|
+
* recognition. `ISSUER` is the CamStack brand.
|
|
25
|
+
*/
|
|
26
|
+
setup(userId: string, username: string): Promise<TotpSetupResult>;
|
|
27
|
+
/**
|
|
28
|
+
* Confirm enrollment by checking a code from the authenticator
|
|
29
|
+
* against the pending secret. On success, flips `confirmedAt` so
|
|
30
|
+
* `verify()` starts accepting codes. Idempotent on already-confirmed
|
|
31
|
+
* rows: re-confirming a valid code just succeeds with no state
|
|
32
|
+
* change.
|
|
33
|
+
*/
|
|
34
|
+
confirm(userId: string, code: string): Promise<boolean>;
|
|
35
|
+
/**
|
|
36
|
+
* Remove enrollment. Idempotent — no error if the user had no row.
|
|
37
|
+
*/
|
|
38
|
+
disable(userId: string): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* Verify a code against the confirmed secret. Returns `false` when:
|
|
41
|
+
* - The user has no row (not set up).
|
|
42
|
+
* - The row is pending (`confirmedAt === null`).
|
|
43
|
+
* - The code doesn't match within the configured window.
|
|
44
|
+
*/
|
|
45
|
+
verify(userId: string, code: string): Promise<boolean>;
|
|
46
|
+
/**
|
|
47
|
+
* Read the user's enrollment status. Pending half-enrollments are
|
|
48
|
+
* reported as `enabled: false` — only a confirmed row counts.
|
|
49
|
+
*/
|
|
50
|
+
getStatus(userId: string): Promise<TotpStatus>;
|
|
51
|
+
private find;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=totp-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"totp-manager.d.ts","sourceRoot":"","sources":["../../src/auth/totp-manager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAoD1D,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;CAC5B;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;CACpC;AAED,qBAAa,WAAW;IAEpB,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,IAAI;gBADJ,KAAK,EAAE,mBAAmB,EAC1B,IAAI,GAAE;QACrB,oEAAoE;QACpE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KACpB;IAOR;;;;;;;;OAQG;IACG,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAoBvE;;;;;;OAMG;IACG,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAe7D;;OAEG;IACG,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI5C;;;;;OAKG;IACG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAO5D;;;OAGG;IACG,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;YAStC,IAAI;CAQnB"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { AuthManager } from './auth-manager.js';
|
|
2
|
-
import { UserRecord,
|
|
2
|
+
import { UserRecord, TokenScope, SettingsStoreClient } from '@camstack/types';
|
|
3
3
|
export type { UserRecord };
|
|
4
4
|
interface CreateUserInput {
|
|
5
5
|
username: string;
|
|
6
6
|
password: string;
|
|
7
|
-
|
|
7
|
+
isAdmin?: boolean;
|
|
8
8
|
allowedProviders?: string[] | '*';
|
|
9
9
|
allowedDevices?: Record<string, string[] | '*'>;
|
|
10
10
|
scopes?: TokenScope[];
|
|
11
11
|
}
|
|
12
|
-
type UpdatableUserFields = Partial<Pick<UserRecord, '
|
|
12
|
+
type UpdatableUserFields = Partial<Pick<UserRecord, 'isAdmin' | 'allowedProviders' | 'allowedDevices' | 'scopes'>>;
|
|
13
13
|
export interface UserStorageAccess {
|
|
14
14
|
getStore(): SettingsStoreClient;
|
|
15
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-manager.d.ts","sourceRoot":"","sources":["../../src/auth/user-manager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAEpD,OAAO,KAAK,EAAE,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"user-manager.d.ts","sourceRoot":"","sources":["../../src/auth/user-manager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAEpD,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAGlF,YAAY,EAAE,UAAU,EAAE,CAAA;AAE1B,UAAU,eAAe;IACvB,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,gBAAgB,CAAC,EAAE,MAAM,EAAE,GAAG,GAAG,CAAA;IACjC,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC,CAAA;IAC/C,MAAM,CAAC,EAAE,UAAU,EAAE,CAAA;CACtB;AAED,KAAK,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,SAAS,GAAG,kBAAkB,GAAG,gBAAgB,GAAG,QAAQ,CAAC,CAAC,CAAA;AAIlH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,IAAI,mBAAmB,CAAA;CAChC;AAED,MAAM,WAAW,gBAAgB;IAC/B,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,CAAA;CACxB;AAMD,qBAAa,WAAW;IAEpB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAFN,aAAa,EAAE,iBAAiB,EAChC,IAAI,EAAE,WAAW,EACjB,MAAM,EAAE,gBAAgB;IAG3C,OAAO,KAAK,KAAK,GAEhB;IAEK,MAAM,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,UAAU,CAAC;IAsBnD,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAM5D,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAMhD,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAOnF,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,EAAE,CAAC;IAStD,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;IAM5D,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIjC,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAO7D,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;CAsBzC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-orchestrator.addon.d.ts","sourceRoot":"","sources":["../../../src/builtins/auth-orchestrator/auth-orchestrator.addon.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EACL,SAAS,EAIT,KAAK,oBAAoB,EAC1B,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"auth-orchestrator.addon.d.ts","sourceRoot":"","sources":["../../../src/builtins/auth-orchestrator/auth-orchestrator.addon.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EACL,SAAS,EAIT,KAAK,oBAAoB,EAC1B,MAAM,iBAAiB,CAAA;AA4BxB,qBAAa,qBAAsB,SAAQ,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;;cAKzD,YAAY,IAAI,OAAO,CAAC,oBAAoB,EAAE,CAAC;YAgBjD,aAAa;CAoC5B;AAED,eAAe,qBAAqB,CAAA"}
|
|
@@ -37,15 +37,35 @@ var AuthOrchestratorAddon = class extends _camstack_types.BaseAddon {
|
|
|
37
37
|
}];
|
|
38
38
|
}
|
|
39
39
|
async listProviders() {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
40
|
+
const entries = this.capabilities?.getCollectionEntries("auth-provider") ?? [];
|
|
41
|
+
const out = [];
|
|
42
|
+
for (const [addonId, raw] of entries) {
|
|
43
|
+
if (raw?.instances && raw.instances.length > 0) {
|
|
44
|
+
for (const inst of raw.instances) out.push({
|
|
45
|
+
addonId: raw.addonId ?? addonId,
|
|
46
|
+
instanceId: inst.instanceId,
|
|
47
|
+
displayName: inst.displayName,
|
|
48
|
+
...inst.icon !== void 0 ? { icon: inst.icon } : {},
|
|
49
|
+
hasRedirectFlow: inst.hasRedirectFlow,
|
|
50
|
+
hasCredentialFlow: inst.hasCredentialFlow,
|
|
51
|
+
...inst.kind !== void 0 ? { kind: inst.kind } : {},
|
|
52
|
+
...inst.status !== void 0 ? { status: inst.status } : {},
|
|
53
|
+
enabled: true
|
|
54
|
+
});
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
out.push({
|
|
58
|
+
addonId: raw?.addonId ?? addonId,
|
|
59
|
+
displayName: raw?.displayName ?? addonId,
|
|
60
|
+
...raw?.icon !== void 0 ? { icon: raw.icon } : {},
|
|
61
|
+
hasRedirectFlow: raw?.hasRedirectFlow ?? false,
|
|
62
|
+
hasCredentialFlow: raw?.hasCredentialFlow ?? addonId === "local-auth",
|
|
63
|
+
...raw?.kind !== void 0 ? { kind: raw.kind } : {},
|
|
64
|
+
...raw?.status !== void 0 ? { status: raw.status } : {},
|
|
65
|
+
enabled: true
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
return out;
|
|
49
69
|
}
|
|
50
70
|
};
|
|
51
71
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-orchestrator.addon.js","names":[],"sources":["../../../src/builtins/auth-orchestrator/auth-orchestrator.addon.ts"],"sourcesContent":["/**\n * Authentication orchestrator — singleton facade over the\n * `auth-provider` collection. Mirrors the backup-orchestrator pattern:\n * UI consumers go through this builtin, which walks the\n * `auth-provider` collection registered by `local-auth` and any\n * additional `auth-*` addons (OIDC, SAML, LDAP, …) and returns a\n * curated view.\n *\n * The actual login flow still goes through `auth-provider`\n * collection methods (validateCredentials / getLoginUrl / …); this\n * cap exists so the admin UI's \"Authentication\" page and the login\n * screen's provider picker have ONE place to query instead of\n * walking the collection themselves.\n */\nimport {\n BaseAddon,\n authenticationCapability,\n type AuthProviderInfo,\n type IAuthenticationProvider,\n type ProviderRegistration,\n} from '@camstack/types'\n\ninterface AuthProviderRegistrationLike {\n readonly addonId?: string\n readonly displayName?: string\n readonly icon?: string\n readonly hasRedirectFlow?: boolean\n readonly hasCredentialFlow?: boolean\n readonly status?: string\n}\n\nexport class AuthOrchestratorAddon extends BaseAddon<Record<string, never>> {\n constructor() {\n super({})\n }\n\n protected async onInitialize(): Promise<ProviderRegistration[]> {\n const provider: IAuthenticationProvider = {\n listProviders: async () => this.listProviders(),\n setProviderEnabled: async () => {\n // Persistence is per-addon today — operators toggle enabled\n // via the provider addon's own settings panel. The orchestrator\n // exposes the affordance for forward-compat (UI may move the\n // enabled toggle into the Authentication page later) but\n // currently no-ops the persistence side.\n return { success: true as const }\n },\n }\n this.ctx.logger.info('Authentication orchestrator initialized')\n return [{ capability: authenticationCapability, provider }]\n }\n\n private async listProviders(): Promise<readonly AuthProviderInfo[]> {\n const entries = this.capabilities?.getCollectionEntries<AuthProviderRegistrationLike>('auth-provider') ?? []\n
|
|
1
|
+
{"version":3,"file":"auth-orchestrator.addon.js","names":[],"sources":["../../../src/builtins/auth-orchestrator/auth-orchestrator.addon.ts"],"sourcesContent":["/**\n * Authentication orchestrator — singleton facade over the\n * `auth-provider` collection. Mirrors the backup-orchestrator pattern:\n * UI consumers go through this builtin, which walks the\n * `auth-provider` collection registered by `local-auth` and any\n * additional `auth-*` addons (OIDC, SAML, LDAP, …) and returns a\n * curated view.\n *\n * The actual login flow still goes through `auth-provider`\n * collection methods (validateCredentials / getLoginUrl / …); this\n * cap exists so the admin UI's \"Authentication\" page and the login\n * screen's provider picker have ONE place to query instead of\n * walking the collection themselves.\n */\nimport {\n BaseAddon,\n authenticationCapability,\n type AuthProviderInfo,\n type IAuthenticationProvider,\n type ProviderRegistration,\n} from '@camstack/types'\n\ninterface AuthProviderRegistrationLike {\n readonly addonId?: string\n readonly displayName?: string\n readonly icon?: string\n readonly hasRedirectFlow?: boolean\n readonly hasCredentialFlow?: boolean\n readonly kind?: string\n readonly status?: string\n /**\n * Multi-instance fan-out. When set, the orchestrator emits ONE\n * AuthProviderInfo per entry instead of a single one for the\n * collection entry. Used by addons that host multiple logical IdPs\n * within a single install (the OIDC addon supports Google +\n * Microsoft + custom from one installation).\n */\n readonly instances?: ReadonlyArray<{\n readonly instanceId: string\n readonly displayName: string\n readonly icon?: string\n readonly hasRedirectFlow: boolean\n readonly hasCredentialFlow: boolean\n readonly kind?: string\n readonly status?: string\n }>\n}\n\nexport class AuthOrchestratorAddon extends BaseAddon<Record<string, never>> {\n constructor() {\n super({})\n }\n\n protected async onInitialize(): Promise<ProviderRegistration[]> {\n const provider: IAuthenticationProvider = {\n listProviders: async () => this.listProviders(),\n setProviderEnabled: async () => {\n // Persistence is per-addon today — operators toggle enabled\n // via the provider addon's own settings panel. The orchestrator\n // exposes the affordance for forward-compat (UI may move the\n // enabled toggle into the Authentication page later) but\n // currently no-ops the persistence side.\n return { success: true as const }\n },\n }\n this.ctx.logger.info('Authentication orchestrator initialized')\n return [{ capability: authenticationCapability, provider }]\n }\n\n private async listProviders(): Promise<readonly AuthProviderInfo[]> {\n const entries = this.capabilities?.getCollectionEntries<AuthProviderRegistrationLike>('auth-provider') ?? []\n const out: AuthProviderInfo[] = []\n for (const [addonId, raw] of entries) {\n // Multi-instance: emit one entry per declared instance, preserving\n // the parent `addonId` so the login URL keeps `/addon/<addonId>/...`\n // while adding the `instanceId` path segment downstream.\n if (raw?.instances && raw.instances.length > 0) {\n for (const inst of raw.instances) {\n out.push({\n addonId: raw.addonId ?? addonId,\n instanceId: inst.instanceId,\n displayName: inst.displayName,\n ...(inst.icon !== undefined ? { icon: inst.icon } : {}),\n hasRedirectFlow: inst.hasRedirectFlow,\n hasCredentialFlow: inst.hasCredentialFlow,\n ...(inst.kind !== undefined ? { kind: inst.kind } : {}),\n ...(inst.status !== undefined ? { status: inst.status } : {}),\n enabled: true,\n })\n }\n continue\n }\n out.push({\n addonId: raw?.addonId ?? addonId,\n displayName: raw?.displayName ?? addonId,\n ...(raw?.icon !== undefined ? { icon: raw.icon } : {}),\n hasRedirectFlow: raw?.hasRedirectFlow ?? false,\n hasCredentialFlow: raw?.hasCredentialFlow ?? (addonId === 'local-auth'),\n ...(raw?.kind !== undefined ? { kind: raw.kind } : {}),\n ...(raw?.status !== undefined ? { status: raw.status } : {}),\n enabled: true,\n })\n }\n return out\n }\n}\n\nexport default AuthOrchestratorAddon\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAgDA,IAAa,wBAAb,cAA2C,gBAAA,UAAiC;CAC1E,cAAc;EACZ,MAAM,EAAE,CAAC;;CAGX,MAAgB,eAAgD;EAC9D,MAAM,WAAoC;GACxC,eAAe,YAAY,KAAK,eAAe;GAC/C,oBAAoB,YAAY;IAM9B,OAAO,EAAE,SAAS,MAAe;;GAEpC;EACD,KAAK,IAAI,OAAO,KAAK,0CAA0C;EAC/D,OAAO,CAAC;GAAE,YAAY,gBAAA;GAA0B;GAAU,CAAC;;CAG7D,MAAc,gBAAsD;EAClE,MAAM,UAAU,KAAK,cAAc,qBAAmD,gBAAgB,IAAI,EAAE;EAC5G,MAAM,MAA0B,EAAE;EAClC,KAAK,MAAM,CAAC,SAAS,QAAQ,SAAS;GAIpC,IAAI,KAAK,aAAa,IAAI,UAAU,SAAS,GAAG;IAC9C,KAAK,MAAM,QAAQ,IAAI,WACrB,IAAI,KAAK;KACP,SAAS,IAAI,WAAW;KACxB,YAAY,KAAK;KACjB,aAAa,KAAK;KAClB,GAAI,KAAK,SAAS,KAAA,IAAY,EAAE,MAAM,KAAK,MAAM,GAAG,EAAE;KACtD,iBAAiB,KAAK;KACtB,mBAAmB,KAAK;KACxB,GAAI,KAAK,SAAS,KAAA,IAAY,EAAE,MAAM,KAAK,MAAM,GAAG,EAAE;KACtD,GAAI,KAAK,WAAW,KAAA,IAAY,EAAE,QAAQ,KAAK,QAAQ,GAAG,EAAE;KAC5D,SAAS;KACV,CAAC;IAEJ;;GAEF,IAAI,KAAK;IACP,SAAS,KAAK,WAAW;IACzB,aAAa,KAAK,eAAe;IACjC,GAAI,KAAK,SAAS,KAAA,IAAY,EAAE,MAAM,IAAI,MAAM,GAAG,EAAE;IACrD,iBAAiB,KAAK,mBAAmB;IACzC,mBAAmB,KAAK,qBAAsB,YAAY;IAC1D,GAAI,KAAK,SAAS,KAAA,IAAY,EAAE,MAAM,IAAI,MAAM,GAAG,EAAE;IACrD,GAAI,KAAK,WAAW,KAAA,IAAY,EAAE,QAAQ,IAAI,QAAQ,GAAG,EAAE;IAC3D,SAAS;IACV,CAAC;;EAEJ,OAAO"}
|
|
@@ -32,15 +32,35 @@ var AuthOrchestratorAddon = class extends BaseAddon {
|
|
|
32
32
|
}];
|
|
33
33
|
}
|
|
34
34
|
async listProviders() {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
35
|
+
const entries = this.capabilities?.getCollectionEntries("auth-provider") ?? [];
|
|
36
|
+
const out = [];
|
|
37
|
+
for (const [addonId, raw] of entries) {
|
|
38
|
+
if (raw?.instances && raw.instances.length > 0) {
|
|
39
|
+
for (const inst of raw.instances) out.push({
|
|
40
|
+
addonId: raw.addonId ?? addonId,
|
|
41
|
+
instanceId: inst.instanceId,
|
|
42
|
+
displayName: inst.displayName,
|
|
43
|
+
...inst.icon !== void 0 ? { icon: inst.icon } : {},
|
|
44
|
+
hasRedirectFlow: inst.hasRedirectFlow,
|
|
45
|
+
hasCredentialFlow: inst.hasCredentialFlow,
|
|
46
|
+
...inst.kind !== void 0 ? { kind: inst.kind } : {},
|
|
47
|
+
...inst.status !== void 0 ? { status: inst.status } : {},
|
|
48
|
+
enabled: true
|
|
49
|
+
});
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
out.push({
|
|
53
|
+
addonId: raw?.addonId ?? addonId,
|
|
54
|
+
displayName: raw?.displayName ?? addonId,
|
|
55
|
+
...raw?.icon !== void 0 ? { icon: raw.icon } : {},
|
|
56
|
+
hasRedirectFlow: raw?.hasRedirectFlow ?? false,
|
|
57
|
+
hasCredentialFlow: raw?.hasCredentialFlow ?? addonId === "local-auth",
|
|
58
|
+
...raw?.kind !== void 0 ? { kind: raw.kind } : {},
|
|
59
|
+
...raw?.status !== void 0 ? { status: raw.status } : {},
|
|
60
|
+
enabled: true
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
return out;
|
|
44
64
|
}
|
|
45
65
|
};
|
|
46
66
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-orchestrator.addon.mjs","names":[],"sources":["../../../src/builtins/auth-orchestrator/auth-orchestrator.addon.ts"],"sourcesContent":["/**\n * Authentication orchestrator — singleton facade over the\n * `auth-provider` collection. Mirrors the backup-orchestrator pattern:\n * UI consumers go through this builtin, which walks the\n * `auth-provider` collection registered by `local-auth` and any\n * additional `auth-*` addons (OIDC, SAML, LDAP, …) and returns a\n * curated view.\n *\n * The actual login flow still goes through `auth-provider`\n * collection methods (validateCredentials / getLoginUrl / …); this\n * cap exists so the admin UI's \"Authentication\" page and the login\n * screen's provider picker have ONE place to query instead of\n * walking the collection themselves.\n */\nimport {\n BaseAddon,\n authenticationCapability,\n type AuthProviderInfo,\n type IAuthenticationProvider,\n type ProviderRegistration,\n} from '@camstack/types'\n\ninterface AuthProviderRegistrationLike {\n readonly addonId?: string\n readonly displayName?: string\n readonly icon?: string\n readonly hasRedirectFlow?: boolean\n readonly hasCredentialFlow?: boolean\n readonly status?: string\n}\n\nexport class AuthOrchestratorAddon extends BaseAddon<Record<string, never>> {\n constructor() {\n super({})\n }\n\n protected async onInitialize(): Promise<ProviderRegistration[]> {\n const provider: IAuthenticationProvider = {\n listProviders: async () => this.listProviders(),\n setProviderEnabled: async () => {\n // Persistence is per-addon today — operators toggle enabled\n // via the provider addon's own settings panel. The orchestrator\n // exposes the affordance for forward-compat (UI may move the\n // enabled toggle into the Authentication page later) but\n // currently no-ops the persistence side.\n return { success: true as const }\n },\n }\n this.ctx.logger.info('Authentication orchestrator initialized')\n return [{ capability: authenticationCapability, provider }]\n }\n\n private async listProviders(): Promise<readonly AuthProviderInfo[]> {\n const entries = this.capabilities?.getCollectionEntries<AuthProviderRegistrationLike>('auth-provider') ?? []\n
|
|
1
|
+
{"version":3,"file":"auth-orchestrator.addon.mjs","names":[],"sources":["../../../src/builtins/auth-orchestrator/auth-orchestrator.addon.ts"],"sourcesContent":["/**\n * Authentication orchestrator — singleton facade over the\n * `auth-provider` collection. Mirrors the backup-orchestrator pattern:\n * UI consumers go through this builtin, which walks the\n * `auth-provider` collection registered by `local-auth` and any\n * additional `auth-*` addons (OIDC, SAML, LDAP, …) and returns a\n * curated view.\n *\n * The actual login flow still goes through `auth-provider`\n * collection methods (validateCredentials / getLoginUrl / …); this\n * cap exists so the admin UI's \"Authentication\" page and the login\n * screen's provider picker have ONE place to query instead of\n * walking the collection themselves.\n */\nimport {\n BaseAddon,\n authenticationCapability,\n type AuthProviderInfo,\n type IAuthenticationProvider,\n type ProviderRegistration,\n} from '@camstack/types'\n\ninterface AuthProviderRegistrationLike {\n readonly addonId?: string\n readonly displayName?: string\n readonly icon?: string\n readonly hasRedirectFlow?: boolean\n readonly hasCredentialFlow?: boolean\n readonly kind?: string\n readonly status?: string\n /**\n * Multi-instance fan-out. When set, the orchestrator emits ONE\n * AuthProviderInfo per entry instead of a single one for the\n * collection entry. Used by addons that host multiple logical IdPs\n * within a single install (the OIDC addon supports Google +\n * Microsoft + custom from one installation).\n */\n readonly instances?: ReadonlyArray<{\n readonly instanceId: string\n readonly displayName: string\n readonly icon?: string\n readonly hasRedirectFlow: boolean\n readonly hasCredentialFlow: boolean\n readonly kind?: string\n readonly status?: string\n }>\n}\n\nexport class AuthOrchestratorAddon extends BaseAddon<Record<string, never>> {\n constructor() {\n super({})\n }\n\n protected async onInitialize(): Promise<ProviderRegistration[]> {\n const provider: IAuthenticationProvider = {\n listProviders: async () => this.listProviders(),\n setProviderEnabled: async () => {\n // Persistence is per-addon today — operators toggle enabled\n // via the provider addon's own settings panel. The orchestrator\n // exposes the affordance for forward-compat (UI may move the\n // enabled toggle into the Authentication page later) but\n // currently no-ops the persistence side.\n return { success: true as const }\n },\n }\n this.ctx.logger.info('Authentication orchestrator initialized')\n return [{ capability: authenticationCapability, provider }]\n }\n\n private async listProviders(): Promise<readonly AuthProviderInfo[]> {\n const entries = this.capabilities?.getCollectionEntries<AuthProviderRegistrationLike>('auth-provider') ?? []\n const out: AuthProviderInfo[] = []\n for (const [addonId, raw] of entries) {\n // Multi-instance: emit one entry per declared instance, preserving\n // the parent `addonId` so the login URL keeps `/addon/<addonId>/...`\n // while adding the `instanceId` path segment downstream.\n if (raw?.instances && raw.instances.length > 0) {\n for (const inst of raw.instances) {\n out.push({\n addonId: raw.addonId ?? addonId,\n instanceId: inst.instanceId,\n displayName: inst.displayName,\n ...(inst.icon !== undefined ? { icon: inst.icon } : {}),\n hasRedirectFlow: inst.hasRedirectFlow,\n hasCredentialFlow: inst.hasCredentialFlow,\n ...(inst.kind !== undefined ? { kind: inst.kind } : {}),\n ...(inst.status !== undefined ? { status: inst.status } : {}),\n enabled: true,\n })\n }\n continue\n }\n out.push({\n addonId: raw?.addonId ?? addonId,\n displayName: raw?.displayName ?? addonId,\n ...(raw?.icon !== undefined ? { icon: raw.icon } : {}),\n hasRedirectFlow: raw?.hasRedirectFlow ?? false,\n hasCredentialFlow: raw?.hasCredentialFlow ?? (addonId === 'local-auth'),\n ...(raw?.kind !== undefined ? { kind: raw.kind } : {}),\n ...(raw?.status !== undefined ? { status: raw.status } : {}),\n enabled: true,\n })\n }\n return out\n }\n}\n\nexport default AuthOrchestratorAddon\n"],"mappings":";;;;;;;;;;;;;;;;AAgDA,IAAa,wBAAb,cAA2C,UAAiC;CAC1E,cAAc;EACZ,MAAM,EAAE,CAAC;;CAGX,MAAgB,eAAgD;EAC9D,MAAM,WAAoC;GACxC,eAAe,YAAY,KAAK,eAAe;GAC/C,oBAAoB,YAAY;IAM9B,OAAO,EAAE,SAAS,MAAe;;GAEpC;EACD,KAAK,IAAI,OAAO,KAAK,0CAA0C;EAC/D,OAAO,CAAC;GAAE,YAAY;GAA0B;GAAU,CAAC;;CAG7D,MAAc,gBAAsD;EAClE,MAAM,UAAU,KAAK,cAAc,qBAAmD,gBAAgB,IAAI,EAAE;EAC5G,MAAM,MAA0B,EAAE;EAClC,KAAK,MAAM,CAAC,SAAS,QAAQ,SAAS;GAIpC,IAAI,KAAK,aAAa,IAAI,UAAU,SAAS,GAAG;IAC9C,KAAK,MAAM,QAAQ,IAAI,WACrB,IAAI,KAAK;KACP,SAAS,IAAI,WAAW;KACxB,YAAY,KAAK;KACjB,aAAa,KAAK;KAClB,GAAI,KAAK,SAAS,KAAA,IAAY,EAAE,MAAM,KAAK,MAAM,GAAG,EAAE;KACtD,iBAAiB,KAAK;KACtB,mBAAmB,KAAK;KACxB,GAAI,KAAK,SAAS,KAAA,IAAY,EAAE,MAAM,KAAK,MAAM,GAAG,EAAE;KACtD,GAAI,KAAK,WAAW,KAAA,IAAY,EAAE,QAAQ,KAAK,QAAQ,GAAG,EAAE;KAC5D,SAAS;KACV,CAAC;IAEJ;;GAEF,IAAI,KAAK;IACP,SAAS,KAAK,WAAW;IACzB,aAAa,KAAK,eAAe;IACjC,GAAI,KAAK,SAAS,KAAA,IAAY,EAAE,MAAM,IAAI,MAAM,GAAG,EAAE;IACrD,iBAAiB,KAAK,mBAAmB;IACzC,mBAAmB,KAAK,qBAAsB,YAAY;IAC1D,GAAI,KAAK,SAAS,KAAA,IAAY,EAAE,MAAM,IAAI,MAAM,GAAG,EAAE;IACrD,GAAI,KAAK,WAAW,KAAA,IAAY,EAAE,QAAQ,IAAI,QAAQ,GAAG,EAAE;IAC3D,SAAS;IACV,CAAC;;EAEJ,OAAO"}
|
|
@@ -2,6 +2,20 @@ import { SettingsStoreClient } from '@camstack/types';
|
|
|
2
2
|
export declare const USERS_COLLECTION = "users";
|
|
3
3
|
export declare const API_KEYS_COLLECTION = "api_keys";
|
|
4
4
|
export declare const SCOPED_TOKENS_COLLECTION = "scoped_tokens";
|
|
5
|
+
/**
|
|
6
|
+
* TOTP enrollment table — split off from `users` to avoid the
|
|
7
|
+
* destructive drop-+-recreate migration `ensureTable` performs when a
|
|
8
|
+
* new column is added to a typed schema (see `sqlite-settings-backend.ts`).
|
|
9
|
+
*
|
|
10
|
+
* Lifecycle:
|
|
11
|
+
* - Setup: row inserted with `confirmedAt = null` and a fresh secret.
|
|
12
|
+
* - Confirm: a valid code from the secret flips `confirmedAt` to now().
|
|
13
|
+
* - Disable: the row is deleted (next setup starts fresh).
|
|
14
|
+
*
|
|
15
|
+
* "Enabled" means `confirmedAt != null`. A half-enrolled row (`confirmedAt
|
|
16
|
+
* = null`) is INACTIVE — `verifyTotp` returns false until confirmation.
|
|
17
|
+
*/
|
|
18
|
+
export declare const USER_TOTP_COLLECTION = "user_totp";
|
|
5
19
|
/**
|
|
6
20
|
* Declare every auth collection with the typed schema. Called by
|
|
7
21
|
* `LocalAuthAddon.onInitialize` before constructing the per-collection
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-schema.d.ts","sourceRoot":"","sources":["../../../src/builtins/local-auth/auth-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAE1D,eAAO,MAAM,gBAAgB,UAAU,CAAA;AACvC,eAAO,MAAM,mBAAmB,aAAa,CAAA;AAC7C,eAAO,MAAM,wBAAwB,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"auth-schema.d.ts","sourceRoot":"","sources":["../../../src/builtins/local-auth/auth-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAE1D,eAAO,MAAM,gBAAgB,UAAU,CAAA;AACvC,eAAO,MAAM,mBAAmB,aAAa,CAAA;AAC7C,eAAO,MAAM,wBAAwB,kBAAkB,CAAA;AACvD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,oBAAoB,cAAc,CAAA;AAwD/C;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAuBjF"}
|
|
@@ -9,6 +9,7 @@ export declare class LocalAuthAddon extends BaseAddon<LocalAuthConfig> {
|
|
|
9
9
|
private userManager;
|
|
10
10
|
private apiKeyManager;
|
|
11
11
|
private scopedTokenManager;
|
|
12
|
+
private totpManager;
|
|
12
13
|
constructor();
|
|
13
14
|
protected onInitialize(): Promise<ProviderRegistration[]>;
|
|
14
15
|
protected onShutdown(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-auth.addon.d.ts","sourceRoot":"","sources":["../../../src/builtins/local-auth/local-auth.addon.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAA2B,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AACpF,OAAO,EAAE,SAAS,EAAoD,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"local-auth.addon.d.ts","sourceRoot":"","sources":["../../../src/builtins/local-auth/local-auth.addon.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAA2B,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AACpF,OAAO,EAAE,SAAS,EAAoD,MAAM,iBAAiB,CAAA;AA6B7F,UAAU,eAAe;IACvB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED,qBAAa,cAAe,SAAQ,SAAS,CAAC,eAAe,CAAC;IAC5D,OAAO,CAAC,WAAW,CAA2B;IAC9C,OAAO,CAAC,WAAW,CAA2B;IAC9C,OAAO,CAAC,aAAa,CAA6B;IAClD,OAAO,CAAC,kBAAkB,CAAkC;IAC5D,OAAO,CAAC,WAAW,CAA2B;;cAI9B,YAAY,IAAI,OAAO,CAAC,oBAAoB,EAAE,CAAC;cAiQ/C,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;CAO5C;AAED,eAAe,cAAc,CAAA"}
|