@solongate/proxy 0.81.37 → 0.81.38

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.
@@ -14,6 +14,14 @@ export declare function listAccounts(): SavedAccount[];
14
14
  /** Upsert an account (dedupe by apiKey). Called from `login`. */
15
15
  export declare function saveAccount(acc: SavedAccount): void;
16
16
  export declare function setViewCredentials(creds: Credentials | null): void;
17
+ /** True when the given key is the ACTIVE one the guard hooks use. */
18
+ export declare function isActiveAccount(apiKey: string): boolean;
19
+ /**
20
+ * Make an account the ACTIVE one the guard hooks read (writes the active-key
21
+ * file). Used when a dataroom login should also become this device's enforcing
22
+ * account. Best-effort; returns false on failure.
23
+ */
24
+ export declare function setActiveAccount(creds: Credentials): boolean;
17
25
  /**
18
26
  * Thrown for any non-2xx response. `code`/`message` come from the API's
19
27
  * `{ error: { code, message } }` envelope when present; `status` is the HTTP
@@ -0,0 +1,16 @@
1
+ export interface DeviceStart {
2
+ deviceCode: string;
3
+ verifyUrl: string;
4
+ intervalMs: number;
5
+ expiresAt: number;
6
+ }
7
+ export interface DevicePoll {
8
+ status: 'pending' | 'approved' | 'expired' | 'not_found';
9
+ apiKey?: string;
10
+ project?: string;
11
+ user?: string;
12
+ }
13
+ /** Best-effort browser open. No-op on failure (headless / missing opener). */
14
+ export declare function openBrowser(url: string): void;
15
+ export declare function startDeviceLogin(apiUrl?: string): Promise<DeviceStart>;
16
+ export declare function pollDeviceLogin(apiUrl: string, deviceCode: string): Promise<DevicePoll>;
@@ -4,6 +4,7 @@
4
4
  */
5
5
  export * from './client.js';
6
6
  export * from './types.js';
7
+ export * from './device-login.js';
7
8
  import * as policies from './policies.js';
8
9
  import * as settings from './settings.js';
9
10
  import * as stats from './stats.js';
@@ -139,6 +139,9 @@ async function request(method, path, opts = {}) {
139
139
  return json;
140
140
  }
141
141
 
142
+ // src/api-client/device-login.ts
143
+ import { spawn } from "child_process";
144
+
142
145
  // src/api-client/policies.ts
143
146
  var policies_exports = {};
144
147
  __export(policies_exports, {