@vrtmrz/livesync-commonlib 0.1.31 → 0.1.33
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/README.md +12 -0
- package/dist/API/DirectFileManipulatorV2.d.ts +2 -0
- package/dist/API/DirectFileManipulatorV2.js +17 -5
- package/dist/API/processSetting.d.ts +19 -0
- package/dist/API/processSetting.js +91 -6
- package/dist/common/idDerivation.d.ts +15 -0
- package/dist/common/idDerivation.js +102 -0
- package/dist/common/models/db.definition.d.ts +1 -0
- package/dist/common/models/setting.const.defaults.js +3 -0
- package/dist/common/models/setting.const.qr.js +4 -1
- package/dist/common/models/setting.type.d.ts +6 -0
- package/dist/common/models/tweak.compatibility.js +6 -2
- package/dist/common/models/tweak.definition.d.ts +8 -0
- package/dist/common/models/tweak.definition.js +4 -3
- package/dist/common/settingConstants.d.ts +3 -0
- package/dist/common/utils.js +3 -1
- package/dist/events/coreEvents.d.ts +3 -0
- package/dist/events/coreEvents.js +2 -0
- package/dist/hashing.d.ts +3 -0
- package/dist/hashing.js +4 -0
- package/dist/managers/EntryManager/EntryManagerImpls.js +10 -1
- package/dist/managers/HashManager/HashManager.d.ts +4 -0
- package/dist/managers/HashManager/HashManager.js +34 -2
- package/dist/managers/LiveSyncManagers.js +6 -0
- package/dist/pouchdb/LiveSyncDBFunctions.d.ts +1 -1
- package/dist/pouchdb/LiveSyncDBFunctions.js +33 -38
- package/dist/pouchdb/negotiation.js +7 -3
- package/dist/pouchdb/remoteFeatureCompatibility.d.ts +10 -0
- package/dist/pouchdb/remoteFeatureCompatibility.js +12 -1
- package/dist/pouchdb/remoteIdCompatibility.d.ts +5 -0
- package/dist/pouchdb/remoteIdCompatibility.js +28 -0
- package/dist/replication/CentralCompatibility.d.ts +1 -0
- package/dist/replication/CentralCompatibility.js +2 -1
- package/dist/replication/couchdb/LiveSyncReplicator.d.ts +6 -2
- package/dist/replication/couchdb/LiveSyncReplicator.js +24 -5
- package/dist/replication/journal/LiveSyncJournalReplicator.d.ts +1 -0
- package/dist/replication/journal/LiveSyncJournalReplicator.js +50 -5
- package/dist/replication/trystero/ProxiedDB.d.ts +1 -1
- package/dist/replication/trystero/TrysteroReplicator.d.ts +369 -5
- package/dist/replication/trystero/TrysteroReplicator.js +31 -4
- package/dist/services/base/AppLifecycleService.d.ts +2 -0
- package/dist/services/base/AppLifecycleService.js +5 -0
- package/dist/services/base/IService.d.ts +1 -0
- package/dist/services/base/PathService.d.ts +3 -1
- package/dist/services/base/PathService.js +9 -4
- package/dist/services/base/SettingService.js +47 -0
- package/dist/settings.d.ts +2 -1
- package/dist/settings.js +14 -0
- package/dist/setupUri.d.ts +6 -0
- package/dist/setupUri.js +14 -0
- package/dist/string_and_binary/path.d.ts +1 -1
- package/dist/string_and_binary/path.js +3 -3
- package/dist/worker/bgWorker.js +1 -1
- package/docs/proven-in-use.md +12 -0
- package/docs/releasing.md +1 -1
- package/docs/setup-uri.md +58 -0
- package/package.json +17 -1
package/dist/settings.js
CHANGED
|
@@ -12,6 +12,14 @@ import {
|
|
|
12
12
|
PREFERRED_SETTING_SELF_HOSTED
|
|
13
13
|
} from "./common/models/setting.const.preferred.js";
|
|
14
14
|
import { CURRENT_SETTING_VERSION } from "./common/models/setting.const.js";
|
|
15
|
+
import {
|
|
16
|
+
deriveIdKey,
|
|
17
|
+
deriveOrImportIdKey,
|
|
18
|
+
formatIdRecoveryCode,
|
|
19
|
+
configuredIdKey,
|
|
20
|
+
ID_DERIVATION_VERSION,
|
|
21
|
+
ID_RECOVERY_CODE_PREFIX
|
|
22
|
+
} from "./common/idDerivation.js";
|
|
15
23
|
import {
|
|
16
24
|
prepareSettingsForLoad,
|
|
17
25
|
SettingsMigrationReviewCodes
|
|
@@ -20,6 +28,8 @@ import { assessTweakCompatibility } from "./common/models/tweak.compatibility.js
|
|
|
20
28
|
export {
|
|
21
29
|
CURRENT_SETTING_VERSION,
|
|
22
30
|
DEFAULT_SETTINGS,
|
|
31
|
+
ID_DERIVATION_VERSION,
|
|
32
|
+
ID_RECOVERY_CODE_PREFIX,
|
|
23
33
|
NEW_VAULT_SETTINGS,
|
|
24
34
|
P2P_DEFAULT_SETTINGS,
|
|
25
35
|
PREFERRED_BASE,
|
|
@@ -29,6 +39,10 @@ export {
|
|
|
29
39
|
SETTINGS_SCHEMA_DEFAULTS,
|
|
30
40
|
SettingsMigrationReviewCodes,
|
|
31
41
|
assessTweakCompatibility,
|
|
42
|
+
configuredIdKey,
|
|
32
43
|
createNewVaultSettings,
|
|
44
|
+
deriveIdKey,
|
|
45
|
+
deriveOrImportIdKey,
|
|
46
|
+
formatIdRecoveryCode,
|
|
33
47
|
prepareSettingsForLoad
|
|
34
48
|
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Setup URI sharing for maintained hosts.
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
export { encodeSettingsToSetupURI, encodeTimeBoundSetupURI, getTimeBoundSetupURIUsableUntil, isTimeBoundSetupURIUsableNow, decodeSettingsFromSetupURI, type TimeBoundSetupURIOptions, type TimeBoundSetupURIResult, type TimeBoundSetupURIMode, } from "./API/processSetting.js";
|
package/dist/setupUri.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {
|
|
2
|
+
encodeSettingsToSetupURI,
|
|
3
|
+
encodeTimeBoundSetupURI,
|
|
4
|
+
getTimeBoundSetupURIUsableUntil,
|
|
5
|
+
isTimeBoundSetupURIUsableNow,
|
|
6
|
+
decodeSettingsFromSetupURI
|
|
7
|
+
} from "./API/processSetting.js";
|
|
8
|
+
export {
|
|
9
|
+
decodeSettingsFromSetupURI,
|
|
10
|
+
encodeSettingsToSetupURI,
|
|
11
|
+
encodeTimeBoundSetupURI,
|
|
12
|
+
getTimeBoundSetupURIUsableUntil,
|
|
13
|
+
isTimeBoundSetupURIUsableNow
|
|
14
|
+
};
|
|
@@ -8,7 +8,7 @@ export declare function stripAllPrefixes(prefixedPath: FilePathWithPrefix): File
|
|
|
8
8
|
export declare function addPrefix(path: FilePath | FilePathWithPrefix, prefix: string): FilePathWithPrefix;
|
|
9
9
|
export declare function expandFilePathPrefix(path: FilePathWithPrefix | FilePath): [string, FilePathWithPrefix];
|
|
10
10
|
export declare function expandDocumentIDPrefix(id: DocumentID): [string, FilePathWithPrefix];
|
|
11
|
-
export declare function path2id_base(filenameSrc: FilePathWithPrefix | FilePath, obfuscatePassphrase: string | false, caseInsensitive: boolean): Promise<DocumentID>;
|
|
11
|
+
export declare function path2id_base(filenameSrc: FilePathWithPrefix | FilePath, obfuscatePassphrase: string | false, caseInsensitive: boolean, idDerivationKey?: string): Promise<DocumentID>;
|
|
12
12
|
export declare function id2path_base(id: DocumentID, entry?: EntryHasPath): FilePathWithPrefix;
|
|
13
13
|
export declare function getPath(entry: AnyEntry): FilePathWithPrefix;
|
|
14
14
|
export declare function getPathWithoutPrefix(entry: AnyEntry): FilePath;
|
|
@@ -14,6 +14,7 @@ import { memorizeFuncWithLRUCache } from "../common/utils.js";
|
|
|
14
14
|
import { uint8ArrayToHexString, writeString } from "./convert.js";
|
|
15
15
|
import { unique } from "octagonal-wheels/collection.js";
|
|
16
16
|
import { CHeader, ICHeader, ICXHeader, PSCHeader } from "../common/models/fileaccess.const.js";
|
|
17
|
+
import { computeKeyedId } from "../common/idDerivation.js";
|
|
17
18
|
function isValidFilenameInWidows(filename) {
|
|
18
19
|
const regex = /[\u0000-\u001f]|[\\":?<>|*#]/g;
|
|
19
20
|
if (regex.test(filename)) return false;
|
|
@@ -68,7 +69,7 @@ const _hashString = memorizeFuncWithLRUCache(async (key) => {
|
|
|
68
69
|
function hashString(key) {
|
|
69
70
|
return _hashString(key);
|
|
70
71
|
}
|
|
71
|
-
async function path2id_base(filenameSrc, obfuscatePassphrase, caseInsensitive) {
|
|
72
|
+
async function path2id_base(filenameSrc, obfuscatePassphrase, caseInsensitive, idDerivationKey) {
|
|
72
73
|
if (filenameSrc.startsWith(PREFIX_OBFUSCATED)) return `${filenameSrc}`;
|
|
73
74
|
let filename = `${filenameSrc}`;
|
|
74
75
|
const newPrefix = obfuscatePassphrase ? PREFIX_OBFUSCATED : "";
|
|
@@ -82,8 +83,7 @@ async function path2id_base(filenameSrc, obfuscatePassphrase, caseInsensitive) {
|
|
|
82
83
|
}
|
|
83
84
|
const [prefix, body] = expandFilePathPrefix(x);
|
|
84
85
|
if (body.startsWith(PREFIX_OBFUSCATED)) return newPrefix + x;
|
|
85
|
-
const
|
|
86
|
-
const out = await hashString(`${hashedPassphrase}:${filename}`);
|
|
86
|
+
const out = idDerivationKey ? await computeKeyedId(idDerivationKey, "document", filename) : await hashString(`${await hashString(obfuscatePassphrase)}:${filename}`);
|
|
87
87
|
return prefix + newPrefix + out;
|
|
88
88
|
}
|
|
89
89
|
function id2path_base(id, entry) {
|