@fileverse/api 0.0.13 → 0.0.14
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/cli/index.js +20 -8
- package/dist/cli/index.js.map +1 -1
- package/dist/cloudflare.js +145 -47
- package/dist/cloudflare.js.map +1 -1
- package/dist/commands/index.js +21 -9
- package/dist/commands/index.js.map +1 -1
- package/dist/index.js +142 -44
- package/dist/index.js.map +1 -1
- package/dist/worker.js +128 -30
- package/dist/worker.js.map +1 -1
- package/package.json +1 -2
package/dist/cli/index.js
CHANGED
|
@@ -246,12 +246,24 @@ var init_key_store = __esm({
|
|
|
246
246
|
}
|
|
247
247
|
});
|
|
248
248
|
|
|
249
|
+
// src/sdk/ucan.ts
|
|
250
|
+
import { sign, extractPublicKeyFromSecretKey } from "@stablelib/ed25519";
|
|
251
|
+
import { toUint8Array as toUint8Array2 } from "js-base64";
|
|
252
|
+
var EDWARDS_DID_PREFIX;
|
|
253
|
+
var init_ucan = __esm({
|
|
254
|
+
"src/sdk/ucan.ts"() {
|
|
255
|
+
"use strict";
|
|
256
|
+
init_esm_shims();
|
|
257
|
+
EDWARDS_DID_PREFIX = new Uint8Array([237, 1]);
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
|
|
249
261
|
// src/sdk/auth-token-provider.ts
|
|
250
|
-
import * as ucans from "@ucans/ucans";
|
|
251
262
|
var init_auth_token_provider = __esm({
|
|
252
263
|
"src/sdk/auth-token-provider.ts"() {
|
|
253
264
|
"use strict";
|
|
254
265
|
init_esm_shims();
|
|
266
|
+
init_ucan();
|
|
255
267
|
}
|
|
256
268
|
});
|
|
257
269
|
|
|
@@ -344,7 +356,7 @@ import { derivePBKDF2Key, encryptAesCBC } from "@fileverse/crypto/kdf";
|
|
|
344
356
|
import { secretBoxEncrypt } from "@fileverse/crypto/nacl";
|
|
345
357
|
import hkdf from "futoin-hkdf";
|
|
346
358
|
import tweetnacl from "tweetnacl";
|
|
347
|
-
import { fromUint8Array, toUint8Array as
|
|
359
|
+
import { fromUint8Array, toUint8Array as toUint8Array3 } from "js-base64";
|
|
348
360
|
import { toAESKey, aesEncrypt } from "@fileverse/crypto/webcrypto";
|
|
349
361
|
import axios2 from "axios";
|
|
350
362
|
import { encodeFunctionData, parseEventLogs } from "viem";
|
|
@@ -358,7 +370,7 @@ var init_file_utils = __esm({
|
|
|
358
370
|
});
|
|
359
371
|
|
|
360
372
|
// src/sdk/file-manager.ts
|
|
361
|
-
import { fromUint8Array as fromUint8Array2, toUint8Array as
|
|
373
|
+
import { fromUint8Array as fromUint8Array2, toUint8Array as toUint8Array4 } from "js-base64";
|
|
362
374
|
import { generateAESKey, exportAESKey } from "@fileverse/crypto/webcrypto";
|
|
363
375
|
import { markdownToYjs } from "@fileverse/content-processor";
|
|
364
376
|
var init_file_manager = __esm({
|
|
@@ -373,11 +385,10 @@ var init_file_manager = __esm({
|
|
|
373
385
|
});
|
|
374
386
|
|
|
375
387
|
// src/domain/portal/publish.ts
|
|
376
|
-
import { fromUint8Array as fromUint8Array3, toUint8Array as
|
|
388
|
+
import { fromUint8Array as fromUint8Array3, toUint8Array as toUint8Array5 } from "js-base64";
|
|
377
389
|
import { stringToBytes } from "viem";
|
|
378
390
|
import { deriveHKDFKey } from "@fileverse/crypto/kdf";
|
|
379
391
|
import { generateKeyPairFromSeed } from "@stablelib/ed25519";
|
|
380
|
-
import * as ucans2 from "@ucans/ucans";
|
|
381
392
|
var init_publish = __esm({
|
|
382
393
|
"src/domain/portal/publish.ts"() {
|
|
383
394
|
"use strict";
|
|
@@ -386,6 +397,7 @@ var init_publish = __esm({
|
|
|
386
397
|
init_infra();
|
|
387
398
|
init_key_store();
|
|
388
399
|
init_auth_token_provider();
|
|
400
|
+
init_ucan();
|
|
389
401
|
init_smart_agent();
|
|
390
402
|
init_file_manager();
|
|
391
403
|
init_config();
|
|
@@ -1397,7 +1409,7 @@ init_saveApiKey();
|
|
|
1397
1409
|
init_apikeys_model();
|
|
1398
1410
|
init_infra();
|
|
1399
1411
|
import { deriveHKDFKey as deriveHKDFKey2 } from "@fileverse/crypto/hkdf";
|
|
1400
|
-
import { toUint8Array as
|
|
1412
|
+
import { toUint8Array as toUint8Array6 } from "js-base64";
|
|
1401
1413
|
import { stringToBytes as stringToBytes2 } from "viem";
|
|
1402
1414
|
import { toAESKey as toAESKey2, aesDecrypt } from "@fileverse/crypto/webcrypto";
|
|
1403
1415
|
var SAVED_DATA_ENCRYPTION_KEY_INFO = "SAVED_DATA_ENCRYPTION_KEY";
|
|
@@ -1422,7 +1434,7 @@ async function initializeWithData(data) {
|
|
|
1422
1434
|
}
|
|
1423
1435
|
var getAesKeyFromApiKey = async (apiKey) => {
|
|
1424
1436
|
const rawSecret = deriveHKDFKey2(
|
|
1425
|
-
|
|
1437
|
+
toUint8Array6(apiKey),
|
|
1426
1438
|
new Uint8Array([0]),
|
|
1427
1439
|
stringToBytes2(SAVED_DATA_ENCRYPTION_KEY_INFO)
|
|
1428
1440
|
);
|
|
@@ -1433,7 +1445,7 @@ var bytestToJSON = (bytes) => {
|
|
|
1433
1445
|
};
|
|
1434
1446
|
var decryptSavedData = async (apiKey, encryptedData) => {
|
|
1435
1447
|
const aesKey = await getAesKeyFromApiKey(apiKey);
|
|
1436
|
-
const decryptedBytes = await aesDecrypt(aesKey,
|
|
1448
|
+
const decryptedBytes = await aesDecrypt(aesKey, toUint8Array6(encryptedData));
|
|
1437
1449
|
const data = bytestToJSON(decryptedBytes);
|
|
1438
1450
|
return data;
|
|
1439
1451
|
};
|