wolfronix-sdk 2.3.0 → 2.4.1

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.
@@ -0,0 +1,33 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropNames = Object.getOwnPropertyNames;
3
+ var __typeError = (msg) => {
4
+ throw TypeError(msg);
5
+ };
6
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
8
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
9
+ }) : x)(function(x) {
10
+ if (typeof require !== "undefined") return require.apply(this, arguments);
11
+ throw Error('Dynamic require of "' + x + '" is not supported');
12
+ });
13
+ var __commonJS = (cb, mod) => function __require2() {
14
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
15
+ };
16
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
17
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
18
+ var __privateIn = (member, obj) => Object(obj) !== obj ? __typeError('Cannot use the "in" operator on this value') : member.has(obj);
19
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
20
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
21
+ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
22
+ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
23
+
24
+ export {
25
+ __require,
26
+ __commonJS,
27
+ __publicField,
28
+ __privateIn,
29
+ __privateGet,
30
+ __privateAdd,
31
+ __privateSet,
32
+ __privateMethod
33
+ };
package/dist/index.d.mts CHANGED
@@ -3,7 +3,7 @@
3
3
  * Zero-knowledge encryption made simple
4
4
  *
5
5
  * @package @wolfronix/sdk
6
- * @version 2.3.0
6
+ * @version 2.4.0
7
7
  */
