@haex-space/vault-sdk 2.5.100 → 2.5.102

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,113 @@ 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
+ *
94
+ * When using the sync server's S3 proxy, the client authenticates with their
95
+ * existing auth token (Bearer token), so accessKeyId and secretAccessKey are
96
+ * not needed.
97
+ *
98
+ * For direct S3 access to providers like AWS S3 or Wasabi, the client would
99
+ * provide their own credentials.
100
+ */
101
+ interface StorageConfig {
102
+ /** S3 endpoint URL (e.g., "https://sync.haex.space/storage/s3") */
103
+ endpoint: string;
104
+ /** User's bucket name (e.g., "storage-{user_id}") */
105
+ bucket: string;
106
+ /** S3 region (usually "auto" for Supabase/proxy) */
107
+ region: string;
108
+ /** Access Key ID - only needed for direct S3 access (AWS, Wasabi, etc.) */
109
+ accessKeyId?: string;
110
+ /** Secret Access Key - only needed for direct S3 access (AWS, Wasabi, etc.) */
111
+ secretAccessKey?: string;
112
+ }
113
+ /**
114
+ * User info returned from auth endpoints
115
+ */
116
+ interface AuthUser {
117
+ /** User's unique ID (UUID) */
118
+ id: string;
119
+ /** User's email address */
120
+ email: string;
121
+ }
122
+ /**
123
+ * Response from POST /auth/login and POST /auth/refresh endpoints.
124
+ *
125
+ * Contains:
126
+ * - Session tokens for vault sync (access_token, refresh_token)
127
+ * - Pre-configured S3 storage settings (storage_config)
128
+ *
129
+ * The access_token is used for both vault sync operations and S3 proxy access.
130
+ * The sync server's S3 proxy validates the token and forwards requests to
131
+ * the underlying storage backend.
132
+ */
133
+ interface LoginResponse {
134
+ /** JWT access token for vault sync and storage operations */
135
+ access_token: string;
136
+ /** Refresh token for obtaining new access tokens */
137
+ refresh_token: string;
138
+ /** Token validity in seconds */
139
+ expires_in: number;
140
+ /** Token expiration timestamp (Unix epoch) */
141
+ expires_at: number;
142
+ /** Authenticated user info */
143
+ user: AuthUser;
144
+ /**
145
+ * Pre-configured S3 storage settings.
146
+ * Contains the proxy endpoint and bucket name for the user's storage.
147
+ */
148
+ storage_config?: StorageConfig;
149
+ }
150
+ /**
151
+ * Request body for POST /auth/login
152
+ */
153
+ interface LoginRequest {
154
+ /** User's email address */
155
+ email: string;
156
+ /** User's password */
157
+ password: string;
158
+ }
159
+ /**
160
+ * Request body for POST /auth/refresh
161
+ */
162
+ interface RefreshRequest {
163
+ /** Refresh token from previous login/refresh response */
164
+ refresh_token: string;
165
+ }
166
+ /**
167
+ * Server health check response from GET /
168
+ * Contains server info and Supabase configuration.
169
+ */
170
+ interface ServerInfo {
171
+ /** Server name (e.g., "haex-sync-server") */
172
+ name: string;
173
+ /** Server version (e.g., "0.2.7") */
174
+ version: string;
175
+ /** Server status (should be "ok") */
176
+ status: string;
177
+ /** Environment (e.g., "development", "production") */
178
+ env: string;
179
+ /** Supabase URL for client initialization */
180
+ supabaseUrl: string;
181
+ /** Supabase anon key for client initialization */
182
+ supabaseAnonKey: string;
183
+ }
184
+ /**
185
+ * Error response from sync server endpoints
186
+ */
187
+ interface ErrorResponse {
188
+ /** Error message */
189
+ error: string;
190
+ }
191
+
85
192
  /**
86
193
  * Central message type definitions for HaexSpace SDK
87
194
  *
@@ -690,4 +797,4 @@ declare function exportKeyPairAsync(keyPair: PasskeyKeyPair): Promise<ExportedPa
690
797
 
691
798
  declare function createHaexVaultSdk(config?: HaexHubConfig): HaexVaultSdk;
692
799
 
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 };
800
+ 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,113 @@ 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
+ *
94
+ * When using the sync server's S3 proxy, the client authenticates with their
95
+ * existing auth token (Bearer token), so accessKeyId and secretAccessKey are
96
+ * not needed.
97
+ *
98
+ * For direct S3 access to providers like AWS S3 or Wasabi, the client would
99
+ * provide their own credentials.
100
+ */
101
+ interface StorageConfig {
102
+ /** S3 endpoint URL (e.g., "https://sync.haex.space/storage/s3") */
103
+ endpoint: string;
104
+ /** User's bucket name (e.g., "storage-{user_id}") */
105
+ bucket: string;
106
+ /** S3 region (usually "auto" for Supabase/proxy) */
107
+ region: string;
108
+ /** Access Key ID - only needed for direct S3 access (AWS, Wasabi, etc.) */
109
+ accessKeyId?: string;
110
+ /** Secret Access Key - only needed for direct S3 access (AWS, Wasabi, etc.) */
111
+ secretAccessKey?: string;
112
+ }
113
+ /**
114
+ * User info returned from auth endpoints
115
+ */
116
+ interface AuthUser {
117
+ /** User's unique ID (UUID) */
118
+ id: string;
119
+ /** User's email address */
120
+ email: string;
121
+ }
122
+ /**
123
+ * Response from POST /auth/login and POST /auth/refresh endpoints.
124
+ *
125
+ * Contains:
126
+ * - Session tokens for vault sync (access_token, refresh_token)
127
+ * - Pre-configured S3 storage settings (storage_config)
128
+ *
129
+ * The access_token is used for both vault sync operations and S3 proxy access.
130
+ * The sync server's S3 proxy validates the token and forwards requests to
131
+ * the underlying storage backend.
132
+ */
133
+ interface LoginResponse {
134
+ /** JWT access token for vault sync and storage operations */
135
+ access_token: string;
136
+ /** Refresh token for obtaining new access tokens */
137
+ refresh_token: string;
138
+ /** Token validity in seconds */
139
+ expires_in: number;
140
+ /** Token expiration timestamp (Unix epoch) */
141
+ expires_at: number;
142
+ /** Authenticated user info */
143
+ user: AuthUser;
144
+ /**
145
+ * Pre-configured S3 storage settings.
146
+ * Contains the proxy endpoint and bucket name for the user's storage.
147
+ */
148
+ storage_config?: StorageConfig;
149
+ }
150
+ /**
151
+ * Request body for POST /auth/login
152
+ */
153
+ interface LoginRequest {
154
+ /** User's email address */
155
+ email: string;
156
+ /** User's password */
157
+ password: string;
158
+ }
159
+ /**
160
+ * Request body for POST /auth/refresh
161
+ */
162
+ interface RefreshRequest {
163
+ /** Refresh token from previous login/refresh response */
164
+ refresh_token: string;
165
+ }
166
+ /**
167
+ * Server health check response from GET /
168
+ * Contains server info and Supabase configuration.
169
+ */
170
+ interface ServerInfo {
171
+ /** Server name (e.g., "haex-sync-server") */
172
+ name: string;
173
+ /** Server version (e.g., "0.2.7") */
174
+ version: string;
175
+ /** Server status (should be "ok") */
176
+ status: string;
177
+ /** Environment (e.g., "development", "production") */
178
+ env: string;
179
+ /** Supabase URL for client initialization */
180
+ supabaseUrl: string;
181
+ /** Supabase anon key for client initialization */
182
+ supabaseAnonKey: string;
183
+ }
184
+ /**
185
+ * Error response from sync server endpoints
186
+ */
187
+ interface ErrorResponse {
188
+ /** Error message */
189
+ error: string;
190
+ }
191
+
85
192
  /**
86
193
  * Central message type definitions for HaexSpace SDK
87
194
  *
@@ -690,4 +797,4 @@ declare function exportKeyPairAsync(keyPair: PasskeyKeyPair): Promise<ExportedPa
690
797
 
691
798
  declare function createHaexVaultSdk(config?: HaexHubConfig): HaexVaultSdk;
692
799
 
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 };
800
+ 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 };