@haex-space/vault-sdk 2.5.100 → 2.5.101

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/index.d.mts CHANGED
@@ -82,6 +82,120 @@ declare function installBaseTag(): void;
82
82
  */
83
83
  declare function installPolyfills(): void;
84
84
 
85
+ /**
86
+ * Sync Server API Types
87
+ *
88
+ * Types for communicating with the haex-sync-server authentication endpoints.
89
+ * Used by haex-vault and extensions that need to interact with the sync server.
90
+ */
91
+ /**
92
+ * S3-compatible storage configuration provided by the sync server.
93
+ * This contains all credentials needed to access the user's storage bucket.
94
+ */
95
+ interface StorageConfig {
96
+ /** S3 endpoint URL (e.g., "https://supabase.haex.space/storage/v1/s3") */
97
+ endpoint: string;
98
+ /** Access Key ID (Supabase project reference) */
99
+ accessKeyId: string;
100
+ /** Secret Access Key (Supabase anon key) */
101
+ secretAccessKey: string;
102
+ /** User's bucket name (e.g., "storage-{user_id}") */
103
+ bucket: string;
104
+ /** S3 region (usually "auto" for Supabase) */
105
+ region: string;
106
+ }
107
+ /**
108
+ * User info returned from auth endpoints
109
+ */
110
+ interface AuthUser {
111
+ /** User's unique ID (UUID) */
112
+ id: string;
113
+ /** User's email address */
114
+ email: string;
115
+ }
116
+ /**
117
+ * Response from POST /auth/login and POST /auth/refresh endpoints.
118
+ *
119
+ * Contains:
120
+ * - Session tokens for vault sync (access_token, refresh_token)
121
+ * - Storage-only token for S3 operations (storage_token)
122
+ * - Pre-configured S3 storage settings (storage_config)
123
+ *
124
+ * The storage_token is scoped to only allow S3 storage access.
125
+ * It cannot be used to access vault data or other sensitive resources.
126
+ */
127
+ interface LoginResponse {
128
+ /** JWT access token for vault sync operations */
129
+ access_token: string;
130
+ /** Refresh token for obtaining new access tokens */
131
+ refresh_token: string;
132
+ /** Token validity in seconds */
133
+ expires_in: number;
134
+ /** Token expiration timestamp (Unix epoch) */
135
+ expires_at: number;
136
+ /** Authenticated user info */
137
+ user: AuthUser;
138
+ /**
139
+ * Storage-only JWT token for S3 operations.
140
+ * This token is scoped to only allow storage access (scope: "storage").
141
+ * It cannot be used to access vault_keys, sync_changes, or other sensitive data.
142
+ * Only present if SUPABASE_JWT_SECRET is configured on the server.
143
+ */
144
+ storage_token?: string;
145
+ /**
146
+ * Storage token expiration timestamp (Unix epoch).
147
+ * Same as expires_at since both tokens expire at the same time.
148
+ */
149
+ storage_token_expires_at?: number;
150
+ /**
151
+ * Pre-configured S3 storage settings.
152
+ * Contains all credentials needed to access the user's storage bucket.
153
+ * Only present if storage_token is available.
154
+ */
155
+ storage_config?: StorageConfig;
156
+ }
157
+ /**
158
+ * Request body for POST /auth/login
159
+ */
160
+ interface LoginRequest {
161
+ /** User's email address */
162
+ email: string;
163
+ /** User's password */
164
+ password: string;
165
+ }
166
+ /**
167
+ * Request body for POST /auth/refresh
168
+ */
169
+ interface RefreshRequest {
170
+ /** Refresh token from previous login/refresh response */
171
+ refresh_token: string;
172
+ }
173
+ /**
174
+ * Server health check response from GET /
175
+ * Contains server info and Supabase configuration.
176
+ */
177
+ interface ServerInfo {
178
+ /** Server name (e.g., "haex-sync-server") */
179
+ name: string;
180
+ /** Server version (e.g., "0.2.7") */
181
+ version: string;
182
+ /** Server status (should be "ok") */
183
+ status: string;
184
+ /** Environment (e.g., "development", "production") */
185
+ env: string;
186
+ /** Supabase URL for client initialization */
187
+ supabaseUrl: string;
188
+ /** Supabase anon key for client initialization */
189
+ supabaseAnonKey: string;
190
+ }
191
+ /**
192
+ * Error response from sync server endpoints
193
+ */
194
+ interface ErrorResponse {
195
+ /** Error message */
196
+ error: string;
197
+ }
198
+
85
199
  /**
86
200
  * Central message type definitions for HaexSpace SDK
87
201
  *
@@ -690,4 +804,4 @@ declare function exportKeyPairAsync(keyPair: PasskeyKeyPair): Promise<ExportedPa
690
804
 
691
805
  declare function createHaexVaultSdk(config?: HaexHubConfig): HaexVaultSdk;
692
806
 
693
- export { COSE_ALGORITHM, type CoseAlgorithm, type ExportedPasskeyKeyPair, ExtensionManifest, HAEXSPACE_MESSAGE_TYPES, HaexHubConfig, HaexVaultSdk, type HaexspaceMessageType, type PasskeyKeyPair, TAURI_COMMANDS, type TauriCommand, type VerifyResult, type ZipFileEntry, arrayBufferToBase64, base64ToArrayBuffer, createHaexVaultSdk, decryptCrdtData, decryptString, decryptVaultKey, decryptVaultName, deriveKeyFromPassword, encryptCrdtData, encryptString, encryptVaultKey, exportKeyPairAsync, exportPrivateKeyAsync, exportPublicKeyAsync, exportPublicKeyCoseAsync, generateCredentialId, generatePasskeyPairAsync, generateVaultKey, hexToBytes, importPrivateKeyAsync, importPublicKeyAsync, installBaseTag, installCookiePolyfill, installHistoryPolyfill, installLocalStoragePolyfill, installPolyfills, installSessionStoragePolyfill, signWithPasskeyAsync, sortObjectKeysRecursively, unwrapKey, verifyExtensionSignature, verifyWithPasskeyAsync, wrapKey };
807
+ export { type AuthUser, COSE_ALGORITHM, type CoseAlgorithm, type ExportedPasskeyKeyPair, ExtensionManifest, HAEXSPACE_MESSAGE_TYPES, HaexHubConfig, HaexVaultSdk, type HaexspaceMessageType, type PasskeyKeyPair, 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 VerifyResult, type ZipFileEntry, arrayBufferToBase64, base64ToArrayBuffer, createHaexVaultSdk, decryptCrdtData, decryptString, decryptVaultKey, decryptVaultName, deriveKeyFromPassword, encryptCrdtData, encryptString, encryptVaultKey, exportKeyPairAsync, exportPrivateKeyAsync, exportPublicKeyAsync, exportPublicKeyCoseAsync, generateCredentialId, generatePasskeyPairAsync, generateVaultKey, hexToBytes, importPrivateKeyAsync, importPublicKeyAsync, installBaseTag, installCookiePolyfill, installHistoryPolyfill, installLocalStoragePolyfill, installPolyfills, installSessionStoragePolyfill, signWithPasskeyAsync, sortObjectKeysRecursively, unwrapKey, verifyExtensionSignature, verifyWithPasskeyAsync, wrapKey };
package/dist/index.d.ts CHANGED
@@ -82,6 +82,120 @@ declare function installBaseTag(): void;
82
82
  */
