@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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as nuxt_app from 'nuxt/app';
|
|
2
2
|
import { ShallowRef } from 'vue';
|
|
3
|
-
import { H as HaexVaultSdk } from '../client-
|
|
3
|
+
import { H as HaexVaultSdk } from '../client-Y3QEhTe2.mjs';
|
|
4
4
|
import { A as ApplicationContext } from '../types-DiXJ5SF6.mjs';
|
|
5
5
|
import 'drizzle-orm/sqlite-proxy';
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as nuxt_app from 'nuxt/app';
|
|
2
2
|
import { ShallowRef } from 'vue';
|
|
3
|
-
import { H as HaexVaultSdk } from '../client-
|
|
3
|
+
import { H as HaexVaultSdk } from '../client-Dv3ysOWr.js';
|
|
4
4
|
import { A as ApplicationContext } from '../types-DiXJ5SF6.js';
|
|
5
5
|
import 'drizzle-orm/sqlite-proxy';
|
|
6
6
|
|
|
@@ -232,6 +232,33 @@ var DatabaseAPI = class {
|
|
|
232
232
|
}
|
|
233
233
|
};
|
|
234
234
|
|
|
235
|
+
// src/crypto/vaultKey.ts
|
|
236
|
+
function arrayBufferToBase64(buffer) {
|
|
237
|
+
const bytes = buffer instanceof Uint8Array ? buffer : new Uint8Array(buffer);
|
|
238
|
+
if (typeof Buffer !== "undefined") {
|
|
239
|
+
return Buffer.from(bytes).toString("base64");
|
|
240
|
+
}
|
|
241
|
+
let binary = "";
|
|
242
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
243
|
+
const byte = bytes[i];
|
|
244
|
+
if (byte !== void 0) {
|
|
245
|
+
binary += String.fromCharCode(byte);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
return btoa(binary);
|
|
249
|
+
}
|
|
250
|
+
function base64ToArrayBuffer(base64) {
|
|
251
|
+
if (typeof Buffer !== "undefined") {
|
|
252
|
+
return new Uint8Array(Buffer.from(base64, "base64"));
|
|
253
|
+
}
|
|
254
|
+
const binary = atob(base64);
|
|
255
|
+
const bytes = new Uint8Array(binary.length);
|
|
256
|
+
for (let i = 0; i < binary.length; i++) {
|
|
257
|
+
bytes[i] = binary.charCodeAt(i);
|
|
258
|
+
}
|
|
259
|
+
return bytes;
|
|
260
|
+
}
|
|
261
|
+
|
|
235
262
|
// src/api/filesystem.ts
|
|
236
263
|
var FilesystemAPI = class {
|
|
237
264
|
constructor(client) {
|
|
@@ -303,12 +330,7 @@ var FilesystemAPI = class {
|
|
|
303
330
|
HAEXTENSION_METHODS.filesystem.readFile,
|
|
304
331
|
{ path }
|
|
305
332
|
);
|
|
306
|
-
|
|
307
|
-
const bytes = new Uint8Array(binary.length);
|
|
308
|
-
for (let i = 0; i < binary.length; i++) {
|
|
309
|
-
bytes[i] = binary.charCodeAt(i);
|
|
310
|
-
}
|
|
311
|
-
return bytes;
|
|
333
|
+
return base64ToArrayBuffer(base64);
|
|
312
334
|
}
|
|
313
335
|
/**
|
|
314
336
|
* Write file contents
|
|
@@ -316,7 +338,7 @@ var FilesystemAPI = class {
|
|
|
316
338
|
* @param data File contents as Uint8Array
|
|
317
339
|
*/
|
|
318
340
|
async writeFile(path, data) {
|
|
319
|
-
const base64 =
|
|
341
|
+
const base64 = arrayBufferToBase64(data);
|
|
320
342
|
await this.client.request(
|
|
321
343
|
HAEXTENSION_METHODS.filesystem.writeFile,
|
|
322
344
|
{ path, data: base64 }
|
|
@@ -602,7 +624,7 @@ var RemoteStorageAPI = class {
|
|
|
602
624
|
* @param data - Data to upload
|
|
603
625
|
*/
|
|
604
626
|
async upload(backendId, key, data) {
|
|
605
|
-
const base64 =
|
|
627
|
+
const base64 = arrayBufferToBase64(data);
|
|
606
628
|
await this.client.request(HAEXTENSION_METHODS.remoteStorage.upload, {
|
|
607
629
|
backendId,
|
|
608
630
|
key,
|
|
@@ -620,12 +642,7 @@ var RemoteStorageAPI = class {
|
|
|
620
642
|
HAEXTENSION_METHODS.remoteStorage.download,
|
|
621
643
|
{ backendId, key }
|
|
622
644
|
);
|
|
623
|
-
|
|
624
|
-
const bytes = new Uint8Array(binary.length);
|
|
625
|
-
for (let i = 0; i < binary.length; i++) {
|
|
626
|
-
bytes[i] = binary.charCodeAt(i);
|
|
627
|
-
}
|
|
628
|
-
return bytes;
|
|
645
|
+
return base64ToArrayBuffer(base64);
|
|
629
646
|
}
|
|
630
647
|
/**
|
|
631
648
|
* Delete an object from a storage backend
|