@haex-space/vault-sdk 2.5.109 → 2.5.110
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/{client-C3UTSqYM.d.mts → client-8dlKVNDZ.d.ts} +183 -2
- package/dist/{client-CRWI0t-2.d.ts → client-DFGx115H.d.mts} +183 -2
- package/dist/index.d.mts +52 -5
- package/dist/index.d.ts +52 -5
- package/dist/index.js +28 -26
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -26
- package/dist/index.mjs.map +1 -1
- package/dist/node.d.mts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/react.d.mts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.js.map +1 -1
- package/dist/react.mjs.map +1 -1
- package/dist/runtime/nuxt.plugin.client.d.mts +2 -2
- package/dist/runtime/nuxt.plugin.client.d.ts +2 -2
- package/dist/runtime/nuxt.plugin.client.js.map +1 -1
- package/dist/runtime/nuxt.plugin.client.mjs.map +1 -1
- package/dist/svelte.d.mts +2 -2
- package/dist/svelte.d.ts +2 -2
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs.map +1 -1
- package/dist/{types-DwLhX7mx.d.mts → types-gfc9eCL4.d.mts} +1 -227
- package/dist/{types-DwLhX7mx.d.ts → types-gfc9eCL4.d.ts} +1 -227
- package/dist/vue.d.mts +2 -2
- package/dist/vue.d.ts +2 -2
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,187 @@
|
|
|
1
|
-
import { D as DatabaseQueryResult, M as Migration,
|
|
1
|
+
import { b as HaexHubEvent, c as EXTERNAL_EVENTS, D as DatabaseQueryResult, M as Migration, d as MigrationResult, W as WebRequestOptions, e as WebResponse, H as HaexHubConfig, a as ExtensionInfo, A as ApplicationContext, f as DatabasePermissionRequest, P as PermissionResponse, S as SearchResult, g as EventCallback } from './types-gfc9eCL4.js';
|
|
2
2
|
import { SqliteRemoteDatabase } from 'drizzle-orm/sqlite-proxy';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* External request from an authorized client (browser extension, CLI, server, etc.)
|
|
6
|
+
* These requests come through the WebSocket bridge and are routed to the appropriate extension.
|
|
7
|
+
*/
|
|
8
|
+
interface ExternalRequestEvent extends HaexHubEvent {
|
|
9
|
+
type: typeof EXTERNAL_EVENTS.REQUEST;
|
|
10
|
+
data: ExternalRequest;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* External request payload
|
|
14
|
+
*/
|
|
15
|
+
interface ExternalRequest {
|
|
16
|
+
/** Unique request ID for response correlation */
|
|
17
|
+
requestId: string;
|
|
18
|
+
/** Client's public key (Base64 SPKI format, used as identifier) */
|
|
19
|
+
publicKey: string;
|
|
20
|
+
/** Action/method to perform (extension-specific) */
|
|
21
|
+
action: string;
|
|
22
|
+
/** Request payload (extension-specific) */
|
|
23
|
+
payload: Record<string, unknown>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* External request payload from Tauri event (includes extension target info).
|
|
27
|
+
* This is sent from Rust when an external client makes a request.
|
|
28
|
+
*/
|
|
29
|
+
interface ExternalRequestPayload extends ExternalRequest {
|
|
30
|
+
/** Target extension's public key */
|
|
31
|
+
extensionPublicKey: string;
|
|
32
|
+
/** Target extension's name */
|
|
33
|
+
extensionName: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* External request response (sent back to the client)
|
|
37
|
+
*/
|
|
38
|
+
interface ExternalResponse {
|
|
39
|
+
/** Request ID for correlation */
|
|
40
|
+
requestId: string;
|
|
41
|
+
/** Whether the request was successful */
|
|
42
|
+
success: boolean;
|
|
43
|
+
/** Response data (if successful) */
|
|
44
|
+
data?: unknown;
|
|
45
|
+
/** Error message (if failed) */
|
|
46
|
+
error?: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Handler function type for external requests
|
|
50
|
+
*/
|
|
51
|
+
type ExternalRequestHandler = (request: ExternalRequest) => Promise<ExternalResponse> | ExternalResponse;
|
|
52
|
+
/**
|
|
53
|
+
* An authorized external client stored in the database
|
|
54
|
+
*/
|
|
55
|
+
interface AuthorizedClient {
|
|
56
|
+
/** Row ID */
|
|
57
|
+
id: string;
|
|
58
|
+
/** Unique client identifier (public key fingerprint) */
|
|
59
|
+
clientId: string;
|
|
60
|
+
/** Human-readable client name */
|
|
61
|
+
clientName: string;
|
|
62
|
+
/** Client's public key (base64) */
|
|
63
|
+
publicKey: string;
|
|
64
|
+
/** Extension ID this client can access */
|
|
65
|
+
extensionId: string;
|
|
66
|
+
/** When the client was authorized (ISO 8601) */
|
|
67
|
+
authorizedAt: string | null;
|
|
68
|
+
/** Last time the client connected (ISO 8601) */
|
|
69
|
+
lastSeen: string | null;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* A blocked external client stored in the database
|
|
73
|
+
*/
|
|
74
|
+
interface BlockedClient {
|
|
75
|
+
/** Row ID */
|
|
76
|
+
id: string;
|
|
77
|
+
/** Unique client identifier (public key fingerprint) */
|
|
78
|
+
clientId: string;
|
|
79
|
+
/** Human-readable client name */
|
|
80
|
+
clientName: string;
|
|
81
|
+
/** Client's public key (base64) */
|
|
82
|
+
publicKey: string;
|
|
83
|
+
/** When the client was blocked (ISO 8601) */
|
|
84
|
+
blockedAt: string | null;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Extension requested by an external client
|
|
88
|
+
*/
|
|
89
|
+
interface RequestedExtension {
|
|
90
|
+
/** Extension name (e.g., "haex-pass") */
|
|
91
|
+
name: string;
|
|
92
|
+
/** Extension's public key (hex string from manifest) */
|
|
93
|
+
extensionPublicKey: string;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Pending authorization request waiting for user approval
|
|
97
|
+
*/
|
|
98
|
+
interface PendingAuthorization {
|
|
99
|
+
/** Unique client identifier */
|
|
100
|
+
clientId: string;
|
|
101
|
+
/** Human-readable client name */
|
|
102
|
+
clientName: string;
|
|
103
|
+
/** Client's public key (base64) */
|
|
104
|
+
publicKey: string;
|
|
105
|
+
/** Extensions the client wants to access (pre-selected in authorization dialog) */
|
|
106
|
+
requestedExtensions: RequestedExtension[];
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Decision type for external authorization prompts
|
|
110
|
+
*/
|
|
111
|
+
type ExternalAuthDecision = 'allow' | 'deny';
|
|
112
|
+
/**
|
|
113
|
+
* Session-based authorization entry (for "allow once" authorizations)
|
|
114
|
+
* These are stored in-memory and cleared when haex-vault restarts.
|
|
115
|
+
*/
|
|
116
|
+
interface SessionAuthorization {
|
|
117
|
+
/** Unique client identifier (public key fingerprint) */
|
|
118
|
+
clientId: string;
|
|
119
|
+
/** Extension ID this client can access */
|
|
120
|
+
extensionId: string;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Connection state for external clients connecting to haex-vault via WebSocket.
|
|
124
|
+
* Used by browser extensions, CLI tools, servers, and other external clients.
|
|
125
|
+
*/
|
|
126
|
+
declare enum ExternalConnectionState {
|
|
127
|
+
/** Not connected to haex-vault */
|
|
128
|
+
DISCONNECTED = "disconnected",
|
|
129
|
+
/** Attempting to establish connection */
|
|
130
|
+
CONNECTING = "connecting",
|
|
131
|
+
/** WebSocket connected but not yet authorized */
|
|
132
|
+
CONNECTED = "connected",
|
|
133
|
+
/** Connected and waiting for user approval in haex-vault */
|
|
134
|
+
PENDING_APPROVAL = "pending_approval",
|
|
135
|
+
/** Connected and authorized to communicate */
|
|
136
|
+
PAIRED = "paired"
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Error codes for external client connections.
|
|
140
|
+
* Used to identify specific error conditions for i18n in the frontend.
|
|
141
|
+
*/
|
|
142
|
+
declare enum ExternalConnectionErrorCode {
|
|
143
|
+
/** No error */
|
|
144
|
+
NONE = "none",
|
|
145
|
+
/** Client is not authorized (rejected or not yet approved) */
|
|
146
|
+
CLIENT_NOT_AUTHORIZED = "client_not_authorized",
|
|
147
|
+
/** Client was blocked by the user */
|
|
148
|
+
CLIENT_BLOCKED = "client_blocked",
|
|
149
|
+
/** Connection to haex-vault failed (not running or network error) */
|
|
150
|
+
CONNECTION_FAILED = "connection_failed",
|
|
151
|
+
/** Connection timed out */
|
|
152
|
+
CONNECTION_TIMEOUT = "connection_timeout",
|
|
153
|
+
/** WebSocket connection was closed unexpectedly */
|
|
154
|
+
CONNECTION_CLOSED = "connection_closed",
|
|
155
|
+
/** Failed to decrypt message (invalid key or corrupted data) */
|
|
156
|
+
DECRYPTION_FAILED = "decryption_failed",
|
|
157
|
+
/** Invalid message format received */
|
|
158
|
+
INVALID_MESSAGE = "invalid_message",
|
|
159
|
+
/** Unknown or unspecified error */
|
|
160
|
+
UNKNOWN = "unknown"
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Full connection status including state, client ID, and any error
|
|
164
|
+
*/
|
|
165
|
+
interface ExternalConnection {
|
|
166
|
+
/** Current connection state */
|
|
167
|
+
state: ExternalConnectionState;
|
|
168
|
+
/** Client identifier (derived from public key) */
|
|
169
|
+
clientId: string | null;
|
|
170
|
+
/** Error code for i18n (use this for translations) */
|
|
171
|
+
errorCode: ExternalConnectionErrorCode;
|
|
172
|
+
/** Error message (original message, for logging/debugging) */
|
|
173
|
+
errorMessage: string | null;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Check if external client connection state indicates an active connection
|
|
177
|
+
* (connected, pending approval, or paired)
|
|
178
|
+
*/
|
|
179
|
+
declare function isExternalClientConnected(state: ExternalConnectionState): boolean;
|
|
180
|
+
/**
|
|
181
|
+
* Check if external client can send requests (only when paired/authorized)
|
|
182
|
+
*/
|
|
183
|
+
declare function canExternalClientSendRequests(state: ExternalConnectionState): boolean;
|
|
184
|
+
|
|
4
185
|
declare class StorageAPI {
|
|
5
186
|
private client;
|
|
6
187
|
constructor(client: HaexVaultSdk);
|
|
@@ -833,4 +1014,4 @@ declare class HaexVaultSdk {
|
|
|
833
1014
|
private log;
|
|
834
1015
|
}
|
|
835
1016
|
|
|
836
|
-
export { type
|
|
1017
|
+
export { type AuthorizedClient as A, type BlockedClient as B, type SelectFolderOptions as C, DatabaseAPI as D, type ExternalAuthDecision as E, type FileStat as F, type ServerInfo as G, HaexVaultSdk as H, type ServerStatus as I, type SessionAuthorization as J, type TransferProgress as K, LOCALSEND_EVENTS as L, type TransferState as M, canExternalClientSendRequests as N, isExternalClientConnected as O, type PendingAuthorization as P, RemoteStorageAPI as R, StorageAPI as S, type TransferDirection as T, type UpdateBackendRequest as U, WebAPI as W, type Device as a, type DeviceInfo as b, type DeviceType as c, type DirEntry as d, type ExternalConnection as e, ExternalConnectionErrorCode as f, ExternalConnectionState as g, type ExternalRequest as h, type ExternalRequestEvent as i, type ExternalRequestHandler as j, type ExternalRequestPayload as k, type ExternalResponse as l, FilesystemAPI as m, LocalSendAPI as n, type LocalSendEvent as o, type FileInfo as p, type LocalSendSettings as q, type PendingTransfer as r, PermissionsAPI as s, type AddBackendRequest as t, type S3Config as u, type S3PublicConfig as v, type StorageBackendInfo as w, type StorageObjectInfo as x, type RequestedExtension as y, type SelectFileOptions as z };
|
|
@@ -1,6 +1,187 @@
|
|
|
1
|
-
import { D as DatabaseQueryResult, M as Migration,
|
|
1
|
+
import { b as HaexHubEvent, c as EXTERNAL_EVENTS, D as DatabaseQueryResult, M as Migration, d as MigrationResult, W as WebRequestOptions, e as WebResponse, H as HaexHubConfig, a as ExtensionInfo, A as ApplicationContext, f as DatabasePermissionRequest, P as PermissionResponse, S as SearchResult, g as EventCallback } from './types-gfc9eCL4.mjs';
|
|
2
2
|
import { SqliteRemoteDatabase } from 'drizzle-orm/sqlite-proxy';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* External request from an authorized client (browser extension, CLI, server, etc.)
|
|
6
|
+
* These requests come through the WebSocket bridge and are routed to the appropriate extension.
|
|
7
|
+
*/
|
|
8
|
+
interface ExternalRequestEvent extends HaexHubEvent {
|
|
9
|
+
type: typeof EXTERNAL_EVENTS.REQUEST;
|
|
10
|
+
data: ExternalRequest;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* External request payload
|
|
14
|
+
*/
|
|
15
|
+
interface ExternalRequest {
|
|
16
|
+
/** Unique request ID for response correlation */
|
|
17
|
+
requestId: string;
|
|
18
|
+
/** Client's public key (Base64 SPKI format, used as identifier) */
|
|
19
|
+
publicKey: string;
|
|
20
|
+
/** Action/method to perform (extension-specific) */
|
|
21
|
+
action: string;
|
|
22
|
+
/** Request payload (extension-specific) */
|
|
23
|
+
payload: Record<string, unknown>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* External request payload from Tauri event (includes extension target info).
|
|
27
|
+
* This is sent from Rust when an external client makes a request.
|
|
28
|
+
*/
|
|
29
|
+
interface ExternalRequestPayload extends ExternalRequest {
|
|
30
|
+
/** Target extension's public key */
|
|
31
|
+
extensionPublicKey: string;
|
|
32
|
+
/** Target extension's name */
|
|
33
|
+
extensionName: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* External request response (sent back to the client)
|
|
37
|
+
*/
|
|
38
|
+
interface ExternalResponse {
|
|
39
|
+
/** Request ID for correlation */
|
|
40
|
+
requestId: string;
|
|
41
|
+
/** Whether the request was successful */
|
|
42
|
+
success: boolean;
|
|
43
|
+
/** Response data (if successful) */
|
|
44
|
+
data?: unknown;
|
|
45
|
+
/** Error message (if failed) */
|
|
46
|
+
error?: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Handler function type for external requests
|
|
50
|
+
*/
|
|
51
|
+
type ExternalRequestHandler = (request: ExternalRequest) => Promise<ExternalResponse> | ExternalResponse;
|
|
52
|
+
/**
|
|
53
|
+
* An authorized external client stored in the database
|
|
54
|
+
*/
|
|
55
|
+
interface AuthorizedClient {
|
|
56
|
+
/** Row ID */
|
|
57
|
+
id: string;
|
|
58
|
+
/** Unique client identifier (public key fingerprint) */
|
|
59
|
+
clientId: string;
|
|
60
|
+
/** Human-readable client name */
|
|
61
|
+
clientName: string;
|
|
62
|
+
/** Client's public key (base64) */
|
|
63
|
+
publicKey: string;
|
|
64
|
+
/** Extension ID this client can access */
|
|
65
|
+
extensionId: string;
|
|
66
|
+
/** When the client was authorized (ISO 8601) */
|
|
67
|
+
authorizedAt: string | null;
|
|
68
|
+
/** Last time the client connected (ISO 8601) */
|
|
69
|
+
lastSeen: string | null;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* A blocked external client stored in the database
|
|
73
|
+
*/
|
|
74
|
+
interface BlockedClient {
|
|
75
|
+
/** Row ID */
|
|
76
|
+
id: string;
|
|
77
|
+
/** Unique client identifier (public key fingerprint) */
|
|
78
|
+
clientId: string;
|
|
79
|
+
/** Human-readable client name */
|
|
80
|
+
clientName: string;
|
|
81
|
+
/** Client's public key (base64) */
|
|
82
|
+
publicKey: string;
|
|
83
|
+
/** When the client was blocked (ISO 8601) */
|
|
84
|
+
blockedAt: string | null;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Extension requested by an external client
|
|
88
|
+
*/
|
|
89
|
+
interface RequestedExtension {
|
|
90
|
+
/** Extension name (e.g., "haex-pass") */
|
|
91
|
+
name: string;
|
|
92
|
+
/** Extension's public key (hex string from manifest) */
|
|
93
|
+
extensionPublicKey: string;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Pending authorization request waiting for user approval
|
|
97
|
+
*/
|
|
98
|
+
interface PendingAuthorization {
|
|
99
|
+
/** Unique client identifier */
|
|
100
|
+
clientId: string;
|
|
101
|
+
/** Human-readable client name */
|
|
102
|
+
clientName: string;
|
|
103
|
+
/** Client's public key (base64) */
|
|
104
|
+
publicKey: string;
|
|
105
|
+
/** Extensions the client wants to access (pre-selected in authorization dialog) */
|
|
106
|
+
requestedExtensions: RequestedExtension[];
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Decision type for external authorization prompts
|
|
110
|
+
*/
|
|
111
|
+
type ExternalAuthDecision = 'allow' | 'deny';
|
|
112
|
+
/**
|
|
113
|
+
* Session-based authorization entry (for "allow once" authorizations)
|
|
114
|
+
* These are stored in-memory and cleared when haex-vault restarts.
|
|
115
|
+
*/
|
|
116
|
+
interface SessionAuthorization {
|
|
117
|
+
/** Unique client identifier (public key fingerprint) */
|
|
118
|
+
clientId: string;
|
|
119
|
+
/** Extension ID this client can access */
|
|
120
|
+
extensionId: string;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Connection state for external clients connecting to haex-vault via WebSocket.
|
|
124
|
+
* Used by browser extensions, CLI tools, servers, and other external clients.
|
|
125
|
+
*/
|
|
126
|
+
declare enum ExternalConnectionState {
|
|
127
|
+
/** Not connected to haex-vault */
|
|
128
|
+
DISCONNECTED = "disconnected",
|
|
129
|
+
/** Attempting to establish connection */
|
|
130
|
+
CONNECTING = "connecting",
|
|
131
|
+
/** WebSocket connected but not yet authorized */
|
|
132
|
+
CONNECTED = "connected",
|
|
133
|
+
/** Connected and waiting for user approval in haex-vault */
|
|
134
|
+
PENDING_APPROVAL = "pending_approval",
|
|
135
|
+
/** Connected and authorized to communicate */
|
|
136
|
+
PAIRED = "paired"
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Error codes for external client connections.
|
|
140
|
+
* Used to identify specific error conditions for i18n in the frontend.
|
|
141
|
+
*/
|
|
142
|
+
declare enum ExternalConnectionErrorCode {
|
|
143
|
+
/** No error */
|
|
144
|
+
NONE = "none",
|
|
145
|
+
/** Client is not authorized (rejected or not yet approved) */
|
|
146
|
+
CLIENT_NOT_AUTHORIZED = "client_not_authorized",
|
|
147
|
+
/** Client was blocked by the user */
|
|
148
|
+
CLIENT_BLOCKED = "client_blocked",
|
|
149
|
+
/** Connection to haex-vault failed (not running or network error) */
|
|
150
|
+
CONNECTION_FAILED = "connection_failed",
|
|
151
|
+
/** Connection timed out */
|
|
152
|
+
CONNECTION_TIMEOUT = "connection_timeout",
|
|
153
|
+
/** WebSocket connection was closed unexpectedly */
|
|
154
|
+
CONNECTION_CLOSED = "connection_closed",
|
|
155
|
+
/** Failed to decrypt message (invalid key or corrupted data) */
|
|
156
|
+
DECRYPTION_FAILED = "decryption_failed",
|
|
157
|
+
/** Invalid message format received */
|
|
158
|
+
INVALID_MESSAGE = "invalid_message",
|
|
159
|
+
/** Unknown or unspecified error */
|
|
160
|
+
UNKNOWN = "unknown"
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Full connection status including state, client ID, and any error
|
|
164
|
+
*/
|
|
165
|
+
interface ExternalConnection {
|
|
166
|
+
/** Current connection state */
|
|
167
|
+
state: ExternalConnectionState;
|
|
168
|
+
/** Client identifier (derived from public key) */
|
|
169
|
+
clientId: string | null;
|
|
170
|
+
/** Error code for i18n (use this for translations) */
|
|
171
|
+
errorCode: ExternalConnectionErrorCode;
|
|
172
|
+
/** Error message (original message, for logging/debugging) */
|
|
173
|
+
errorMessage: string | null;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Check if external client connection state indicates an active connection
|
|
177
|
+
* (connected, pending approval, or paired)
|
|
178
|
+
*/
|
|
179
|
+
declare function isExternalClientConnected(state: ExternalConnectionState): boolean;
|
|
180
|
+
/**
|
|
181
|
+
* Check if external client can send requests (only when paired/authorized)
|
|
182
|
+
*/
|
|
183
|
+
declare function canExternalClientSendRequests(state: ExternalConnectionState): boolean;
|
|
184
|
+
|
|
4
185
|
declare class StorageAPI {
|
|
5
186
|
private client;
|
|
6
187
|
constructor(client: HaexVaultSdk);
|
|
@@ -833,4 +1014,4 @@ declare class HaexVaultSdk {
|
|
|
833
1014
|
private log;
|
|
834
1015
|
}
|
|
835
1016
|
|
|
836
|
-
export { type
|
|
1017
|
+
export { type AuthorizedClient as A, type BlockedClient as B, type SelectFolderOptions as C, DatabaseAPI as D, type ExternalAuthDecision as E, type FileStat as F, type ServerInfo as G, HaexVaultSdk as H, type ServerStatus as I, type SessionAuthorization as J, type TransferProgress as K, LOCALSEND_EVENTS as L, type TransferState as M, canExternalClientSendRequests as N, isExternalClientConnected as O, type PendingAuthorization as P, RemoteStorageAPI as R, StorageAPI as S, type TransferDirection as T, type UpdateBackendRequest as U, WebAPI as W, type Device as a, type DeviceInfo as b, type DeviceType as c, type DirEntry as d, type ExternalConnection as e, ExternalConnectionErrorCode as f, ExternalConnectionState as g, type ExternalRequest as h, type ExternalRequestEvent as i, type ExternalRequestHandler as j, type ExternalRequestPayload as k, type ExternalResponse as l, FilesystemAPI as m, LocalSendAPI as n, type LocalSendEvent as o, type FileInfo as p, type LocalSendSettings as q, type PendingTransfer as r, PermissionsAPI as s, type AddBackendRequest as t, type S3Config as u, type S3PublicConfig as v, type StorageBackendInfo as w, type StorageObjectInfo as x, type RequestedExtension as y, type SelectFileOptions as z };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { H as HaexVaultSdk } from './client-
|
|
2
|
-
export { D as DatabaseAPI, a as Device, b as DeviceInfo, c as DeviceType, d as DirEntry, F as FileStat,
|
|
3
|
-
import { E as ExtensionManifest, H as HaexHubConfig } from './types-
|
|
4
|
-
export { A as ApplicationContext,
|
|
1
|
+
import { H as HaexVaultSdk } from './client-DFGx115H.mjs';
|
|
2
|
+
export { A as AuthorizedClient, B as BlockedClient, D as DatabaseAPI, a as Device, b as DeviceInfo, c as DeviceType, d as DirEntry, E as ExternalAuthDecision, e as ExternalConnection, f as ExternalConnectionErrorCode, g as ExternalConnectionState, h as ExternalRequest, i as ExternalRequestEvent, j as ExternalRequestHandler, k as ExternalRequestPayload, l as ExternalResponse, F as FileStat, m as FilesystemAPI, L as LOCALSEND_EVENTS, n as LocalSendAPI, o as LocalSendEvent, p as LocalSendFileInfo, q as LocalSendSettings, P as PendingAuthorization, r as PendingTransfer, s as PermissionsAPI, t as RemoteAddBackendRequest, u as RemoteS3Config, v as RemoteS3PublicConfig, R as RemoteStorageAPI, w as RemoteStorageBackendInfo, x as RemoteStorageObjectInfo, U as RemoteUpdateBackendRequest, y as RequestedExtension, z as SelectFileOptions, C as SelectFolderOptions, G as ServerInfo, I as ServerStatus, J as SessionAuthorization, T as TransferDirection, K as TransferProgress, M as TransferState, W as WebAPI, N as canExternalClientSendRequests, O as isExternalClientConnected } from './client-DFGx115H.mjs';
|
|
3
|
+
import { E as ExtensionManifest, H as HaexHubConfig } from './types-gfc9eCL4.mjs';
|
|
4
|
+
export { A as ApplicationContext, C as ContextChangedEvent, h as DEFAULT_TIMEOUT, i as DatabaseColumnInfo, j as DatabaseExecuteParams, k as DatabasePermission, f as DatabasePermissionRequest, l as DatabaseQueryParams, D as DatabaseQueryResult, m as DatabaseTableInfo, c as EXTERNAL_EVENTS, n as ErrorCode, g as EventCallback, a as ExtensionInfo, o as ExtensionRuntimeMode, p as ExternalEvent, F as FileChangeEvent, q as FileChangePayload, r as FileChangeType, s as FilteredSyncTablesResult, t as HAEXTENSION_EVENTS, b as HaexHubEvent, u as HaexHubRequest, v as HaexHubResponse, w as HaexVaultSdkError, x as HaextensionEvent, y as PermissionDeniedError, z as PermissionErrorBase, B as PermissionErrorCode, G as PermissionPromptError, P as PermissionResponse, I as PermissionStatus, J as SearchQuery, K as SearchRequestEvent, S as SearchResult, L as SyncTablesUpdatedEvent, T as TABLE_SEPARATOR, W as WebRequestOptions, e as WebResponse, N as getTableName, O as isPermissionDeniedError, Q as isPermissionError, R as isPermissionPromptError } from './types-gfc9eCL4.mjs';
|
|
5
5
|
export { H as HaextensionConfig } from './config-D_HXjsEV.mjs';
|
|
6
6
|
import 'drizzle-orm/sqlite-proxy';
|
|
7
7
|
|
|
@@ -82,6 +82,53 @@ declare function installBaseTag(): void;
|
|
|
82
82
|
*/
|
|
83
83
|
declare function installPolyfills(): void;
|
|
84
84
|
|
|
85
|
+
type SpaceRole = 'admin' | 'member' | 'viewer';
|
|
86
|
+
interface SharedSpace {
|
|
87
|
+
id: string;
|
|
88
|
+
ownerId: string;
|
|
89
|
+
encryptedName: string;
|
|
90
|
+
nameNonce: string;
|
|
91
|
+
currentKeyGeneration: number;
|
|
92
|
+
role: SpaceRole;
|
|
93
|
+
canInvite: boolean;
|
|
94
|
+
createdAt: string;
|
|
95
|
+
}
|
|
96
|
+
interface SpaceMemberInfo {
|
|
97
|
+
publicKey: string;
|
|
98
|
+
label: string;
|
|
99
|
+
role: SpaceRole;
|
|
100
|
+
canInvite: boolean;
|
|
101
|
+
invitedBy: string | null;
|
|
102
|
+
joinedAt: string;
|
|
103
|
+
}
|
|
104
|
+
interface SpaceKeyGrantInfo {
|
|
105
|
+
spaceId: string;
|
|
106
|
+
generation: number;
|
|
107
|
+
encryptedSpaceKey: string;
|
|
108
|
+
keyNonce: string;
|
|
109
|
+
ephemeralPublicKey: string;
|
|
110
|
+
}
|
|
111
|
+
interface SpaceInvite {
|
|
112
|
+
spaceId: string;
|
|
113
|
+
serverUrl: string;
|
|
114
|
+
spaceName: string;
|
|
115
|
+
accessToken: string;
|
|
116
|
+
encryptedSpaceKey: string;
|
|
117
|
+
keyNonce: string;
|
|
118
|
+
ephemeralPublicKey: string;
|
|
119
|
+
generation: number;
|
|
120
|
+
role: SpaceRole;
|
|
121
|
+
}
|
|
122
|
+
interface SpaceAccessTokenInfo {
|
|
123
|
+
id: string;
|
|
124
|
+
publicKey: string;
|
|
125
|
+
role: SpaceRole;
|
|
126
|
+
label: string | null;
|
|
127
|
+
revoked: boolean;
|
|
128
|
+
createdAt: string;
|
|
129
|
+
lastUsedAt: string | null;
|
|
130
|
+
}
|
|
131
|
+
|
|
85
132
|
/**
|
|
86
133
|
* Sync Server API Types
|
|
87
134
|
*
|
|
@@ -892,4 +939,4 @@ declare function exportKeyPairAsync(keyPair: PasskeyKeyPair): Promise<ExportedPa
|
|
|
892
939
|
|
|
893
940
|
declare function createHaexVaultSdk(config?: HaexHubConfig): HaexVaultSdk;
|
|
894
941
|
|
|
895
|
-
export { type AuthUser, COSE_ALGORITHM, type CoseAlgorithm, type CreateSpaceRequest, type EncryptedSpaceKey, type ExportedPasskeyKeyPair, type ExportedUserKeypair, ExtensionManifest, HAEXSPACE_MESSAGE_TYPES, HaexHubConfig, HaexVaultSdk, type HaexspaceMessageType, type InviteMemberRequest, KEY_AGREEMENT_ALGO, type PasskeyKeyPair, type RegisterKeypairRequest, SIGNING_ALGO, type SignableRecord, type StorageConfig, type ErrorResponse as SyncServerErrorResponse, type ServerInfo as SyncServerInfo, type LoginRequest as SyncServerLoginRequest, type LoginResponse as SyncServerLoginResponse, type RefreshRequest as SyncServerRefreshRequest, TAURI_COMMANDS, type TauriCommand, type UserKeypair, type VerifyResult, type ZipFileEntry, arrayBufferToBase64, base64ToArrayBuffer, createHaexVaultSdk, decryptCrdtData, decryptPrivateKeyAsync, decryptSpaceKeyAsync, decryptString, decryptVaultKey, decryptVaultName, deriveKeyFromPassword, encryptCrdtData, encryptPrivateKeyAsync, encryptSpaceKeyForRecipientAsync, encryptString, encryptVaultKey, exportKeyPairAsync, exportPrivateKeyAsync, exportPublicKeyAsync, exportPublicKeyCoseAsync, exportUserKeypairAsync, generateCredentialId, generatePasskeyPairAsync, generateSpaceKey, generateUserKeypairAsync, generateVaultKey, hexToBytes, importPrivateKeyAsync, importPrivateKeyForKeyAgreementAsync, importPublicKeyAsync, importPublicKeyForKeyAgreementAsync, importUserPrivateKeyAsync, importUserPublicKeyAsync, installBaseTag, installCookiePolyfill, installHistoryPolyfill, installLocalStoragePolyfill, installPolyfills, installSessionStoragePolyfill, signRecordAsync, signSpaceChallengeAsync, signWithPasskeyAsync, sortObjectKeysRecursively, unwrapKey, verifyExtensionSignature, verifyRecordSignatureAsync, verifySpaceChallengeAsync, verifyWithPasskeyAsync, wrapKey };
|
|
942
|
+
export { type AuthUser, COSE_ALGORITHM, type CoseAlgorithm, type CreateSpaceRequest, type EncryptedSpaceKey, type ExportedPasskeyKeyPair, type ExportedUserKeypair, ExtensionManifest, HAEXSPACE_MESSAGE_TYPES, HaexHubConfig, HaexVaultSdk, type HaexspaceMessageType, type InviteMemberRequest, KEY_AGREEMENT_ALGO, type PasskeyKeyPair, type RegisterKeypairRequest, SIGNING_ALGO, type SharedSpace, type SignableRecord, type SpaceAccessTokenInfo, type SpaceInvite, type SpaceKeyGrantInfo, type SpaceMemberInfo, type SpaceRole, type StorageConfig, type ErrorResponse as SyncServerErrorResponse, type ServerInfo as SyncServerInfo, type LoginRequest as SyncServerLoginRequest, type LoginResponse as SyncServerLoginResponse, type RefreshRequest as SyncServerRefreshRequest, TAURI_COMMANDS, type TauriCommand, type UserKeypair, type VerifyResult, type ZipFileEntry, arrayBufferToBase64, base64ToArrayBuffer, createHaexVaultSdk, decryptCrdtData, decryptPrivateKeyAsync, decryptSpaceKeyAsync, decryptString, decryptVaultKey, decryptVaultName, deriveKeyFromPassword, encryptCrdtData, encryptPrivateKeyAsync, encryptSpaceKeyForRecipientAsync, encryptString, encryptVaultKey, exportKeyPairAsync, exportPrivateKeyAsync, exportPublicKeyAsync, exportPublicKeyCoseAsync, exportUserKeypairAsync, generateCredentialId, generatePasskeyPairAsync, generateSpaceKey, generateUserKeypairAsync, generateVaultKey, hexToBytes, importPrivateKeyAsync, importPrivateKeyForKeyAgreementAsync, importPublicKeyAsync, importPublicKeyForKeyAgreementAsync, importUserPrivateKeyAsync, importUserPublicKeyAsync, installBaseTag, installCookiePolyfill, installHistoryPolyfill, installLocalStoragePolyfill, installPolyfills, installSessionStoragePolyfill, signRecordAsync, signSpaceChallengeAsync, signWithPasskeyAsync, sortObjectKeysRecursively, unwrapKey, verifyExtensionSignature, verifyRecordSignatureAsync, verifySpaceChallengeAsync, verifyWithPasskeyAsync, wrapKey };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { H as HaexVaultSdk } from './client-
|
|
2
|
-
export { D as DatabaseAPI, a as Device, b as DeviceInfo, c as DeviceType, d as DirEntry, F as FileStat,
|
|
3
|
-
import { E as ExtensionManifest, H as HaexHubConfig } from './types-
|
|
4
|
-
export { A as ApplicationContext,
|
|
1
|
+
import { H as HaexVaultSdk } from './client-8dlKVNDZ.js';
|
|
2
|
+
export { A as AuthorizedClient, B as BlockedClient, D as DatabaseAPI, a as Device, b as DeviceInfo, c as DeviceType, d as DirEntry, E as ExternalAuthDecision, e as ExternalConnection, f as ExternalConnectionErrorCode, g as ExternalConnectionState, h as ExternalRequest, i as ExternalRequestEvent, j as ExternalRequestHandler, k as ExternalRequestPayload, l as ExternalResponse, F as FileStat, m as FilesystemAPI, L as LOCALSEND_EVENTS, n as LocalSendAPI, o as LocalSendEvent, p as LocalSendFileInfo, q as LocalSendSettings, P as PendingAuthorization, r as PendingTransfer, s as PermissionsAPI, t as RemoteAddBackendRequest, u as RemoteS3Config, v as RemoteS3PublicConfig, R as RemoteStorageAPI, w as RemoteStorageBackendInfo, x as RemoteStorageObjectInfo, U as RemoteUpdateBackendRequest, y as RequestedExtension, z as SelectFileOptions, C as SelectFolderOptions, G as ServerInfo, I as ServerStatus, J as SessionAuthorization, T as TransferDirection, K as TransferProgress, M as TransferState, W as WebAPI, N as canExternalClientSendRequests, O as isExternalClientConnected } from './client-8dlKVNDZ.js';
|
|
3
|
+
import { E as ExtensionManifest, H as HaexHubConfig } from './types-gfc9eCL4.js';
|
|
4
|
+
export { A as ApplicationContext, C as ContextChangedEvent, h as DEFAULT_TIMEOUT, i as DatabaseColumnInfo, j as DatabaseExecuteParams, k as DatabasePermission, f as DatabasePermissionRequest, l as DatabaseQueryParams, D as DatabaseQueryResult, m as DatabaseTableInfo, c as EXTERNAL_EVENTS, n as ErrorCode, g as EventCallback, a as ExtensionInfo, o as ExtensionRuntimeMode, p as ExternalEvent, F as FileChangeEvent, q as FileChangePayload, r as FileChangeType, s as FilteredSyncTablesResult, t as HAEXTENSION_EVENTS, b as HaexHubEvent, u as HaexHubRequest, v as HaexHubResponse, w as HaexVaultSdkError, x as HaextensionEvent, y as PermissionDeniedError, z as PermissionErrorBase, B as PermissionErrorCode, G as PermissionPromptError, P as PermissionResponse, I as PermissionStatus, J as SearchQuery, K as SearchRequestEvent, S as SearchResult, L as SyncTablesUpdatedEvent, T as TABLE_SEPARATOR, W as WebRequestOptions, e as WebResponse, N as getTableName, O as isPermissionDeniedError, Q as isPermissionError, R as isPermissionPromptError } from './types-gfc9eCL4.js';
|
|
5
5
|
export { H as HaextensionConfig } from './config-D_HXjsEV.js';
|
|
6
6
|
import 'drizzle-orm/sqlite-proxy';
|
|
7
7
|
|
|
@@ -82,6 +82,53 @@ declare function installBaseTag(): void;
|
|
|
82
82
|
*/
|
|
83
83
|
declare function installPolyfills(): void;
|
|
84
84
|
|
|
85
|
+
type SpaceRole = 'admin' | 'member' | 'viewer';
|
|
86
|
+
interface SharedSpace {
|
|
87
|
+
id: string;
|
|
88
|
+
ownerId: string;
|
|
89
|
+
encryptedName: string;
|
|
90
|
+
nameNonce: string;
|
|
91
|
+
currentKeyGeneration: number;
|
|
92
|
+
role: SpaceRole;
|
|
93
|
+
canInvite: boolean;
|
|
94
|
+
createdAt: string;
|
|
95
|
+
}
|
|
96
|
+
interface SpaceMemberInfo {
|
|
97
|
+
publicKey: string;
|
|
98
|
+
label: string;
|
|
99
|
+
role: SpaceRole;
|
|
100
|
+
canInvite: boolean;
|
|
101
|
+
invitedBy: string | null;
|
|
102
|
+
joinedAt: string;
|
|
103
|
+
}
|
|
104
|
+
interface SpaceKeyGrantInfo {
|
|
105
|
+
spaceId: string;
|
|
106
|
+
generation: number;
|
|
107
|
+
encryptedSpaceKey: string;
|
|
108
|
+
keyNonce: string;
|
|
109
|
+
ephemeralPublicKey: string;
|
|
110
|
+
}
|
|
111
|
+
interface SpaceInvite {
|
|
112
|
+
spaceId: string;
|
|
113
|
+
serverUrl: string;
|
|
114
|
+
spaceName: string;
|
|
115
|
+
accessToken: string;
|
|
116
|
+
encryptedSpaceKey: string;
|
|
117
|
+
keyNonce: string;
|
|
118
|
+
ephemeralPublicKey: string;
|
|
119
|
+
generation: number;
|
|
120
|
+
role: SpaceRole;
|
|
121
|
+
}
|
|
122
|
+
interface SpaceAccessTokenInfo {
|
|
123
|
+
id: string;
|
|
124
|
+
publicKey: string;
|
|
125
|
+
role: SpaceRole;
|
|
126
|
+
label: string | null;
|
|
127
|
+
revoked: boolean;
|
|
128
|
+
createdAt: string;
|
|
129
|
+
lastUsedAt: string | null;
|
|
130
|
+
}
|
|
131
|
+
|
|
85
132
|
/**
|
|
86
133
|
* Sync Server API Types
|
|
87
134
|
*
|
|
@@ -892,4 +939,4 @@ declare function exportKeyPairAsync(keyPair: PasskeyKeyPair): Promise<ExportedPa
|
|
|
892
939
|
|
|
893
940
|
declare function createHaexVaultSdk(config?: HaexHubConfig): HaexVaultSdk;
|
|
894
941
|
|
|
895
|
-
export { type AuthUser, COSE_ALGORITHM, type CoseAlgorithm, type CreateSpaceRequest, type EncryptedSpaceKey, type ExportedPasskeyKeyPair, type ExportedUserKeypair, ExtensionManifest, HAEXSPACE_MESSAGE_TYPES, HaexHubConfig, HaexVaultSdk, type HaexspaceMessageType, type InviteMemberRequest, KEY_AGREEMENT_ALGO, type PasskeyKeyPair, type RegisterKeypairRequest, SIGNING_ALGO, type SignableRecord, type StorageConfig, type ErrorResponse as SyncServerErrorResponse, type ServerInfo as SyncServerInfo, type LoginRequest as SyncServerLoginRequest, type LoginResponse as SyncServerLoginResponse, type RefreshRequest as SyncServerRefreshRequest, TAURI_COMMANDS, type TauriCommand, type UserKeypair, type VerifyResult, type ZipFileEntry, arrayBufferToBase64, base64ToArrayBuffer, createHaexVaultSdk, decryptCrdtData, decryptPrivateKeyAsync, decryptSpaceKeyAsync, decryptString, decryptVaultKey, decryptVaultName, deriveKeyFromPassword, encryptCrdtData, encryptPrivateKeyAsync, encryptSpaceKeyForRecipientAsync, encryptString, encryptVaultKey, exportKeyPairAsync, exportPrivateKeyAsync, exportPublicKeyAsync, exportPublicKeyCoseAsync, exportUserKeypairAsync, generateCredentialId, generatePasskeyPairAsync, generateSpaceKey, generateUserKeypairAsync, generateVaultKey, hexToBytes, importPrivateKeyAsync, importPrivateKeyForKeyAgreementAsync, importPublicKeyAsync, importPublicKeyForKeyAgreementAsync, importUserPrivateKeyAsync, importUserPublicKeyAsync, installBaseTag, installCookiePolyfill, installHistoryPolyfill, installLocalStoragePolyfill, installPolyfills, installSessionStoragePolyfill, signRecordAsync, signSpaceChallengeAsync, signWithPasskeyAsync, sortObjectKeysRecursively, unwrapKey, verifyExtensionSignature, verifyRecordSignatureAsync, verifySpaceChallengeAsync, verifyWithPasskeyAsync, wrapKey };
|
|
942
|
+
export { type AuthUser, COSE_ALGORITHM, type CoseAlgorithm, type CreateSpaceRequest, type EncryptedSpaceKey, type ExportedPasskeyKeyPair, type ExportedUserKeypair, ExtensionManifest, HAEXSPACE_MESSAGE_TYPES, HaexHubConfig, HaexVaultSdk, type HaexspaceMessageType, type InviteMemberRequest, KEY_AGREEMENT_ALGO, type PasskeyKeyPair, type RegisterKeypairRequest, SIGNING_ALGO, type SharedSpace, type SignableRecord, type SpaceAccessTokenInfo, type SpaceInvite, type SpaceKeyGrantInfo, type SpaceMemberInfo, type SpaceRole, type StorageConfig, type ErrorResponse as SyncServerErrorResponse, type ServerInfo as SyncServerInfo, type LoginRequest as SyncServerLoginRequest, type LoginResponse as SyncServerLoginResponse, type RefreshRequest as SyncServerRefreshRequest, TAURI_COMMANDS, type TauriCommand, type UserKeypair, type VerifyResult, type ZipFileEntry, arrayBufferToBase64, base64ToArrayBuffer, createHaexVaultSdk, decryptCrdtData, decryptPrivateKeyAsync, decryptSpaceKeyAsync, decryptString, decryptVaultKey, decryptVaultName, deriveKeyFromPassword, encryptCrdtData, encryptPrivateKeyAsync, encryptSpaceKeyForRecipientAsync, encryptString, encryptVaultKey, exportKeyPairAsync, exportPrivateKeyAsync, exportPublicKeyAsync, exportPublicKeyCoseAsync, exportUserKeypairAsync, generateCredentialId, generatePasskeyPairAsync, generateSpaceKey, generateUserKeypairAsync, generateVaultKey, hexToBytes, importPrivateKeyAsync, importPrivateKeyForKeyAgreementAsync, importPublicKeyAsync, importPublicKeyForKeyAgreementAsync, importUserPrivateKeyAsync, importUserPublicKeyAsync, installBaseTag, installCookiePolyfill, installHistoryPolyfill, installLocalStoragePolyfill, installPolyfills, installSessionStoragePolyfill, signRecordAsync, signSpaceChallengeAsync, signWithPasskeyAsync, sortObjectKeysRecursively, unwrapKey, verifyExtensionSignature, verifyRecordSignatureAsync, verifySpaceChallengeAsync, verifyWithPasskeyAsync, wrapKey };
|
package/dist/index.js
CHANGED
|
@@ -387,32 +387,7 @@ var EXTERNAL_EVENTS = {
|
|
|
387
387
|
AUTHORIZATION_REQUEST: "external:authorization-request"
|
|
388
388
|
};
|
|
389
389
|
|
|
390
|
-
// src/types.ts
|
|
391
|
-
var DEFAULT_TIMEOUT = 3e4;
|
|
392
|
-
var TABLE_SEPARATOR = "__";
|
|
393
|
-
function getTableName(publicKey, extensionName, tableName) {
|
|
394
|
-
return `${publicKey}${TABLE_SEPARATOR}${extensionName}${TABLE_SEPARATOR}${tableName}`;
|
|
395
|
-
}
|
|
396
|
-
var PermissionStatus = /* @__PURE__ */ ((PermissionStatus2) => {
|
|
397
|
-
PermissionStatus2["GRANTED"] = "granted";
|
|
398
|
-
PermissionStatus2["DENIED"] = "denied";
|
|
399
|
-
PermissionStatus2["ASK"] = "ask";
|
|
400
|
-
return PermissionStatus2;
|
|
401
|
-
})(PermissionStatus || {});
|
|
402
|
-
var PermissionErrorCode = /* @__PURE__ */ ((PermissionErrorCode2) => {
|
|
403
|
-
PermissionErrorCode2[PermissionErrorCode2["DENIED"] = 1002] = "DENIED";
|
|
404
|
-
PermissionErrorCode2[PermissionErrorCode2["PROMPT_REQUIRED"] = 1004] = "PROMPT_REQUIRED";
|
|
405
|
-
return PermissionErrorCode2;
|
|
406
|
-
})(PermissionErrorCode || {});
|
|
407
|
-
function isPermissionDeniedError(error) {
|
|
408
|
-
return typeof error === "object" && error !== null && "code" in error && error.code === 1002 /* DENIED */;
|
|
409
|
-
}
|
|
410
|
-
function isPermissionPromptError(error) {
|
|
411
|
-
return typeof error === "object" && error !== null && "code" in error && error.code === 1004 /* PROMPT_REQUIRED */;
|
|
412
|
-
}
|
|
413
|
-
function isPermissionError(error) {
|
|
414
|
-
return isPermissionDeniedError(error) || isPermissionPromptError(error);
|
|
415
|
-
}
|
|
390
|
+
// src/types/external.ts
|
|
416
391
|
var ExternalConnectionState = /* @__PURE__ */ ((ExternalConnectionState2) => {
|
|
417
392
|
ExternalConnectionState2["DISCONNECTED"] = "disconnected";
|
|
418
393
|
ExternalConnectionState2["CONNECTING"] = "connecting";
|
|
@@ -439,6 +414,33 @@ function isExternalClientConnected(state) {
|
|
|
439
414
|
function canExternalClientSendRequests(state) {
|
|
440
415
|
return state === "paired" /* PAIRED */;
|
|
441
416
|
}
|
|
417
|
+
|
|
418
|
+
// src/types.ts
|
|
419
|
+
var DEFAULT_TIMEOUT = 3e4;
|
|
420
|
+
var TABLE_SEPARATOR = "__";
|
|
421
|
+
function getTableName(publicKey, extensionName, tableName) {
|
|
422
|
+
return `${publicKey}${TABLE_SEPARATOR}${extensionName}${TABLE_SEPARATOR}${tableName}`;
|
|
423
|
+
}
|
|
424
|
+
var PermissionStatus = /* @__PURE__ */ ((PermissionStatus2) => {
|
|
425
|
+
PermissionStatus2["GRANTED"] = "granted";
|
|
426
|
+
PermissionStatus2["DENIED"] = "denied";
|
|
427
|
+
PermissionStatus2["ASK"] = "ask";
|
|
428
|
+
return PermissionStatus2;
|
|
429
|
+
})(PermissionStatus || {});
|
|
430
|
+
var PermissionErrorCode = /* @__PURE__ */ ((PermissionErrorCode2) => {
|
|
431
|
+
PermissionErrorCode2[PermissionErrorCode2["DENIED"] = 1002] = "DENIED";
|
|
432
|
+
PermissionErrorCode2[PermissionErrorCode2["PROMPT_REQUIRED"] = 1004] = "PROMPT_REQUIRED";
|
|
433
|
+
return PermissionErrorCode2;
|
|
434
|
+
})(PermissionErrorCode || {});
|
|
435
|
+
function isPermissionDeniedError(error) {
|
|
436
|
+
return typeof error === "object" && error !== null && "code" in error && error.code === 1002 /* DENIED */;
|
|
437
|
+
}
|
|
438
|
+
function isPermissionPromptError(error) {
|
|
439
|
+
return typeof error === "object" && error !== null && "code" in error && error.code === 1004 /* PROMPT_REQUIRED */;
|
|
440
|
+
}
|
|
441
|
+
function isPermissionError(error) {
|
|
442
|
+
return isPermissionDeniedError(error) || isPermissionPromptError(error);
|
|
443
|
+
}
|
|
442
444
|
var ErrorCode = /* @__PURE__ */ ((ErrorCode2) => {
|
|
443
445
|
ErrorCode2["TIMEOUT"] = "TIMEOUT";
|
|
444
446
|
ErrorCode2["NOT_IN_IFRAME"] = "NOT_IN_IFRAME";
|