83
83
  declare function installPolyfills(): void;
84
84
 
85
+ /**
86
+ * Sync Server API Types
87
+ *
88
+ * Types for communicating with the haex-sync-server authentication endpoints.
89
+ * Used by haex-vault and extensions that need to interact with the sync server.
90
+ */
91
+ /**
92
+ * S3-compatible storage configuration provided by the sync server.
93
+ * This contains all credentials needed to access the user's storage bucket.
94
+ */
95
+ interface StorageConfig {
96
+ /** S3 endpoint URL (e.g., "https://supabase.haex.space/storage/v1/s3") */
97
+ endpoint: string;
98
+ /** Access Key ID (Supabase project reference) */
99
+ accessKeyId: string;
100
+ /** Secret Access Key (Supabase anon key) */
101
+ secretAccessKey: string;
102
+ /** User's bucket name (e.g., "storage-{user_id}") */
103
+ bucket: string;
104
+ /** S3 region (usually "auto" for Supabase) */
105
+ region: string;
106
+ }
107
+ /**
108
+ * User info returned from auth endpoints
109
+ */
110
+ interface AuthUser {
111
+ /** User's unique ID (UUID) */
112
+ id: string;
113
+ /** User's email address */
114
+ email: string;
115
+ }
116
+ /**
117
+ * Response from POST /auth/login and POST /auth/refresh endpoints.
118
+ *
119
+ * Contains:
120
+ * - Session tokens for vault sync (access_token, refresh_token)
121
+ * - Storage-only token for S3 operations (storage_token)
122
+ * - Pre-configured S3 storage settings (storage_config)
123
+ *
124
+ * The storage_token is scoped to only allow S3 storage access.
125
+ * It cannot be used to access vault data or other sensitive resources.
126
+ */
127
+ interface LoginResponse {
128
+ /** JWT access token for vault sync operations */
129
+ access_token: string;
130
+ /** Refresh token for obtaining new access tokens */
131
+ refresh_token: string;
132
+ /** Token validity in seconds */
133
+ expires_in: number;
134
+ /** Token expiration timestamp (Unix epoch) */
135
+ expires_at: number;
136
+ /** Authenticated user info */
137
+ user: AuthUser;
138
+ /**
139
+ * Storage-only JWT token for S3 operations.
140
+ * This token is scoped to only allow storage access (scope: "storage").
141
+ * It cannot be used to access vault_keys, sync_changes, or other sensitive data.
142
+ * Only present if SUPABASE_JWT_SECRET is configured on the server.
143
+ */
144
+ storage_token?: string;
145
+ /**
146
+ * Storage token expiration timestamp (Unix epoch).
147
+ * Same as expires_at since both tokens expire at the same time.
148
+ */
149
+ storage_token_expires_at?: number;
150
+ /**
151
+ * Pre-configured S3 storage settings.
152
+ * Contains all credentials needed to access the user's storage bucket.
153
+ * Only present if storage_token is available.
154
+ */
155
+ storage_config?: StorageConfig;
156
+ }
157
+ /**
158
+ * Request body for POST /auth/login
159
+ */
160
+ interface LoginRequest {
161
+ /** User's email address */
162
+ email: string;
163
+ /** User's password */
164
+ password: string;
165
+ }
166
+ /**
167
+ * Request body for POST /auth/refresh
168
+ */
169
+ interface RefreshRequest {
170
+ /** Refresh token from previous login/refresh response */
171
+ refresh_token: string;
172
+ }
173
+ /**
174
+ * Server health check response from GET /
175
+ * Contains server info and Supabase configuration.
176
+ */
177
+ interface ServerInfo {
178
+ /** Server name (e.g., "haex-sync-server") */
179
+ name: string;
180
+ /** Server version (e.g., "0.2.7") */
181
+ version: string;
182
+ /** Server status (should be "ok") */
183
+ status: string;
184
+ /** Environment (e.g., "development", "production") */
185
+ env: string;
186
+ /** Supabase URL for client initialization */
187
+ supabaseUrl: string;
188
+ /** Supabase anon key for client initialization */
189
+ supabaseAnonKey: string;
190
+ }
191
+ /**
192
+ * Error response from sync server endpoints
193
+ */
194
+ interface ErrorResponse {
195
+ /** Error message */
196
+ error: string;
197
+ }
198
+
85
199
  /**
86
200
  * Central message type definitions for HaexSpace SDK
87
201
  *
@@ -690,4 +804,4 @@ declare function exportKeyPairAsync(keyPair: PasskeyKeyPair): Promise<ExportedPa
690
804
 
691
805
  declare function createHaexVaultSdk(config?: HaexHubConfig): HaexVaultSdk;
692
806
 
693
- export { COSE_ALGORITHM, type CoseAlgorithm, type ExportedPasskeyKeyPair, ExtensionManifest, HAEXSPACE_MESSAGE_TYPES, HaexHubConfig, HaexVaultSdk, type HaexspaceMessageType, type PasskeyKeyPair, TAURI_COMMANDS, type TauriCommand, type VerifyResult, type ZipFileEntry, arrayBufferToBase64, base64ToArrayBuffer, createHaexVaultSdk, decryptCrdtData, decryptString, decryptVaultKey, decryptVaultName, deriveKeyFromPassword, encryptCrdtData, encryptString, encryptVaultKey, exportKeyPairAsync, exportPrivateKeyAsync, exportPublicKeyAsync, exportPublicKeyCoseAsync, generateCredentialId, generatePasskeyPairAsync, generateVaultKey, hexToBytes, importPrivateKeyAsync, importPublicKeyAsync, installBaseTag, installCookiePolyfill, installHistoryPolyfill, installLocalStoragePolyfill, installPolyfills, installSessionStoragePolyfill, signWithPasskeyAsync, sortObjectKeysRecursively, unwrapKey, verifyExtensionSignature, verifyWithPasskeyAsync, wrapKey };
807
+ export { type AuthUser, COSE_ALGORITHM, type CoseAlgorithm, type ExportedPasskeyKeyPair, ExtensionManifest, HAEXSPACE_MESSAGE_TYPES, HaexHubConfig, HaexVaultSdk, type HaexspaceMessageType, type PasskeyKeyPair, 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 VerifyResult, type ZipFileEntry, arrayBufferToBase64, base64ToArrayBuffer, createHaexVaultSdk, decryptCrdtData, decryptString, decryptVaultKey, decryptVaultName, deriveKeyFromPassword, encryptCrdtData, encryptString, encryptVaultKey, exportKeyPairAsync, exportPrivateKeyAsync, exportPublicKeyAsync, exportPublicKeyCoseAsync, generateCredentialId, generatePasskeyPairAsync, generateVaultKey, hexToBytes, importPrivateKeyAsync, importPublicKeyAsync, installBaseTag, installCookiePolyfill, installHistoryPolyfill, installLocalStoragePolyfill, installPolyfills, installSessionStoragePolyfill, signWithPasskeyAsync, sortObjectKeysRecursively, unwrapKey, verifyExtensionSignature, verifyWithPasskeyAsync, wrapKey };