dsh-auth-remote 0.1.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.
Files changed (94) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/CHANGELOG.zh-CN.md +16 -0
  3. package/CONTRIBUTING.md +23 -0
  4. package/CONTRIBUTING.zh-CN.md +23 -0
  5. package/LICENSE +21 -0
  6. package/README.md +65 -0
  7. package/README.zh-CN.md +65 -0
  8. package/cordis.patch.yml +45 -0
  9. package/dist/cli.js +1858 -0
  10. package/dist/cli.js.map +7 -0
  11. package/dist/client.js +3076 -0
  12. package/dist/client.js.map +7 -0
  13. package/dist/index.js +2473 -0
  14. package/dist/index.js.map +7 -0
  15. package/dist/login.css +230 -0
  16. package/dist/login.css.map +7 -0
  17. package/dist/login.js +2865 -0
  18. package/dist/login.js.map +7 -0
  19. package/dist/types/adapters/dsh/browser-auth.d.ts +8 -0
  20. package/dist/types/adapters/dsh/browser-auth.d.ts.map +1 -0
  21. package/dist/types/adapters/dsh/browser-capability.d.ts +8 -0
  22. package/dist/types/adapters/dsh/browser-capability.d.ts.map +1 -0
  23. package/dist/types/adapters/dsh/compatibility.d.ts +7 -0
  24. package/dist/types/adapters/dsh/compatibility.d.ts.map +1 -0
  25. package/dist/types/adapters/dsh/readiness.d.ts +22 -0
  26. package/dist/types/adapters/dsh/readiness.d.ts.map +1 -0
  27. package/dist/types/adapters/dsh/startup-urls.d.ts +4 -0
  28. package/dist/types/adapters/dsh/startup-urls.d.ts.map +1 -0
  29. package/dist/types/adapters/dsh/webserver.d.ts +36 -0
  30. package/dist/types/adapters/dsh/webserver.d.ts.map +1 -0
  31. package/dist/types/auth/password.d.ts +12 -0
  32. package/dist/types/auth/password.d.ts.map +1 -0
  33. package/dist/types/auth/service.d.ts +90 -0
  34. package/dist/types/auth/service.d.ts.map +1 -0
  35. package/dist/types/auth/sessions.d.ts +8 -0
  36. package/dist/types/auth/sessions.d.ts.map +1 -0
  37. package/dist/types/auth/totp.d.ts +10 -0
  38. package/dist/types/auth/totp.d.ts.map +1 -0
  39. package/dist/types/cli/index.d.ts +3 -0
  40. package/dist/types/cli/index.d.ts.map +1 -0
  41. package/dist/types/cli/ipc-client.d.ts +18 -0
  42. package/dist/types/cli/ipc-client.d.ts.map +1 -0
  43. package/dist/types/cli/language.d.ts +14 -0
  44. package/dist/types/cli/language.d.ts.map +1 -0
  45. package/dist/types/cli/profile.d.ts +10 -0
  46. package/dist/types/cli/profile.d.ts.map +1 -0
  47. package/dist/types/cli/prompt.d.ts +20 -0
  48. package/dist/types/cli/prompt.d.ts.map +1 -0
  49. package/dist/types/config.d.ts +27 -0
  50. package/dist/types/config.d.ts.map +1 -0
  51. package/dist/types/http/admin-socket.d.ts +18 -0
  52. package/dist/types/http/admin-socket.d.ts.map +1 -0
  53. package/dist/types/http/connections.d.ts +21 -0
  54. package/dist/types/http/connections.d.ts.map +1 -0
  55. package/dist/types/http/gate.d.ts +24 -0
  56. package/dist/types/http/gate.d.ts.map +1 -0
  57. package/dist/types/http/origin-policy.d.ts +35 -0
  58. package/dist/types/http/origin-policy.d.ts.map +1 -0
  59. package/dist/types/http/origin.d.ts +5 -0
  60. package/dist/types/http/origin.d.ts.map +1 -0
  61. package/dist/types/http/request-context.d.ts +5 -0
  62. package/dist/types/http/request-context.d.ts.map +1 -0
  63. package/dist/types/http/routes.d.ts +15 -0
  64. package/dist/types/http/routes.d.ts.map +1 -0
  65. package/dist/types/index.d.ts +33 -0
  66. package/dist/types/index.d.ts.map +1 -0
  67. package/dist/types/shared/admin-contract.d.ts +40 -0
  68. package/dist/types/shared/admin-contract.d.ts.map +1 -0
  69. package/dist/types/shared/auth-contract.d.ts +33 -0
  70. package/dist/types/shared/auth-contract.d.ts.map +1 -0
  71. package/dist/types/shared/i18n.d.ts +323 -0
  72. package/dist/types/shared/i18n.d.ts.map +1 -0
  73. package/dist/types/shared/locales/en.d.ts +151 -0
  74. package/dist/types/shared/locales/en.d.ts.map +1 -0
  75. package/dist/types/shared/locales/zh.d.ts +150 -0
  76. package/dist/types/shared/locales/zh.d.ts.map +1 -0
  77. package/dist/types/storage/lock.d.ts +17 -0
  78. package/dist/types/storage/lock.d.ts.map +1 -0
  79. package/dist/types/storage/state.d.ts +34 -0
  80. package/dist/types/storage/state.d.ts.map +1 -0
  81. package/dist/types/storage/store.d.ts +30 -0
  82. package/dist/types/storage/store.d.ts.map +1 -0
  83. package/docs/deployment.md +89 -0
  84. package/docs/deployment.zh-CN.md +89 -0
  85. package/docs/development.md +43 -0
  86. package/docs/development.zh-CN.md +43 -0
  87. package/docs/releasing.md +44 -0
  88. package/docs/releasing.zh-CN.md +44 -0
  89. package/docs/reverse-proxy.md +27 -0
  90. package/docs/reverse-proxy.zh-CN.md +27 -0
  91. package/examples/nginx.conf +27 -0
  92. package/examples/traefik-dsh.yml +20 -0
  93. package/examples/web-profile-auth-remote.patch.yml +14 -0
  94. package/package.json +112 -0
