@haex-space/vault-sdk 2.5.86 → 2.5.88
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-Y1a7Vkgk.d.mts → client-DwGxAKzx.d.mts} +275 -1
- package/dist/{client-DGSamcol.d.ts → client-s83JV-k0.d.ts} +275 -1
- package/dist/index.d.mts +72 -3
- package/dist/index.d.ts +72 -3
- package/dist/index.js +241 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +240 -2
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/react.js +223 -0
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +223 -0
- package/dist/react.mjs.map +1 -1
- package/dist/runtime/nuxt.plugin.client.d.mts +1 -1
- package/dist/runtime/nuxt.plugin.client.d.ts +1 -1
- package/dist/runtime/nuxt.plugin.client.js +223 -0
- package/dist/runtime/nuxt.plugin.client.js.map +1 -1
- package/dist/runtime/nuxt.plugin.client.mjs +223 -0
- package/dist/runtime/nuxt.plugin.client.mjs.map +1 -1
- package/dist/svelte.d.mts +1 -1
- package/dist/svelte.d.ts +1 -1
- package/dist/svelte.js +223 -0
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +223 -0
- package/dist/svelte.mjs.map +1 -1
- package/dist/vue.d.mts +1 -1
- package/dist/vue.d.ts +1 -1
- package/dist/vue.js +223 -0
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +223 -0
- package/dist/vue.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -631,6 +631,52 @@ var REMOTE_STORAGE_COMMANDS = {
|
|
|
631
631
|
list: "extension_remote_storage_list"
|
|
632
632
|
};
|
|
633
633
|
|
|
634
|
+
// src/commands/localsend.ts
|
|
635
|
+
var LOCALSEND_COMMANDS = {
|
|
636
|
+
// Initialization
|
|
637
|
+
/** Initialize LocalSend (generate identity, etc.) */
|
|
638
|
+
init: "localsend_init",
|
|
639
|
+
/** Get our device info */
|
|
640
|
+
getDeviceInfo: "localsend_get_device_info",
|
|
641
|
+
/** Set our device alias */
|
|
642
|
+
setAlias: "localsend_set_alias",
|
|
643
|
+
// Settings
|
|
644
|
+
/** Get current settings */
|
|
645
|
+
getSettings: "localsend_get_settings",
|
|
646
|
+
/** Update settings */
|
|
647
|
+
setSettings: "localsend_set_settings",
|
|
648
|
+
// Discovery (desktop only)
|
|
649
|
+
/** Start device discovery via multicast UDP */
|
|
650
|
+
startDiscovery: "localsend_start_discovery",
|
|
651
|
+
/** Stop device discovery */
|
|
652
|
+
stopDiscovery: "localsend_stop_discovery",
|
|
653
|
+
/** Get list of discovered devices */
|
|
654
|
+
getDevices: "localsend_get_devices",
|
|
655
|
+
// Network scan (mobile only)
|
|
656
|
+
/** Scan network for devices via HTTP */
|
|
657
|
+
scanNetwork: "localsend_scan_network",
|
|
658
|
+
// Server (receiving files)
|
|
659
|
+
/** Start the HTTPS server for receiving files */
|
|
660
|
+
startServer: "localsend_start_server",
|
|
661
|
+
/** Stop the HTTPS server */
|
|
662
|
+
stopServer: "localsend_stop_server",
|
|
663
|
+
/** Get server status */
|
|
664
|
+
getServerStatus: "localsend_get_server_status",
|
|
665
|
+
/** Get pending incoming transfer requests */
|
|
666
|
+
getPendingTransfers: "localsend_get_pending_transfers",
|
|
667
|
+
/** Accept an incoming transfer */
|
|
668
|
+
acceptTransfer: "localsend_accept_transfer",
|
|
669
|
+
/** Reject an incoming transfer */
|
|
670
|
+
rejectTransfer: "localsend_reject_transfer",
|
|
671
|
+
// Client (sending files)
|
|
672
|
+
/** Prepare files for sending - collect metadata */
|
|
673
|
+
prepareFiles: "localsend_prepare_files",
|
|
674
|
+
/** Send files to a device */
|
|
675
|
+
sendFiles: "localsend_send_files",
|
|
676
|
+
/** Cancel an outgoing transfer */
|
|
677
|
+
cancelSend: "localsend_cancel_send"
|
|
678
|
+
};
|
|
679
|
+
|
|
634
680
|
// src/commands/index.ts
|
|
635
681
|
var TAURI_COMMANDS = {
|
|
636
682
|
database: DATABASE_COMMANDS,
|
|
@@ -640,7 +686,8 @@ var TAURI_COMMANDS = {
|
|
|
640
686
|
filesystem: FILESYSTEM_COMMANDS,
|
|
641
687
|
externalBridge: EXTERNAL_BRIDGE_COMMANDS,
|
|
642
688
|
extension: EXTENSION_COMMANDS,
|
|
643
|
-
remoteStorage: REMOTE_STORAGE_COMMANDS
|
|
689
|
+
remoteStorage: REMOTE_STORAGE_COMMANDS,
|
|
690
|
+
localsend: LOCALSEND_COMMANDS
|
|
644
691
|
};
|
|
645
692
|
|
|
646
693
|
// src/api/storage.ts
|
|
@@ -1471,6 +1518,177 @@ var BackendManagement = class {
|
|
|
1471
1518
|
}
|
|
1472
1519
|
};
|
|
1473
1520
|
|
|
1521
|
+
// src/api/localsend.ts
|
|
1522
|
+
var LOCALSEND_EVENTS = {
|
|
1523
|
+
/** New device discovered */
|
|
1524
|
+
deviceDiscovered: "localsend:device-discovered",
|
|
1525
|
+
/** Device lost (no longer visible) */
|
|
1526
|
+
deviceLost: "localsend:device-lost",
|
|
1527
|
+
/** New incoming transfer request */
|
|
1528
|
+
transferRequest: "localsend:transfer-request",
|
|
1529
|
+
/** Transfer progress update */
|
|
1530
|
+
transferProgress: "localsend:transfer-progress",
|
|
1531
|
+
/** Transfer completed */
|
|
1532
|
+
transferComplete: "localsend:transfer-complete",
|
|
1533
|
+
/** Transfer failed */
|
|
1534
|
+
transferFailed: "localsend:transfer-failed"
|
|
1535
|
+
};
|
|
1536
|
+
var LocalSendAPI = class {
|
|
1537
|
+
constructor(client) {
|
|
1538
|
+
this.client = client;
|
|
1539
|
+
}
|
|
1540
|
+
// ==========================================================================
|
|
1541
|
+
// Initialization
|
|
1542
|
+
// ==========================================================================
|
|
1543
|
+
/**
|
|
1544
|
+
* Initialize LocalSend (generate identity, etc.)
|
|
1545
|
+
* Call this on app start
|
|
1546
|
+
* @returns Our device info
|
|
1547
|
+
*/
|
|
1548
|
+
async init() {
|
|
1549
|
+
return this.client.request(LOCALSEND_COMMANDS.init, {});
|
|
1550
|
+
}
|
|
1551
|
+
/**
|
|
1552
|
+
* Get our device info
|
|
1553
|
+
* @returns Our device info
|
|
1554
|
+
*/
|
|
1555
|
+
async getDeviceInfo() {
|
|
1556
|
+
return this.client.request(LOCALSEND_COMMANDS.getDeviceInfo, {});
|
|
1557
|
+
}
|
|
1558
|
+
/**
|
|
1559
|
+
* Set our device alias (display name)
|
|
1560
|
+
* @param alias New alias
|
|
1561
|
+
*/
|
|
1562
|
+
async setAlias(alias) {
|
|
1563
|
+
await this.client.request(LOCALSEND_COMMANDS.setAlias, { alias });
|
|
1564
|
+
}
|
|
1565
|
+
// ==========================================================================
|
|
1566
|
+
// Settings
|
|
1567
|
+
// ==========================================================================
|
|
1568
|
+
/**
|
|
1569
|
+
* Get current LocalSend settings
|
|
1570
|
+
* @returns Settings
|
|
1571
|
+
*/
|
|
1572
|
+
async getSettings() {
|
|
1573
|
+
return this.client.request(LOCALSEND_COMMANDS.getSettings, {});
|
|
1574
|
+
}
|
|
1575
|
+
/**
|
|
1576
|
+
* Update LocalSend settings
|
|
1577
|
+
* @param settings New settings
|
|
1578
|
+
*/
|
|
1579
|
+
async setSettings(settings) {
|
|
1580
|
+
await this.client.request(LOCALSEND_COMMANDS.setSettings, { settings });
|
|
1581
|
+
}
|
|
1582
|
+
// ==========================================================================
|
|
1583
|
+
// Discovery (Desktop only - multicast UDP)
|
|
1584
|
+
// ==========================================================================
|
|
1585
|
+
/**
|
|
1586
|
+
* Start device discovery via multicast UDP
|
|
1587
|
+
* Desktop only - on mobile use scanNetwork()
|
|
1588
|
+
*/
|
|
1589
|
+
async startDiscovery() {
|
|
1590
|
+
await this.client.request(LOCALSEND_COMMANDS.startDiscovery, {});
|
|
1591
|
+
}
|
|
1592
|
+
/**
|
|
1593
|
+
* Stop device discovery
|
|
1594
|
+
* Desktop only
|
|
1595
|
+
*/
|
|
1596
|
+
async stopDiscovery() {
|
|
1597
|
+
await this.client.request(LOCALSEND_COMMANDS.stopDiscovery, {});
|
|
1598
|
+
}
|
|
1599
|
+
/**
|
|
1600
|
+
* Get list of discovered devices
|
|
1601
|
+
* @returns Array of discovered devices
|
|
1602
|
+
*/
|
|
1603
|
+
async getDevices() {
|
|
1604
|
+
return this.client.request(LOCALSEND_COMMANDS.getDevices, {});
|
|
1605
|
+
}
|
|
1606
|
+
// ==========================================================================
|
|
1607
|
+
// Network Scan (Mobile only - HTTP)
|
|
1608
|
+
// ==========================================================================
|
|
1609
|
+
/**
|
|
1610
|
+
* Scan network for devices via HTTP
|
|
1611
|
+
* Mobile only - on desktop use startDiscovery()
|
|
1612
|
+
* @returns Array of discovered devices
|
|
1613
|
+
*/
|
|
1614
|
+
async scanNetwork() {
|
|
1615
|
+
return this.client.request(LOCALSEND_COMMANDS.scanNetwork, {});
|
|
1616
|
+
}
|
|
1617
|
+
// ==========================================================================
|
|
1618
|
+
// Server (Receiving files)
|
|
1619
|
+
// ==========================================================================
|
|
1620
|
+
/**
|
|
1621
|
+
* Start the HTTPS server for receiving files
|
|
1622
|
+
* @param port Optional port to listen on (default: 53317)
|
|
1623
|
+
* @returns Server info with port, fingerprint, and addresses
|
|
1624
|
+
*/
|
|
1625
|
+
async startServer(port) {
|
|
1626
|
+
return this.client.request(LOCALSEND_COMMANDS.startServer, { port });
|
|
1627
|
+
}
|
|
1628
|
+
/**
|
|
1629
|
+
* Stop the HTTPS server
|
|
1630
|
+
*/
|
|
1631
|
+
async stopServer() {
|
|
1632
|
+
await this.client.request(LOCALSEND_COMMANDS.stopServer, {});
|
|
1633
|
+
}
|
|
1634
|
+
/**
|
|
1635
|
+
* Get server status
|
|
1636
|
+
* @returns Server status
|
|
1637
|
+
*/
|
|
1638
|
+
async getServerStatus() {
|
|
1639
|
+
return this.client.request(LOCALSEND_COMMANDS.getServerStatus, {});
|
|
1640
|
+
}
|
|
1641
|
+
/**
|
|
1642
|
+
* Get pending incoming transfer requests
|
|
1643
|
+
* @returns Array of pending transfers
|
|
1644
|
+
*/
|
|
1645
|
+
async getPendingTransfers() {
|
|
1646
|
+
return this.client.request(LOCALSEND_COMMANDS.getPendingTransfers, {});
|
|
1647
|
+
}
|
|
1648
|
+
/**
|
|
1649
|
+
* Accept an incoming transfer
|
|
1650
|
+
* @param sessionId Session ID of the transfer
|
|
1651
|
+
* @param saveDir Directory to save files to
|
|
1652
|
+
*/
|
|
1653
|
+
async acceptTransfer(sessionId, saveDir) {
|
|
1654
|
+
await this.client.request(LOCALSEND_COMMANDS.acceptTransfer, { sessionId, saveDir });
|
|
1655
|
+
}
|
|
1656
|
+
/**
|
|
1657
|
+
* Reject an incoming transfer
|
|
1658
|
+
* @param sessionId Session ID of the transfer
|
|
1659
|
+
*/
|
|
1660
|
+
async rejectTransfer(sessionId) {
|
|
1661
|
+
await this.client.request(LOCALSEND_COMMANDS.rejectTransfer, { sessionId });
|
|
1662
|
+
}
|
|
1663
|
+
// ==========================================================================
|
|
1664
|
+
// Client (Sending files)
|
|
1665
|
+
// ==========================================================================
|
|
1666
|
+
/**
|
|
1667
|
+
* Prepare files for sending - collect metadata
|
|
1668
|
+
* @param paths Array of file/folder paths to send
|
|
1669
|
+
* @returns Array of file info with metadata
|
|
1670
|
+
*/
|
|
1671
|
+
async prepareFiles(paths) {
|
|
1672
|
+
return this.client.request(LOCALSEND_COMMANDS.prepareFiles, { paths });
|
|
1673
|
+
}
|
|
1674
|
+
/**
|
|
1675
|
+
* Send files to a device
|
|
1676
|
+
* @param device Target device
|
|
1677
|
+
* @param files Files to send (from prepareFiles)
|
|
1678
|
+
* @returns Session ID for tracking progress
|
|
1679
|
+
*/
|
|
1680
|
+
async sendFiles(device, files) {
|
|
1681
|
+
return this.client.request(LOCALSEND_COMMANDS.sendFiles, { device, files });
|
|
1682
|
+
}
|
|
1683
|
+
/**
|
|
1684
|
+
* Cancel an outgoing transfer
|
|
1685
|
+
* @param sessionId Session ID of the transfer
|
|
1686
|
+
*/
|
|
1687
|
+
async cancelSend(sessionId) {
|
|
1688
|
+
await this.client.request(LOCALSEND_COMMANDS.cancelSend, { sessionId });
|
|
1689
|
+
}
|
|
1690
|
+
};
|
|
1691
|
+
|
|
1474
1692
|
// src/client/tableName.ts
|
|
1475
1693
|
function validatePublicKey(publicKey) {
|
|
1476
1694
|
if (!publicKey || typeof publicKey !== "string" || publicKey.trim() === "") {
|
|
@@ -1650,6 +1868,25 @@ async function setupTauriEventListeners(ctx, log, onEvent, onContextChange) {
|
|
|
1650
1868
|
console.error("[HaexVault SDK] Failed to setup file change listener:", error);
|
|
1651
1869
|
log("Failed to setup file change listener:", error);
|
|
1652
1870
|
}
|
|
1871
|
+
console.log("[HaexVault SDK] About to register sync tables updated listener for:", HAEXTENSION_EVENTS.SYNC_TABLES_UPDATED);
|
|
1872
|
+
try {
|
|
1873
|
+
await listen(HAEXTENSION_EVENTS.SYNC_TABLES_UPDATED, (event) => {
|
|
1874
|
+
console.log("[HaexVault SDK] Sync tables updated event received:", event.payload);
|
|
1875
|
+
log("Received sync tables updated event:", event);
|
|
1876
|
+
if (event.payload) {
|
|
1877
|
+
const payload = event.payload;
|
|
1878
|
+
onEvent({
|
|
1879
|
+
type: HAEXTENSION_EVENTS.SYNC_TABLES_UPDATED,
|
|
1880
|
+
data: { tables: payload.tables },
|
|
1881
|
+
timestamp: Date.now()
|
|
1882
|
+
});
|
|
1883
|
+
}
|
|
1884
|
+
});
|
|
1885
|
+
console.log("[HaexVault SDK] Sync tables updated listener registered successfully");
|
|
1886
|
+
} catch (error) {
|
|
1887
|
+
console.error("[HaexVault SDK] Failed to setup sync tables updated listener:", error);
|
|
1888
|
+
log("Failed to setup sync tables updated listener:", error);
|
|
1889
|
+
}
|
|
1653
1890
|
}
|
|
1654
1891
|
async function initIframeMode(ctx, log, messageHandler, request) {
|
|
1655
1892
|
if (!isInIframe()) {
|
|
@@ -1983,6 +2220,7 @@ var HaexVaultSdk = class {
|
|
|
1983
2220
|
this.web = new WebAPI(this);
|
|
1984
2221
|
this.permissions = new PermissionsAPI(this);
|
|
1985
2222
|
this.remoteStorage = new RemoteStorageAPI(this);
|
|
2223
|
+
this.localsend = new LocalSendAPI(this);
|
|
1986
2224
|
installConsoleForwarding(this.config.debug);
|
|
1987
2225
|
this.readyPromise = new Promise((resolve) => {
|
|
1988
2226
|
this.resolveReady = resolve;
|
|
@@ -2559,6 +2797,6 @@ function createHaexVaultSdk(config = {}) {
|
|
|
2559
2797
|
return new HaexVaultSdk(config);
|
|
2560
2798
|
}
|
|
2561
2799
|
|
|
2562
|
-
export { COSE_ALGORITHM, DEFAULT_TIMEOUT, DatabaseAPI, EXTERNAL_EVENTS, ErrorCode, ExternalConnectionErrorCode, ExternalConnectionState, FilesystemAPI, HAEXSPACE_MESSAGE_TYPES, HAEXTENSION_EVENTS, HaexVaultSdk, HaexVaultSdkError, PermissionStatus, PermissionsAPI, RemoteStorageAPI, TABLE_SEPARATOR, TAURI_COMMANDS, WebAPI, arrayBufferToBase64, base64ToArrayBuffer, canExternalClientSendRequests, createHaexVaultSdk, decryptCrdtData, decryptString, decryptVaultKey, decryptVaultName, deriveKeyFromPassword, encryptCrdtData, encryptString, encryptVaultKey, exportKeyPairAsync, exportPrivateKeyAsync, exportPublicKeyAsync, exportPublicKeyCoseAsync, generateCredentialId, generatePasskeyPairAsync, generateVaultKey, getTableName, hexToBytes, importPrivateKeyAsync, importPublicKeyAsync, installBaseTag, installCookiePolyfill, installHistoryPolyfill, installLocalStoragePolyfill, installPolyfills, installSessionStoragePolyfill, isExternalClientConnected, signWithPasskeyAsync, sortObjectKeysRecursively, unwrapKey, verifyExtensionSignature, verifyWithPasskeyAsync, wrapKey };
|
|
2800
|
+
export { COSE_ALGORITHM, DEFAULT_TIMEOUT, DatabaseAPI, EXTERNAL_EVENTS, ErrorCode, ExternalConnectionErrorCode, ExternalConnectionState, FilesystemAPI, HAEXSPACE_MESSAGE_TYPES, HAEXTENSION_EVENTS, HaexVaultSdk, HaexVaultSdkError, LOCALSEND_EVENTS, LocalSendAPI, PermissionStatus, PermissionsAPI, RemoteStorageAPI, TABLE_SEPARATOR, TAURI_COMMANDS, WebAPI, arrayBufferToBase64, base64ToArrayBuffer, canExternalClientSendRequests, createHaexVaultSdk, decryptCrdtData, decryptString, decryptVaultKey, decryptVaultName, deriveKeyFromPassword, encryptCrdtData, encryptString, encryptVaultKey, exportKeyPairAsync, exportPrivateKeyAsync, exportPublicKeyAsync, exportPublicKeyCoseAsync, generateCredentialId, generatePasskeyPairAsync, generateVaultKey, getTableName, hexToBytes, importPrivateKeyAsync, importPublicKeyAsync, installBaseTag, installCookiePolyfill, installHistoryPolyfill, installLocalStoragePolyfill, installPolyfills, installSessionStoragePolyfill, isExternalClientConnected, signWithPasskeyAsync, sortObjectKeysRecursively, unwrapKey, verifyExtensionSignature, verifyWithPasskeyAsync, wrapKey };
|
|
2563
2801
|
//# sourceMappingURL=index.mjs.map
|
|
2564
2802
|
//# sourceMappingURL=index.mjs.map
|