@haex-space/vault-sdk 2.5.50 → 2.5.54
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-Bgu2k1yJ.d.ts → client-Dv3ysOWr.d.ts} +14 -1
- package/dist/{client-BDxVgihp.d.mts → client-Y3QEhTe2.d.mts} +14 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +222 -232
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +222 -232
- 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 +31 -14
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +31 -14
- 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 +31 -14
- package/dist/runtime/nuxt.plugin.client.js.map +1 -1
- package/dist/runtime/nuxt.plugin.client.mjs +31 -14
- 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 +31 -14
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +31 -14
- 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 +31 -14
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +31 -14
- package/dist/vue.mjs.map +1 -1
- package/package.json +1 -1
package/dist/vue.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { H as HaexVaultSdk, S as StorageAPI } from './client-
|
|
1
|
+
import { H as HaexVaultSdk, S as StorageAPI } from './client-Y3QEhTe2.mjs';
|
|
2
2
|
import * as drizzle_orm_sqlite_proxy from 'drizzle-orm/sqlite-proxy';
|
|
3
3
|
import { Ref } from 'vue';
|
|
4
4
|
import { H as HaexHubConfig } from './types-DiXJ5SF6.mjs';
|
package/dist/vue.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { H as HaexVaultSdk, S as StorageAPI } from './client-
|
|
1
|
+
import { H as HaexVaultSdk, S as StorageAPI } from './client-Dv3ysOWr.js';
|
|
2
2
|
import * as drizzle_orm_sqlite_proxy from 'drizzle-orm/sqlite-proxy';
|
|
3
3
|
import { Ref } from 'vue';
|
|
4
4
|
import { H as HaexHubConfig } from './types-DiXJ5SF6.js';
|
package/dist/vue.js
CHANGED
|
@@ -558,6 +558,33 @@ var DatabaseAPI = class {
|
|
|
558
558
|
}
|
|
559
559
|
};
|
|
560
560
|
|
|
561
|
+
// src/crypto/vaultKey.ts
|
|
562
|
+
function arrayBufferToBase64(buffer) {
|
|
563
|
+
const bytes = buffer instanceof Uint8Array ? buffer : new Uint8Array(buffer);
|
|
564
|
+
if (typeof Buffer !== "undefined") {
|
|
565
|
+
return Buffer.from(bytes).toString("base64");
|
|
566
|
+
}
|
|
567
|
+
let binary = "";
|
|
568
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
569
|
+
const byte = bytes[i];
|
|
570
|
+
if (byte !== void 0) {
|
|
571
|
+
binary += String.fromCharCode(byte);
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
return btoa(binary);
|
|
575
|
+
}
|
|
576
|
+
function base64ToArrayBuffer(base64) {
|
|
577
|
+
if (typeof Buffer !== "undefined") {
|
|
578
|
+
return new Uint8Array(Buffer.from(base64, "base64"));
|
|
579
|
+
}
|
|
580
|
+
const binary = atob(base64);
|
|
581
|
+
const bytes = new Uint8Array(binary.length);
|
|
582
|
+
for (let i = 0; i < binary.length; i++) {
|
|
583
|
+
bytes[i] = binary.charCodeAt(i);
|
|
584
|
+
}
|
|
585
|
+
return bytes;
|
|
586
|
+
}
|
|
587
|
+
|
|
561
588
|
// src/api/filesystem.ts
|
|
562
589
|
var FilesystemAPI = class {
|
|
563
590
|
constructor(client) {
|
|
@@ -629,12 +656,7 @@ var FilesystemAPI = class {
|
|
|
629
656
|
HAEXTENSION_METHODS.filesystem.readFile,
|
|
630
657
|
{ path }
|
|
631
658
|
);
|
|
632
|
-
|
|
633
|
-
const bytes = new Uint8Array(binary.length);
|
|
634
|
-
for (let i = 0; i < binary.length; i++) {
|
|
635
|
-
bytes[i] = binary.charCodeAt(i);
|
|
636
|
-
}
|
|
637
|
-
return bytes;
|
|
659
|
+
return base64ToArrayBuffer(base64);
|
|
638
660
|
}
|
|
639
661
|
/**
|
|
640
662
|
* Write file contents
|
|
@@ -642,7 +664,7 @@ var FilesystemAPI = class {
|
|
|
642
664
|
* @param data File contents as Uint8Array
|
|
643
665
|
*/
|
|
644
666
|
async writeFile(path, data) {
|
|
645
|
-
const base64 =
|
|
667
|
+
const base64 = arrayBufferToBase64(data);
|
|
646
668
|
await this.client.request(
|
|
647
669
|
HAEXTENSION_METHODS.filesystem.writeFile,
|
|
648
670
|
{ path, data: base64 }
|
|
@@ -928,7 +950,7 @@ var RemoteStorageAPI = class {
|
|
|
928
950
|
* @param data - Data to upload
|
|
929
951
|
*/
|
|
930
952
|
async upload(backendId, key, data) {
|
|
931
|
-
const base64 =
|
|
953
|
+
const base64 = arrayBufferToBase64(data);
|
|
932
954
|
await this.client.request(HAEXTENSION_METHODS.remoteStorage.upload, {
|
|
933
955
|
backendId,
|
|
934
956
|
key,
|
|
@@ -946,12 +968,7 @@ var RemoteStorageAPI = class {
|
|
|
946
968
|
HAEXTENSION_METHODS.remoteStorage.download,
|
|
947
969
|
{ backendId, key }
|
|
948
970
|
);
|
|
949
|
-
|
|
950
|
-
const bytes = new Uint8Array(binary.length);
|
|
951
|
-
for (let i = 0; i < binary.length; i++) {
|
|
952
|
-
bytes[i] = binary.charCodeAt(i);
|
|
953
|
-
}
|
|
954
|
-
return bytes;
|
|
971
|
+
return base64ToArrayBuffer(base64);
|
|
955
972
|
}
|
|
956
973
|
/**
|
|
957
974
|
* Delete an object from a storage backend
|