@@ -0,0 +1,12 @@
1
+ import type { PasswordRecord } from '../storage/state.js';
2
+ export declare const PASSWORD_MIN_CHARACTERS = 12;
3
+ export declare const PASSWORD_MAX_CHARACTERS = 256;
4
+ export declare class PasswordValidationError extends Error {
5
+ constructor();
6
+ }
7
+ export declare function validatePassword(password: unknown): asserts password is string;
8
+ export declare function hashPassword(password: string): Promise<PasswordRecord>;
9
+ export declare function verifyPassword(password: string, record: PasswordRecord): Promise<boolean>;
10
+ /** Wrong usernames still perform a comparable derivation. */
11
+ export declare const DUMMY_PASSWORD_RECORD: PasswordRecord;
12
+ //# sourceMappingURL=password.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"password.d.ts","sourceRoot":"","sources":["../../../src/auth/password.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEzD,eAAO,MAAM,uBAAuB,KAAK,CAAA;AACzC,eAAO,MAAM,uBAAuB,MAAM,CAAA;AAE1C,qBAAa,uBAAwB,SAAQ,KAAK;;CAIjD;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,IAAI,MAAM,CAO9E;AAcD,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAI5E;AAED,wBAAsB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,CAG/F;AAED,6DAA6D;AAC7D,eAAO,MAAM,qBAAqB,EAAE,cAGnC,CAAA"}
@@ -0,0 +1,90 @@
1
+ import type { SessionRecord } from '../storage/state.js';
2
+ import { AuthStateStore } from '../storage/store.js';
3
+ export interface AuthPolicy {
4
+ requireTotp: boolean;
5
+ sessionHours: number;
6
+ }
7
+ export type AuthErrorCode = 'invalid_input' | 'uninitialized' | 'already_initialized' | 'invalid_credentials' | 'invalid_factor' | 'invalid_challenge' | 'challenge_expired' | 'unauthorized' | 'rate_limited' | 'busy' | 'conflict' | 'totp_required';
8
+ export declare class AuthError extends Error {
9
+ readonly code: AuthErrorCode;
10
+ readonly retryAfter?: number | undefined;
11
+ constructor(code: AuthErrorCode, retryAfter?: number | undefined);
12
+ }
13
+ export type LoginResult = {
14
+ kind: 'session';
15
+ token: string;
16
+ expiresAt: number;
17
+ } | {
18
+ kind: 'mfa';
19
+ challenge: string;
20
+ expiresAt: number;
21
+ } | {
22
+ kind: 'binding';
23
+ challenge: string;
24
+ secret: string;
25
+ expiresAt: number;
26
+ };
27
+ export interface AuthServiceOptions {
28
+ now?: () => number;
29
+ }
30
+ export declare class AuthService {
31
+ private readonly store;
32
+ private policy;
33
+ private readonly now;
34
+ private readonly challenges;
35
+ private readonly attempts;
36
+ private activeDerivations;
37
+ private policyChanging;
38
+ private readonly unsubscribe;
39
+ constructor(store: AuthStateStore, policy: AuthPolicy, options?: AuthServiceOptions);
40
+ dispose(): void;
41
+ status(): {
42
+ initialized: boolean;
43
+ totpEnabled: boolean;
44
+ activeSessions: number;
45
+ };
46
+ session(token: string): SessionRecord | null;
47
+ policySnapshot(): AuthPolicy;
48
+ me(token: string): {
49
+ username: string;
50
+ totpEnabled: boolean;
51
+ expiresAt: number;
52
+ };
53
+ bindingDetails(id: string): {
54
+ secret: string;
55
+ expiresAt: number;
56
+ };
57
+ pendingChallenges(): number;
58
+ private occupyAttempt;
59
+ private derive;
60
+ private expireChallenges;
61
+ private createChallenge;
62
+ private claim;
63
+ private failedChallenge;
64
+ private sameAccount;
65
+ private requireSession;
66
+ private verifyFactor;
67
+ initialize(username: string, password: string): Promise<void>;
68
+ login(username: string, password: string): Promise<LoginResult>;
69
+ verifyMfa(id: string, code: string): Promise<{
70
+ token: string;
71
+ expiresAt: number;
72
+ }>;
73
+ startBinding(token: string, password: string, currentCode?: string): Promise<Extract<LoginResult, {
74
+ kind: 'binding';
75
+ }>>;
76
+ confirmBinding(id: string, code: string): Promise<{
77
+ backupCodes: string[];
78
+ }>;
79
+ changePassword(token: string, currentPassword: string, currentCode: string | undefined, newPassword: string): Promise<void>;
80
+ disableTotp(token: string, password: string, currentCode: string): Promise<void>;
81
+ revokeWithCredentials(token: string, password: string, currentCode?: string): Promise<void>;
82
+ logout(token: string): Promise<void>;
83
+ resetPassword(newPassword: string): Promise<void>;
84
+ resetTotp(): Promise<void>;
85
+ revokeAll(): Promise<void>;
86
+ applyPolicy(next: AuthPolicy): Promise<void>;
87
+ /** Startup/re-activation must persist tightening before the guarded listener opens. */
88
+ enforceCurrentPolicy(): Promise<void>;
89
+ }
90
+ //# sourceMappingURL=service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/auth/service.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,8 @@
1
+ import type { AuthState, SessionRecord } from '../storage/state.js';
2
+ export declare function sessionHash(token: string): string;
3
+ export declare function issueSession(draft: AuthState, now: number, sessionHours: number): {
4
+ token: string;
5
+ expiresAt: number;
6
+ };
7
+ export declare function sessionFor(state: AuthState, token: string, now: number, requireTotp: boolean): SessionRecord | null;
8
+ //# sourceMappingURL=sessions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sessions.d.ts","sourceRoot":"","sources":["../../../src/auth/sessions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEnE,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,wBAAgB,YAAY,CAC1B,KAAK,EAAE,SAAS,EAChB,GAAG,EAAE,MAAM,EACX,YAAY,EAAE,MAAM,GACnB;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAatC;AAED,wBAAgB,UAAU,CACxB,KAAK,EAAE,SAAS,EAChB,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,WAAW,EAAE,OAAO,GACnB,aAAa,GAAG,IAAI,CActB"}
@@ -0,0 +1,10 @@
1
+ export declare const TOTP_PERIOD_MS = 30000;
2
+ export declare function generateTotpSecret(): string;
3
+ export declare function totpCode(secret: string, step: number): string;
4
+ export declare function matchedTotpStep(secret: string, code: string, timestamp: number, lastUsedStep: number | null): number | null;
5
+ export declare function backupCodeHash(code: string): string | null;
6
+ export declare function generateBackupCodes(): {
7
+ codes: string[];
8
+ hashes: string[];
9
+ };
10
+ //# sourceMappingURL=totp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"totp.d.ts","sourceRoot":"","sources":["../../../src/auth/totp.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,cAAc,QAAS,CAAA;AAmCpC,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAQ7D;AAED,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,GAAG,IAAI,GAC1B,MAAM,GAAG,IAAI,CAQf;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAK1D;AAED,wBAAgB,mBAAmB,IAAI;IAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAO3E"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,18 @@
1
+ import { type AdminRequest, type AdminResponse } from '../shared/admin-contract.js';
2
+ type AdminResult = Extract<AdminResponse, {
3
+ ok: true;
4
+ }>['result'];
5
+ export declare class AdminUnavailable extends Error {
6
+ constructor();
7
+ }
8
+ export declare class AdminOutcomeUnknown extends Error {
9
+ constructor();
10
+ }
11
+ export declare class AdminRejected extends Error {
12
+ readonly code: string;
13
+ constructor(code: string);
14
+ }
15
+ /** Only pre-connect absence may fall back to the offline state lock. */
16
+ export declare function requestAdmin(path: string, request: AdminRequest): Promise<AdminResult>;
17
+ export {};
18
+ //# sourceMappingURL=ipc-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ipc-client.d.ts","sourceRoot":"","sources":["../../../src/cli/ipc-client.ts"],"names":[],"mappings":"AAGA,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,aAAa,EACnB,MAAM,6BAA6B,CAAA;AAGpC,KAAK,WAAW,GAAG,OAAO,CAAC,aAAa,EAAE;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,CAAC,CAAC,QAAQ,CAAC,CAAA;AAEjE,qBAAa,gBAAiB,SAAQ,KAAK;;CAI1C;AAED,qBAAa,mBAAoB,SAAQ,KAAK;;CAI7C;AAED,qBAAa,aAAc,SAAQ,KAAK;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM;gBAAZ,IAAI,EAAE,MAAM;CAGlC;AAsCD,wEAAwE;AACxE,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CAuE5F"}
@@ -0,0 +1,14 @@
1
+ import { type Locale, type MessageKey } from '../shared/i18n.js';
2
+ export declare class CliDiagnostic extends Error {
3
+ readonly key: MessageKey;
4
+ readonly locale?: Locale | undefined;
5
+ constructor(key: MessageKey, englishMessage: string, locale?: Locale | undefined);
6
+ }
7
+ export declare function environmentLocale(env: NodeJS.ProcessEnv): Locale;
8
+ /** Strip one language option from either side of the command before command validation. */
9
+ export declare function parseLanguage(input: readonly string[], env?: NodeJS.ProcessEnv): {
10
+ locale: Locale;
11
+ args: string[];
12
+ };
13
+ export declare function cliText(locale: Locale, key: MessageKey, params?: Record<string, string | number>): string;
14
+ //# sourceMappingURL=language.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"language.d.ts","sourceRoot":"","sources":["../../../src/cli/language.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,MAAM,EACX,KAAK,UAAU,EAChB,MAAM,mBAAmB,CAAA;AAE1B,qBAAa,aAAc,SAAQ,KAAK;IAEpC,QAAQ,CAAC,GAAG,EAAE,UAAU;IAExB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM;gBAFf,GAAG,EAAE,UAAU,EACxB,cAAc,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,MAAM,YAAA;CAI3B;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,MAAM,CAKhE;AAED,2FAA2F;AAC3F,wBAAgB,aAAa,CAC3B,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAA;CAAE,CAiCpC;AAED,wBAAgB,OAAO,CACrB,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,UAAU,EACf,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAM,GAC3C,MAAM,CAER"}
@@ -0,0 +1,10 @@
1
+ export interface ProfileTarget {
2
+ name: string;
3
+ dir: string;
4
+ home: string;
5
+ statePath: string;
6
+ socketPath: string;
7
+ }
8
+ /** `dsh plugin --profile NAME exec` runs pnpm in the selected profile directory. */
9
+ export declare function resolveProfileTarget(cwd?: string, env?: NodeJS.ProcessEnv): Promise<ProfileTarget>;
10
+ //# sourceMappingURL=profile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../../src/cli/profile.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;CACnB;AAeD,oFAAoF;AACpF,wBAAsB,oBAAoB,CACxC,GAAG,SAAgB,EACnB,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,OAAO,CAAC,aAAa,CAAC,CAyCxB"}
@@ -0,0 +1,20 @@
1
+ import type { ReadStream, WriteStream } from 'node:tty';
2
+ /** One terminal session; secret input is read in raw mode and never echoed. */
3
+ export declare class TerminalPrompt {
4
+ private readonly input;
5
+ private readonly output;
6
+ private readonly pending;
7
+ private wake;
8
+ private readonly decoder;
9
+ private readonly previousRaw;
10
+ private closed;
11
+ private ended;
12
+ private skipLf;
13
+ constructor(input?: ReadStream, output?: WriteStream);
14
+ private readonly onData;
15
+ private readonly onEnd;
16
+ private take;
17
+ ask(label: string, secret?: boolean, maxCharacters?: number): Promise<string>;
18
+ close(): void;
19
+ }
20
+ //# sourceMappingURL=prompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../../src/cli/prompt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAGvD,+EAA+E;AAC/E,qBAAa,cAAc;IAUvB,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAVzB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAe;IACvC,OAAO,CAAC,IAAI,CAA0B;IACtC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAoB;IAC5C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,KAAK,CAAQ;IACrB,OAAO,CAAC,MAAM,CAAQ;gBAGH,KAAK,GAAoB,UAAU,EACnC,MAAM,GAAqB,WAAW;IAczD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAItB;IAED,OAAO,CAAC,QAAQ,CAAC,KAAK,CAIrB;YAEa,IAAI;IAgBZ,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,UAAQ,EAAE,aAAa,SAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAuC9E,KAAK,IAAI,IAAI;CAUd"}
@@ -0,0 +1,27 @@
1
+ import type { Config as WebServerConfig } from '@deepseek-ai/dsh-host-webserver';
2
+ import z from '@deepseek-ai/schemastery';
3
+ import { type OriginPolicy } from './http/origin-policy.js';
4
+ export interface AuthConfig {
5
+ allowedOrigins?: string[];
6
+ requireTotp?: boolean;
7
+ sessionHours?: number;
8
+ preserveOriginPaths?: string[];
9
+ }
10
+ export interface ResolvedAuthConfig extends Omit<WebServerConfig, 'host'> {
11
+ host: string;
12
+ allowedOrigins: readonly string[];
13
+ originPolicy: OriginPolicy;
14
+ requireTotp: boolean;
15
+ sessionHours: number;
16
+ preserveOriginPaths: readonly string[];
17
+ }
18
+ export declare const DEFAULT_REQUIRE_TOTP = true;
19
+ export declare const DEFAULT_SESSION_HOURS = 168;
20
+ export declare const DEFAULT_WEB_HOST = "127.0.0.1";
21
+ export declare const DEFAULT_WEB_PORT = 3080;
22
+ export interface WebListenerConfig extends Omit<WebServerConfig, 'host'> {
23
+ host: string;
24
+ }
25
+ export declare const Config: z<AuthConfig>;
26
+ export declare function resolveAuthConfig(input: AuthConfig, listener: WebListenerConfig): ResolvedAuthConfig;
27
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,iCAAiC,CAAA;AAChF,OAAO,CAAC,MAAM,0BAA0B,CAAA;AAExC,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAE/E,MAAM,WAAW,UAAU;IACzB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;IACzB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAA;CAC/B;AAED,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC;IACvE,IAAI,EAAE,MAAM,CAAA;IACZ,cAAc,EAAE,SAAS,MAAM,EAAE,CAAA;IACjC,YAAY,EAAE,YAAY,CAAA;IAC1B,WAAW,EAAE,OAAO,CAAA;IACpB,YAAY,EAAE,MAAM,CAAA;IACpB,mBAAmB,EAAE,SAAS,MAAM,EAAE,CAAA;CACvC;AAED,eAAO,MAAM,oBAAoB,OAAO,CAAA;AACxC,eAAO,MAAM,qBAAqB,MAAM,CAAA;AACxC,eAAO,MAAM,gBAAgB,cAAc,CAAA;AAC3C,eAAO,MAAM,gBAAgB,OAAO,CAAA;AAQpC,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC;IACtE,IAAI,EAAE,MAAM,CAAA;CACb;AAID,eAAO,MAAM,MAAM,EAAE,CAAC,CAAC,UAAU,CAK/B,CAAA;AAEF,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,iBAAiB,GAC1B,kBAAkB,CA0CpB"}
@@ -0,0 +1,18 @@
1
+ import { AuthService } from '../auth/service.js';
2
+ /** Single-request local protocol. The state lock must already be held before start(). */
3
+ export declare class AdminSocket {
4
+ private readonly auth;
5
+ private readonly ready;
6
+ private readonly onUnavailable;
7
+ readonly path: string;
8
+ private server;
9
+ private inode;
10
+ private readonly sockets;
11
+ private readonly operations;
12
+ constructor(profileDir: string, auth: AuthService, ready: () => boolean, onUnavailable: () => void);
13
+ start(): Promise<void>;
14
+ private accept;
15
+ private respond;
16
+ dispose(): Promise<void>;
17
+ }
18
+ //# sourceMappingURL=admin-socket.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin-socket.d.ts","sourceRoot":"","sources":["../../../src/http/admin-socket.ts"],"names":[],"mappings":"AAIA,OAAO,EAAa,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAsD3D,yFAAyF;AACzF,qBAAa,WAAW;IASpB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAVhC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,OAAO,CAAC,MAAM,CAAoB;IAClC,OAAO,CAAC,KAAK,CAAoB;IACjC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAoB;IAC5C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA2B;gBAGpD,UAAU,EAAE,MAAM,EACD,IAAI,EAAE,WAAW,EACjB,KAAK,EAAE,MAAM,OAAO,EACpB,aAAa,EAAE,MAAM,IAAI;IAKtC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAkC5B,OAAO,CAAC,MAAM;YA2CA,OAAO;IA+Bf,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAmB/B"}
@@ -0,0 +1,21 @@
1
+ import type { ServerResponse } from 'node:http';
2
+ import type { Duplex } from 'node:stream';
3
+ import type { AuthState, SessionRecord } from '../storage/state.js';
4
+ import { AuthStateStore } from '../storage/store.js';
5
+ import { AuthService } from '../auth/service.js';
6
+ /** Long responses and upgraded sockets close before revocation commits report success. */
7
+ export declare class AuthConnections {
8
+ private readonly auth;
9
+ private readonly active;
10
+ private readonly unsubscribe;
11
+ constructor(store: AuthStateStore, auth: AuthService);
12
+ trackResponse(hash: string, session: SessionRecord, response: ServerResponse): void;
13
+ trackSocket(hash: string, session: SessionRecord, socket: Duplex): void;
14
+ private makeEntry;
15
+ private schedule;
16
+ private remove;
17
+ reconcile(state: AuthState): Promise<void>;
18
+ closeAll(): Promise<void>;
19
+ dispose(): Promise<void>;
20
+ }
21
+ //# sourceMappingURL=connections.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connections.d.ts","sourceRoot":"","sources":["../../../src/http/connections.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAC/C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAShD,0FAA0F;AAC1F,qBAAa,eAAe;IAMxB,OAAO,CAAC,QAAQ,CAAC,IAAI;IALvB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAqB;IAC5C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAY;gBAGtC,KAAK,EAAE,cAAc,EACJ,IAAI,EAAE,WAAW;IAKpC,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,cAAc,GAAG,IAAI;IAenF,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAcvE,OAAO,CAAC,SAAS;IAajB,OAAO,CAAC,QAAQ;IAahB,OAAO,CAAC,MAAM;IAKR,SAAS,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAsB1C,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAIzB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAI/B"}
@@ -0,0 +1,24 @@
1
+ import type { IncomingMessage, ServerResponse } from 'node:http';
2
+ import type { Duplex } from 'node:stream';
3
+ import type { DshReadiness } from '../adapters/dsh/readiness.js';
4
+ import type { WebGate } from '../adapters/dsh/webserver.js';
5
+ import { AuthService } from '../auth/service.js';
6
+ import type { ResolvedAuthConfig } from '../config.js';
7
+ import { AuthStateStore } from '../storage/store.js';
8
+ import { AuthConnections } from './connections.js';
9
+ /** Validates the public request before rewriting only the admitted business carrier. */
10
+ export declare class AuthGate implements WebGate {
11
+ private readonly serverPort;
12
+ private readonly config;
13
+ private readonly store;
14
+ private readonly auth;
15
+ private readonly readiness;
16
+ private readonly connections;
17
+ constructor(serverPort: () => number, config: ResolvedAuthConfig, store: AuthStateStore, auth: AuthService, readiness: DshReadiness, connections: AuthConnections);
18
+ ready(): boolean;
19
+ http(req: IncomingMessage, res: ServerResponse, next: () => Promise<void>): Promise<void>;
20
+ upgrade(req: IncomingMessage, socket: Duplex, _head: Buffer, next: () => Promise<void>): Promise<void>;
21
+ private hash;
22
+ private bridge;
23
+ }
24
+ //# sourceMappingURL=gate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gate.d.ts","sourceRoot":"","sources":["../../../src/http/gate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAEhD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAEtD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAgClD,wFAAwF;AACxF,qBAAa,QAAS,YAAW,OAAO;IAEpC,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,WAAW;gBALX,UAAU,EAAE,MAAM,MAAM,EACxB,MAAM,EAAE,kBAAkB,EAC1B,KAAK,EAAE,cAAc,EACrB,IAAI,EAAE,WAAW,EACjB,SAAS,EAAE,YAAY,EACvB,WAAW,EAAE,eAAe;IAG/C,KAAK,IAAI,OAAO;IAIV,IAAI,CAAC,GAAG,EAAE,eAAe,EAAE,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAiDzF,OAAO,CACX,GAAG,EAAE,eAAe,EACpB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GACxB,OAAO,CAAC,IAAI,CAAC;IAuBhB,OAAO,CAAC,IAAI;IAKZ,OAAO,CAAC,MAAM;CAWf"}
@@ -0,0 +1,35 @@
1
+ export type OriginProtocol = 'http:' | 'https:';
2
+ export interface RegisteredOrigin {
3
+ readonly origin: string;
4
+ readonly protocol: OriginProtocol;
5
+ readonly host: string;
6
+ readonly hostname: string;
7
+ readonly port: number;
8
+ readonly authorities: readonly string[];
9
+ }
10
+ export interface OriginPolicy {
11
+ readonly registeredOrigins: readonly RegisteredOrigin[];
12
+ matchAuthority(host: string): RegisteredOrigin | undefined;
13
+ }
14
+ export interface RawRequestHead {
15
+ readonly rawHeaders: readonly string[];
16
+ readonly method: string | undefined;
17
+ readonly target: string | undefined;
18
+ readonly upgrade?: boolean;
19
+ }
20
+ export interface RequestOriginContext {
21
+ readonly origin: string;
22
+ readonly protocol: OriginProtocol;
23
+ readonly authority: string;
24
+ readonly downstreamAuthority: string;
25
+ readonly hostname: string;
26
+ readonly pathname: string;
27
+ readonly returnPath: string;
28
+ readonly registered: boolean;
29
+ readonly mayWriteCookie: boolean;
30
+ }
31
+ /** Resolve an exact authority to a single configured protocol. No DNS or proxy headers are used. */
32
+ export declare function createOriginPolicy(origins: readonly string[]): OriginPolicy;
33
+ /** Validate the original request head before any Host, Origin or Cookie rewrite. */
34
+ export declare function evaluateRequestOrigin(policy: OriginPolicy, request: RawRequestHead): RequestOriginContext | null;
35
+ //# sourceMappingURL=origin-policy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"origin-policy.d.ts","sourceRoot":"","sources":["../../../src/http/origin-policy.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,QAAQ,CAAA;AAE/C,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAA;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAA;CACxC;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,iBAAiB,EAAE,SAAS,gBAAgB,EAAE,CAAA;IACvD,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS,CAAA;CAC3D;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAA;IACtC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;IACnC,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAC3B;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAA;IACjC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAA;IACpC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAA;IAC5B,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAA;CACjC;AA4ED,oGAAoG;AACpG,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,YAAY,CAgC3E;AAkDD,oFAAoF;AACpF,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,cAAc,GACtB,oBAAoB,GAAG,IAAI,CAwD7B"}
@@ -0,0 +1,5 @@
1
+ import type { IncomingMessage } from 'node:http';
2
+ export declare function preservePublicOrigin(pathname: string, prefixes: readonly string[]): boolean;
3
+ /** Remove only the official launch token on the root index entry. */
4
+ export declare function stripRootToken(req: IncomingMessage): void;
5
+ //# sourceMappingURL=origin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"origin.d.ts","sourceRoot":"","sources":["../../../src/http/origin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAEhD,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAI3F;AAED,qEAAqE;AACrE,wBAAgB,cAAc,CAAC,GAAG,EAAE,eAAe,GAAG,IAAI,CAMzD"}
@@ -0,0 +1,5 @@
1
+ import type { IncomingMessage } from 'node:http';
2
+ import type { RequestOriginContext } from './origin-policy.js';
3
+ export declare function setRequestContext(req: IncomingMessage, context: RequestOriginContext): void;
4
+ export declare function requireRequestContext(req: IncomingMessage): RequestOriginContext;
5
+ //# sourceMappingURL=request-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-context.d.ts","sourceRoot":"","sources":["../../../src/http/request-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAI9D,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,eAAe,EAAE,OAAO,EAAE,oBAAoB,GAAG,IAAI,CAG3F;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,eAAe,GAAG,oBAAoB,CAIhF"}
@@ -0,0 +1,15 @@
1
+ import type { IncomingMessage } from 'node:http';
2
+ import type { GuardedWebServer } from '../adapters/dsh/webserver.js';
3
+ import { AuthService } from '../auth/service.js';
4
+ export type RoutePermission = 'public' | 'session' | 'logout' | null;
5
+ export declare function routePermission(method: string | undefined, pathname: string): RoutePermission;
6
+ export declare function currentSessionToken(req: IncomingMessage): string | null;
7
+ /** Explicit path/method registry; no prefix grants anonymous access. */
8
+ export declare class AuthRoutes {
9
+ private readonly auth;
10
+ private readonly profileName;
11
+ constructor(auth: AuthService, profileName: string);
12
+ install(server: GuardedWebServer): void;
13
+ private handle;
14
+ }
15
+ //# sourceMappingURL=routes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../../src/http/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAkB,MAAM,WAAW,CAAA;AAEhE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAEpE,OAAO,EAAa,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAW3D,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,IAAI,CAAA;AAkBpE,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,eAAe,CAE7F;AAqGD,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,eAAe,GAAG,MAAM,GAAG,IAAI,CAEvE;AAuDD,wEAAwE;AACxE,qBAAa,UAAU;IAEnB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,WAAW;gBADX,IAAI,EAAE,WAAW,EACjB,WAAW,EAAE,MAAM;IAGtC,OAAO,CAAC,MAAM,EAAE,gBAAgB,GAAG,IAAI;YAUzB,MAAM;CAgNrB"}
@@ -0,0 +1,33 @@
1
+ /** Host entry: storage is preflighted before the guarded listener opens. */
2
+ import { Service, type Context } from '@deepseek-ai/cordis';
3
+ import { GuardedWebServer } from './adapters/dsh/webserver.js';
4
+ import { AuthService } from './auth/service.js';
5
+ import { type AuthConfig } from './config.js';
6
+ import { AuthStateStore } from './storage/store.js';
7
+ export type { AuthConfig } from './config.js';
8
+ export { Config, DEFAULT_REQUIRE_TOTP, DEFAULT_SESSION_HOURS } from './config.js';
9
+ export { resolveAuthConfig } from './config.js';
10
+ export { installAuthenticatedHostCapability } from './adapters/dsh/browser-capability.js';
11
+ export { GuardedWebServer, READY_PATH, READY_PROTOCOL_VERSION } from './adapters/dsh/webserver.js';
12
+ export { DshReadiness, watchConnection } from './adapters/dsh/readiness.js';
13
+ export { AuthService, AuthError } from './auth/service.js';
14
+ export type { AuthPolicy, AuthErrorCode, LoginResult } from './auth/service.js';
15
+ export { AuthStateStore } from './storage/store.js';
16
+ export { AuthGate } from './http/gate.js';
17
+ export { AuthConnections } from './http/connections.js';
18
+ export declare const name = "auth-remote";
19
+ export declare class AuthRemoteWebServer extends GuardedWebServer {
20
+ static Config: typeof GuardedWebServer.Config;
21
+ private stateStore;
22
+ private authService;
23
+ private readonly resolved;
24
+ private readonly switchGate;
25
+ constructor(ctx: Context, input: AuthConfig);
26
+ [Service.init](): Promise<void>;
27
+ get storage(): AuthStateStore;
28
+ get authentication(): AuthService;
29
+ /** Public authorities needed by native Connection for preserved routes. */
30
+ get connectionTrustedHosts(): readonly string[];
31
+ }
32
+ export default AuthRemoteWebServer;
33
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,OAAO,EAAE,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAM3D,OAAO,EAAY,gBAAgB,EAAc,MAAM,6BAA6B,CAAA;AACpF,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAKL,KAAK,UAAU,EAEhB,MAAM,aAAa,CAAA;AAKpB,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAEnD,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EAAE,MAAM,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,EAAE,kCAAkC,EAAE,MAAM,sCAAsC,CAAA;AACzF,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAClG,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAC3E,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC1D,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAEvD,eAAO,MAAM,IAAI,gBAAgB,CAAA;AAEjC,qBAAa,mBAAoB,SAAQ,gBAAgB;IACvD,OAAgB,MAAM,EAAwB,OAAO,gBAAgB,CAAC,MAAM,CAAA;IAC5E,OAAO,CAAC,UAAU,CAA4B;IAC9C,OAAO,CAAC,WAAW,CAAyB;IAC5C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAoB;IAC7C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAY;gBAE3B,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU;IAgB5B,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC;IA8E9C,IAAI,OAAO,IAAI,cAAc,CAG5B;IAED,IAAI,cAAc,IAAI,WAAW,CAGhC;IAED,2EAA2E;IAC3E,IAAI,sBAAsB,IAAI,SAAS,MAAM,EAAE,CAG9C;CACF;AAED,eAAe,mBAAmB,CAAA"}
@@ -0,0 +1,40 @@
1
+ export declare const ADMIN_PROTOCOL_VERSION = 1;
2
+ export declare const ADMIN_MAX_BYTES: number;
3
+ export type AdminRequest = {
4
+ version: 1;
5
+ command: 'status';
6
+ } | {
7
+ version: 1;
8
+ command: 'init';
9
+ username: string;
10
+ password: string;
11
+ } | {
12
+ version: 1;
13
+ command: 'reset-password';
14
+ password: string;
15
+ } | {
16
+ version: 1;
17
+ command: 'reset-totp';
18
+ } | {
19
+ version: 1;
20
+ command: 'revoke-sessions';
21
+ };
22
+ export interface AdminStatus {
23
+ initialized: boolean;
24
+ totpEnabled: boolean;
25
+ activeSessions: number;
26
+ online: boolean;
27
+ ready: boolean;
28
+ }
29
+ export type AdminResponse = {
30
+ version: 1;
31
+ ok: true;
32
+ result: AdminStatus | {
33
+ ok: true;
34
+ };
35
+ } | {
36
+ version: 1;
37
+ ok: false;
38
+ error: string;
39
+ };
40
+ //# sourceMappingURL=admin-contract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin-contract.d.ts","sourceRoot":"","sources":["../../../src/shared/admin-contract.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,IAAI,CAAA;AACvC,eAAO,MAAM,eAAe,QAAY,CAAA;AAExC,MAAM,MAAM,YAAY,GACpB;IAAE,OAAO,EAAE,CAAC,CAAC;IAAC,OAAO,EAAE,QAAQ,CAAA;CAAE,GACjC;IAAE,OAAO,EAAE,CAAC,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GACnE;IAAE,OAAO,EAAE,CAAC,CAAC;IAAC,OAAO,EAAE,gBAAgB,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAC3D;IAAE,OAAO,EAAE,CAAC,CAAC;IAAC,OAAO,EAAE,YAAY,CAAA;CAAE,GACrC;IAAE,OAAO,EAAE,CAAC,CAAC;IAAC,OAAO,EAAE,iBAAiB,CAAA;CAAE,CAAA;AAE9C,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE,OAAO,CAAA;IACpB,WAAW,EAAE,OAAO,CAAA;IACpB,cAAc,EAAE,MAAM,CAAA;IACtB,MAAM,EAAE,OAAO,CAAA;IACf,KAAK,EAAE,OAAO,CAAA;CACf;AAED,MAAM,MAAM,aAAa,GACrB;IAAE,OAAO,EAAE,CAAC,CAAC;IAAC,EAAE,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,WAAW,GAAG;QAAE,EAAE,EAAE,IAAI,CAAA;KAAE,CAAA;CAAE,GAC5D;IAAE,OAAO,EAAE,CAAC,CAAC;IAAC,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA"}
@@ -0,0 +1,33 @@
1
+ export declare const AUTH_BASE = "/auth-remote";
2
+ export declare const AUTH_COOKIE = "dsh_auth_remote";
3
+ export interface PublicStateResponse {
4
+ initialized: boolean;
5
+ requireTotp: boolean;
6
+ profileName: string;
7
+ }
8
+ export interface MeResponse {
9
+ username: string;
10
+ totpEnabled: boolean;
11
+ requireTotp: boolean;
12
+ expiresAt: number;
13
+ }
14
+ export interface AuthErrorResponse {
15
+ error: string;
16
+ retryAfter?: number;
17
+ }
18
+ export type LoginResponse = {
19
+ kind: 'session';
20
+ expiresAt: number;
21
+ } | {
22
+ kind: 'mfa';
23
+ challenge: string;
24
+ expiresAt: number;
25
+ } | {
26
+ kind: 'binding';
27
+ challenge: string;
28
+ expiresAt: number;
29
+ };
30
+ export interface BindingResponse {
31
+ backupCodes: string[];
32
+ }
33
+ //# sourceMappingURL=auth-contract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-contract.d.ts","sourceRoot":"","sources":["../../../src/shared/auth-contract.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,iBAAiB,CAAA;AACvC,eAAO,MAAM,WAAW,oBAAoB,CAAA;AAE5C,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,OAAO,CAAA;IACpB,WAAW,EAAE,OAAO,CAAA;IACpB,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,OAAO,CAAA;IACpB,WAAW,EAAE,OAAO,CAAA;IACpB,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GACtC;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GACrD;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAA;AAE7D,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,MAAM,EAAE,CAAA;CACtB"}