8
8
  interface WolfronixConfig {
9
9
  /** Wolfronix server base URL */
@@ -30,6 +30,14 @@ interface EncryptResponse {
30
30
  file_id: string;
31
31
  file_size: number;
32
32
  enc_time_ms: number;
33
+ /** Detailed timing breakdown from server */
34
+ upload_ms?: number;
35
+ read_ms?: number;
36
+ encrypt_ms?: number;
37
+ store_ms?: number;
38
+ total_ms?: number;
39
+ /** Any extra fields from the server response */
40
+ [key: string]: unknown;
33
41
  }
34
42
  interface FileInfo {
35
43
  file_id: string;
@@ -108,6 +116,72 @@ interface StreamChunk {
108
116
  data: string;
109
117
  seq: number;
110
118
  }
119
+ /** Supported managed connector database types */
120
+ type DBType = 'supabase' | 'mongodb' | 'mysql' | 'firebase' | 'postgresql' | 'custom_api';
121
+ interface WolfronixAdminConfig {
122
+ /** Wolfronix server base URL */
123
+ baseUrl: string;
124
+ /** Admin API key (X-Admin-Key header) */
125
+ adminKey: string;
126
+ /** Request timeout in milliseconds (default: 30000) */
127
+ timeout?: number;
128
+ /** Skip SSL verification for self-signed certs (default: false) */
129
+ insecure?: boolean;
130
+ }
131
+ interface EnterpriseClient {
132
+ id: number;
133
+ client_id: string;
134
+ client_name: string;
135
+ api_endpoint: string;
136
+ api_key: string;
137
+ wolfronix_key: string;
138
+ db_type: DBType;
139
+ db_config: string;
140
+ user_count: number;
141
+ is_active: boolean;
142
+ created_at: string;
143
+ updated_at: string;
144
+ }
145
+ interface RegisterClientRequest {
146
+ /** Unique client identifier */
147
+ client_id: string;
148
+ /** Human-readable client name */
149
+ client_name: string;
150
+ /** Database type — managed connector or custom_api */
151
+ db_type: DBType;
152
+ /** JSON string with database credentials (required for managed connectors) */
153
+ db_config?: string;
154
+ /** Client's storage API URL (required only for custom_api) */
155
+ api_endpoint?: string;
156
+ /** API key for client's custom API (optional) */
157
+ api_key?: string;
158
+ }
159
+ interface RegisterClientResponse {
160
+ status: string;
161
+ client_id: string;
162
+ wolfronix_key: string;
163
+ db_type: DBType;
164
+ message: string;
165
+ connector?: string;
166
+ api_endpoint?: string;
167
+ }
168
+ interface ListClientsResponse {
169
+ clients: EnterpriseClient[] | null;
170
+ count: number;
171
+ }
172
+ interface UpdateClientRequest {
173
+ api_endpoint?: string;
174
+ db_type?: DBType;
175
+ db_config?: string;
176
+ }
177
+ interface UpdateClientResponse {
178
+ status: string;
179
+ message: string;
180
+ }
181
+ interface DeactivateClientResponse {
182
+ status: string;
183
+ message: string;
184
+ }
111
185
  declare class WolfronixError extends Error {
112
186
  readonly code: string;
113
187
  readonly statusCode?: number;
@@ -480,5 +554,65 @@ declare class WolfronixStream {
480
554
  * ```
481
555
  */
482
556
  declare function createClient(config: WolfronixConfig | string): Wolfronix;
557
+ /**
558
+ * Admin client for managing enterprise clients.
559
+ * Uses X-Admin-Key authentication (not user auth).
560
+ *
561
+ * @example
562
+ * ```typescript
563
+ * import { WolfronixAdmin } from '@wolfronix/sdk';
564
+ *
565
+ * const admin = new WolfronixAdmin({
566
+ * baseUrl: 'https://wolfronix-server:9443',
567
+ * adminKey: 'your-admin-api-key'
568
+ * });
569
+ *
570
+ * // Register a client with managed Supabase connector
571
+ * const result = await admin.registerClient({
572
+ * client_id: 'acme_corp',
573
+ * client_name: 'Acme Corporation',
574
+ * db_type: 'supabase',
575
+ * db_config: JSON.stringify({
576
+ * supabase_url: 'https://xxx.supabase.co',
577
+ * supabase_service_key: 'eyJ...'
578
+ * })
579
+ * });
580
+ * console.log('Wolfronix key:', result.wolfronix_key);
581
+ * ```
582
+ */
583
+ declare class WolfronixAdmin {
584
+ private readonly baseUrl;
585
+ private readonly adminKey;
586
+ private readonly timeout;
587
+ private readonly insecure;
588
+ constructor(config: WolfronixAdminConfig);
589
+ private request;
590
+ /**
591
+ * Register a new enterprise client.
592
+ * For managed connectors (supabase, mongodb, mysql, firebase, postgresql),
593
+ * provide db_type + db_config. For custom APIs, use db_type: 'custom_api' + api_endpoint.
594
+ */
595
+ registerClient(params: RegisterClientRequest): Promise<RegisterClientResponse>;
596
+ /**
597
+ * List all registered enterprise clients.
598
+ */
599
+ listClients(): Promise<ListClientsResponse>;
600
+ /**
601
+ * Get details for a specific client.
602
+ */
603
+ getClient(clientId: string): Promise<EnterpriseClient>;
604
+ /**
605
+ * Update a client's configuration (api_endpoint, db_type, db_config).
606
+ */
607
+ updateClient(clientId: string, params: UpdateClientRequest): Promise<UpdateClientResponse>;
608
+ /**
609
+ * Deactivate (soft-delete) a client. Their wolfronix_key will stop working.
610
+ */
611
+ deactivateClient(clientId: string): Promise<DeactivateClientResponse>;
612
+ /**
613
+ * Check server health.
614
+ */
615
+ healthCheck(): Promise<boolean>;
616
+ }
483
617
 
484
- export { type AuthResponse, AuthenticationError, type DeleteResponse, type EncryptMessagePacket, type EncryptResponse, type FileInfo, FileNotFoundError, type KeyPartResponse, type ListFilesResponse, type MetricsResponse, NetworkError, PermissionDeniedError, type ServerBatchEncryptResult, type ServerDecryptParams, type ServerEncryptResult, type StreamChunk, type StreamSession, ValidationError, Wolfronix, type WolfronixConfig, WolfronixError, WolfronixStream, createClient, Wolfronix as default };
618
+ export { type AuthResponse, AuthenticationError, type DBType, type DeactivateClientResponse, type DeleteResponse, type EncryptMessagePacket, type EncryptResponse, type EnterpriseClient, type FileInfo, FileNotFoundError, type KeyPartResponse, type ListClientsResponse, type ListFilesResponse, type MetricsResponse, NetworkError, PermissionDeniedError, type RegisterClientRequest, type RegisterClientResponse, type ServerBatchEncryptResult, type ServerDecryptParams, type ServerEncryptResult, type StreamChunk, type StreamSession, type UpdateClientRequest, type UpdateClientResponse, ValidationError, Wolfronix, WolfronixAdmin, type WolfronixAdminConfig, type WolfronixConfig, WolfronixError, WolfronixStream, createClient, Wolfronix as default };
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  * Zero-knowledge encryption made simple
4
4
  *
5
5
  * @package @wolfronix/sdk
6
- * @version 2.3.0
6
+ * @version 2.4.0
7
7
  */
8
8
  interface WolfronixConfig {
9
9
  /** Wolfronix server base URL */
@@ -30,6 +30,14 @@ interface EncryptResponse {
30
30
  file_id: string;
31
31
  file_size: number;
32
32
  enc_time_ms: number;
33
+ /** Detailed timing breakdown from server */
34
+ upload_ms?: number;
35
+ read_ms?: number;
36
+ encrypt_ms?: number;
37
+ store_ms?: number;
38
+ total_ms?: number;
39
+ /** Any extra fields from the server response */
40
+ [key: string]: unknown;
33
41
  }
34
42
  interface FileInfo {
35
43
  file_id: string;
@@ -108,6 +116,72 @@ interface StreamChunk {
108
116
  data: string;
109
117
  seq: number;
110
118
  }
119
+ /** Supported managed connector database types */
120
+ type DBType = 'supabase' | 'mongodb' | 'mysql' | 'firebase' | 'postgresql' | 'custom_api';
121
+ interface WolfronixAdminConfig {
122
+ /** Wolfronix server base URL */
123
+ baseUrl: string;
124
+ /** Admin API key (X-Admin-Key header) */
125
+ adminKey: string;
126
+ /** Request timeout in milliseconds (default: 30000) */
127
+ timeout?: number;
128
+ /** Skip SSL verification for self-signed certs (default: false) */
129
+ insecure?: boolean;
130
+ }
131
+ interface EnterpriseClient {
132
+ id: number;
133
+ client_id: string;
134
+ client_name: string;
135
+ api_endpoint: string;
136
+ api_key: string;
137
+ wolfronix_key: string;
138
+ db_type: DBType;
139
+ db_config: string;
140
+ user_count: number;
141
+ is_active: boolean;
142
+ created_at: string;
143
+ updated_at: string;
144
+ }
145
+ interface RegisterClientRequest {
146
+ /** Unique client identifier */
147
+ client_id: string;
148
+ /** Human-readable client name */
149
+ client_name: string;
150
+ /** Database type — managed connector or custom_api */
151
+ db_type: DBType;
152
+ /** JSON string with database credentials (required for managed connectors) */
153
+ db_config?: string;
154
+ /** Client's storage API URL (required only for custom_api) */
155
+ api_endpoint?: string;
156
+ /** API key for client's custom API (optional) */
157
+ api_key?: string;
158
+ }
159
+ interface RegisterClientResponse {
160
+ status: string;
161
+ client_id: string;
162
+ wolfronix_key: string;
163
+ db_type: DBType;
164
+ message: string;
165
+ connector?: string;
166
+ api_endpoint?: string;
167
+ }
168
+ interface ListClientsResponse {
169
+ clients: EnterpriseClient[] | null;
170
+ count: number;
171
+ }
172
+ interface UpdateClientRequest {
173
+ api_endpoint?: string;
174
+ db_type?: DBType;
175
+ db_config?: string;
176
+ }
177
+ interface UpdateClientResponse {
178
+ status: string;
179
+ message: string;
180
+ }
181
+ interface DeactivateClientResponse {
182
+ status: string;
183
+ message: string;
184
+ }
111
185
  declare class WolfronixError extends Error {
112
186
  readonly code: string;
113
187
  readonly statusCode?: number;
@@ -480,5 +554,65 @@ declare class WolfronixStream {
480
554
  * ```
481
555
  */
482
556
  declare function createClient(config: WolfronixConfig | string): Wolfronix;
557
+ /**
558
+ * Admin client for managing enterprise clients.
559
+ * Uses X-Admin-Key authentication (not user auth).
560
+ *
561
+ * @example
562
+ * ```typescript
563
+ * import { WolfronixAdmin } from '@wolfronix/sdk';
564
+ *
565
+ * const admin = new WolfronixAdmin({
566
+ * baseUrl: 'https://wolfronix-server:9443',
567
+ * adminKey: 'your-admin-api-key'
568
+ * });
569
+ *
570
+ * // Register a client with managed Supabase connector
571
+ * const result = await admin.registerClient({
572
+ * client_id: 'acme_corp',
573
+ * client_name: 'Acme Corporation',
574
+ * db_type: 'supabase',
575
+ * db_config: JSON.stringify({
576
+ * supabase_url: 'https://xxx.supabase.co',
577
+ * supabase_service_key: 'eyJ...'
578
+ * })
579
+ * });
580
+ * console.log('Wolfronix key:', result.wolfronix_key);
581
+ * ```
582
+ */
583
+ declare class WolfronixAdmin {
584
+ private readonly baseUrl;
585
+ private readonly adminKey;
586
+ private readonly timeout;
587
+ private readonly insecure;
588
+ constructor(config: WolfronixAdminConfig);
589
+ private request;
590
+ /**
591
+ * Register a new enterprise client.
592
+ * For managed connectors (supabase, mongodb, mysql, firebase, postgresql),
593
+ * provide db_type + db_config. For custom APIs, use db_type: 'custom_api' + api_endpoint.
594
+ */
595
+ registerClient(params: RegisterClientRequest): Promise<RegisterClientResponse>;
596
+ /**
597
+ * List all registered enterprise clients.
598
+ */
599
+ listClients(): Promise<ListClientsResponse>;
600
+ /**
601
+ * Get details for a specific client.
602
+ */
603
+ getClient(clientId: string): Promise<EnterpriseClient>;
604
+ /**
605
+ * Update a client's configuration (api_endpoint, db_type, db_config).
606
+ */
607
+ updateClient(clientId: string, params: UpdateClientRequest): Promise<UpdateClientResponse>;
608
+ /**
609
+ * Deactivate (soft-delete) a client. Their wolfronix_key will stop working.
610
+ */
611
+ deactivateClient(clientId: string): Promise<DeactivateClientResponse>;
612
+ /**
613
+ * Check server health.
614
+ */
615
+ healthCheck(): Promise<boolean>;
616
+ }
483
617
 
484
- export { type AuthResponse, AuthenticationError, type DeleteResponse, type EncryptMessagePacket, type EncryptResponse, type FileInfo, FileNotFoundError, type KeyPartResponse, type ListFilesResponse, type MetricsResponse, NetworkError, PermissionDeniedError, type ServerBatchEncryptResult, type ServerDecryptParams, type ServerEncryptResult, type StreamChunk, type StreamSession, ValidationError, Wolfronix, type WolfronixConfig, WolfronixError, WolfronixStream, createClient, Wolfronix as default };
618
+ export { type AuthResponse, AuthenticationError, type DBType, type DeactivateClientResponse, type DeleteResponse, type EncryptMessagePacket, type EncryptResponse, type EnterpriseClient, type FileInfo, FileNotFoundError, type KeyPartResponse, type ListClientsResponse, type ListFilesResponse, type MetricsResponse, NetworkError, PermissionDeniedError, type RegisterClientRequest, type RegisterClientResponse, type ServerBatchEncryptResult, type ServerDecryptParams, type ServerEncryptResult, type StreamChunk, type StreamSession, type UpdateClientRequest, type UpdateClientResponse, ValidationError, Wolfronix, WolfronixAdmin, type WolfronixAdminConfig, type WolfronixConfig, WolfronixError, WolfronixStream, createClient, Wolfronix as default };