@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/commands/index.js
CHANGED
|
@@ -848,12 +848,24 @@ var init_key_store = __esm({
|
|
|
848
848
|
}
|
|
849
849
|
});
|
|
850
850
|
|
|
851
|
+
// src/sdk/ucan.ts
|
|
852
|
+
import { sign, extractPublicKeyFromSecretKey } from "@stablelib/ed25519";
|
|
853
|
+
import { toUint8Array } from "js-base64";
|
|
854
|
+
var EDWARDS_DID_PREFIX;
|
|
855
|
+
var init_ucan = __esm({
|
|
856
|
+
"src/sdk/ucan.ts"() {
|
|
857
|
+
"use strict";
|
|
858
|
+
init_esm_shims();
|
|
859
|
+
EDWARDS_DID_PREFIX = new Uint8Array([237, 1]);
|
|
860
|
+
}
|
|
861
|
+
});
|
|
862
|
+
|
|
851
863
|
// src/sdk/auth-token-provider.ts
|
|
852
|
-
import * as ucans from "@ucans/ucans";
|
|
853
864
|
var init_auth_token_provider = __esm({
|
|
854
865
|
"src/sdk/auth-token-provider.ts"() {
|
|
855
866
|
"use strict";
|
|
856
867
|
init_esm_shims();
|
|
868
|
+
init_ucan();
|
|
857
869
|
}
|
|
858
870
|
});
|
|
859
871
|
|
|
@@ -946,7 +958,7 @@ import { derivePBKDF2Key, encryptAesCBC } from "@fileverse/crypto/kdf";
|
|
|
946
958
|
import { secretBoxEncrypt } from "@fileverse/crypto/nacl";
|
|
947
959
|
import hkdf from "futoin-hkdf";
|
|
948
960
|
import tweetnacl from "tweetnacl";
|
|
949
|
-
import { fromUint8Array, toUint8Array } from "js-base64";
|
|
961
|
+
import { fromUint8Array, toUint8Array as toUint8Array2 } from "js-base64";
|
|
950
962
|
import { toAESKey, aesEncrypt } from "@fileverse/crypto/webcrypto";
|
|
951
963
|
import axios from "axios";
|
|
952
964
|
import { encodeFunctionData, parseEventLogs } from "viem";
|
|
@@ -964,15 +976,15 @@ var init_file_utils = __esm({
|
|
|
964
976
|
});
|
|
965
977
|
};
|
|
966
978
|
getExistingEncryptionMaterial = async (existingEncryptedSecretKey, existingNonce, docId) => {
|
|
967
|
-
const derivedKey = await deriveKeyFromAg2Hash(docId,
|
|
979
|
+
const derivedKey = await deriveKeyFromAg2Hash(docId, toUint8Array2(existingNonce));
|
|
968
980
|
const secretKey = tweetnacl.secretbox.open(
|
|
969
|
-
|
|
970
|
-
|
|
981
|
+
toUint8Array2(existingEncryptedSecretKey),
|
|
982
|
+
toUint8Array2(existingNonce),
|
|
971
983
|
derivedKey
|
|
972
984
|
);
|
|
973
985
|
return {
|
|
974
986
|
encryptedSecretKey: existingEncryptedSecretKey,
|
|
975
|
-
nonce:
|
|
987
|
+
nonce: toUint8Array2(existingNonce),
|
|
976
988
|
secretKey,
|
|
977
989
|
derivedKey: new Uint8Array(derivedKey)
|
|
978
990
|
};
|
|
@@ -1000,7 +1012,7 @@ var init_file_utils = __esm({
|
|
|
1000
1012
|
});
|
|
1001
1013
|
|
|
1002
1014
|
// src/sdk/file-manager.ts
|
|
1003
|
-
import { fromUint8Array as fromUint8Array2, toUint8Array as
|
|
1015
|
+
import { fromUint8Array as fromUint8Array2, toUint8Array as toUint8Array3 } from "js-base64";
|
|
1004
1016
|
import { generateAESKey, exportAESKey } from "@fileverse/crypto/webcrypto";
|
|
1005
1017
|
import { markdownToYjs } from "@fileverse/content-processor";
|
|
1006
1018
|
var init_file_manager = __esm({
|
|
@@ -1015,11 +1027,10 @@ var init_file_manager = __esm({
|
|
|
1015
1027
|
});
|
|
1016
1028
|
|
|
1017
1029
|
// src/domain/portal/publish.ts
|
|
1018
|
-
import { fromUint8Array as fromUint8Array3, toUint8Array as
|
|
1030
|
+
import { fromUint8Array as fromUint8Array3, toUint8Array as toUint8Array4 } from "js-base64";
|
|
1019
1031
|
import { stringToBytes } from "viem";
|
|
1020
1032
|
import { deriveHKDFKey } from "@fileverse/crypto/kdf";
|
|
1021
1033
|
import { generateKeyPairFromSeed } from "@stablelib/ed25519";
|
|
1022
|
-
import * as ucans2 from "@ucans/ucans";
|
|
1023
1034
|
var init_publish = __esm({
|
|
1024
1035
|
"src/domain/portal/publish.ts"() {
|
|
1025
1036
|
"use strict";
|
|
@@ -1028,6 +1039,7 @@ var init_publish = __esm({
|
|
|
1028
1039
|
init_infra();
|
|
1029
1040
|
init_key_store();
|
|
1030
1041
|
init_auth_token_provider();
|
|
1042
|
+
init_ucan();
|
|
1031
1043
|
init_smart_agent();
|
|
1032
1044
|
init_file_manager();
|
|
1033
1045
|
init_config();
|