@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
|
@@ -230,6 +230,33 @@ var DatabaseAPI = class {
|
|
|
230
230
|
}
|
|
231
231
|
};
|
|
232
232
|
|
|
233
|
+
// src/crypto/vaultKey.ts
|
|
234
|
+
function arrayBufferToBase64(buffer) {
|
|
235
|
+
const bytes = buffer instanceof Uint8Array ? buffer : new Uint8Array(buffer);
|
|
236
|
+
if (typeof Buffer !== "undefined") {
|
|
237
|
+
return Buffer.from(bytes).toString("base64");
|
|
238
|
+
}
|
|
239
|
+
let binary = "";
|
|
240
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
241
|
+
const byte = bytes[i];
|
|
242
|
+
if (byte !== void 0) {
|
|
243
|
+
binary += String.fromCharCode(byte);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
return btoa(binary);
|
|
247
|
+
}
|
|
248
|
+
function base64ToArrayBuffer(base64) {
|
|
249
|
+
if (typeof Buffer !== "undefined") {
|
|
250
|
+
return new Uint8Array(Buffer.from(base64, "base64"));
|
|
251
|
+
}
|
|
252
|
+
const binary = atob(base64);
|
|
253
|
+
const bytes = new Uint8Array(binary.length);
|
|
254
|
+
for (let i = 0; i < binary.length; i++) {
|
|
255
|
+
bytes[i] = binary.charCodeAt(i);
|
|
256
|
+
}
|
|
257
|
+
return bytes;
|
|
258
|
+
}
|
|
259
|
+
|
|
233
260
|
// src/api/filesystem.ts
|
|
234
261
|
var FilesystemAPI = class {
|
|
235
262
|
constructor(client) {
|
|
@@ -301,12 +328,7 @@ var FilesystemAPI = class {
|
|
|
301
328
|
HAEXTENSION_METHODS.filesystem.readFile,
|
|
302
329
|
{ path }
|
|
303
330
|
);
|
|
304
|
-
|
|
305
|
-
const bytes = new Uint8Array(binary.length);
|
|
306
|
-
for (let i = 0; i < binary.length; i++) {
|
|
307
|
-
bytes[i] = binary.charCodeAt(i);
|
|
308
|
-
}
|
|
309
|
-
return bytes;
|
|
331
|
+
return base64ToArrayBuffer(base64);
|
|
310
332
|
}
|
|
311
333
|
/**
|
|
312
334
|
* Write file contents
|
|
@@ -314,7 +336,7 @@ var FilesystemAPI = class {
|
|
|
314
336
|
* @param data File contents as Uint8Array
|
|
315
337
|
*/
|
|
316
338
|
async writeFile(path, data) {
|
|
317
|
-
const base64 =
|
|
339
|
+
const base64 = arrayBufferToBase64(data);
|
|
318
340
|
await this.client.request(
|
|
319
341
|
HAEXTENSION_METHODS.filesystem.writeFile,
|
|
320
342
|
{ path, data: base64 }
|
|
@@ -600,7 +622,7 @@ var RemoteStorageAPI = class {
|
|
|
600
622
|
* @param data - Data to upload
|
|
601
623
|
*/
|
|
602
624
|
async upload(backendId, key, data) {
|
|
603
|
-
const base64 =
|
|
625
|
+
const base64 = arrayBufferToBase64(data);
|
|
604
626
|
await this.client.request(HAEXTENSION_METHODS.remoteStorage.upload, {
|
|
605
627
|
backendId,
|
|
606
628
|
key,
|
|
@@ -618,12 +640,7 @@ var RemoteStorageAPI = class {
|
|
|
618
640
|
HAEXTENSION_METHODS.remoteStorage.download,
|
|
619
641
|
{ backendId, key }
|
|
620
642
|
);
|
|
621
|
-
|
|
622
|
-
const bytes = new Uint8Array(binary.length);
|
|
623
|
-
for (let i = 0; i < binary.length; i++) {
|
|
624
|
-
bytes[i] = binary.charCodeAt(i);
|
|
625
|
-
}
|
|
626
|
-
return bytes;
|
|
643
|
+
return base64ToArrayBuffer(base64);
|
|
627
644
|
}
|
|
628
645
|
/**
|
|
629
646
|
* Delete an object from a storage backend
|