@vrtmrz/livesync-commonlib 0.1.31 → 0.1.32
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 +5 -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 +13 -0
- package/dist/common/idDerivation.js +75 -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/managers/EntryManager/EntryManagerImpls.js +10 -1
- package/dist/managers/HashManager/HashManager.d.ts +1 -0
- package/dist/managers/HashManager/HashManager.js +13 -1
- 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/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 +8 -0
- package/docs/releasing.md +1 -1
- package/docs/setup-uri.md +58 -0
- package/package.json +9 -1
package/docs/proven-in-use.md
CHANGED
|
@@ -16,12 +16,18 @@ The unreleased 0.1.30 packed candidate adds encryption of Hidden File Sync and C
|
|
|
16
16
|
|
|
17
17
|
Additional real-CouchDB integration tests exercise Fast Fetch admission before local reset, generation 12 acceptance, and generation 13 retrieval with plaintext and encrypted internal Metadata together. A real-Obsidian migration scenario enables the preference through the settings UI without Rebuild, verifies that unchanged Metadata retains its original revision while rewritten entries are encrypted with stable IDs, and checks a second device's mismatch rejection and restoration after alignment. After turning the preference OFF, Fast Fetch still retrieves both representations and their Chunks with matching content; the remote feature declaration remains. These checks use the local packed candidate with LiveSync 1.0.32.
|
|
18
18
|
|
|
19
|
+
For optional independent ID derivation, Commonlib's focused tests cover deterministic Chunk and document IDs, legacy mode, remote document sampling, and transport admission. The focused `/settings` entry also formats a saved key as a versioned recovery code and imports it without deriving a different key; an ordinary source still uses the password KDF. Real CouchDB and Object Storage integration tests exercise direct-access rejection before a control-document change and Journal acceptance or rejection against an encrypted milestone proof. The first Journal milestone written by setup or Rebuild carries that proof before a transfer begins. A locally packed candidate based on Commonlib 0.1.31 has also passed LiveSync 1.0.32's real-Obsidian CouchDB two-Vault and onboarding workflows, a real-Obsidian Object Storage upload with keyed IDs and an encrypted milestone proof, and a CLI P2P transfer and mismatched-key rejection using Setup URIs. The published 0.1.31 package does not contain this feature; mobile timing and a released-package consumer run remain outstanding.
|
|
20
|
+
|
|
21
|
+
Regression tests also preserve each device's ID version and key through ordinary Tweak alignment, reject incompatible document ID modes separately from adoptable tweaks, and complete legacy P2P configuration imports without inheriting the receiving device's key. Direct-access admission checks cover both a different saved key and a legacy caller against keyed document IDs.
|
|
22
|
+
|
|
19
23
|
The plug-in extends the neutral `ServiceContext` with Obsidian-owned capabilities in `src/modules/services/ObsidianServiceContext.ts`. One context instance carries the LiveSync-owned translator and event hub through the Service Hub rather than placing those dependencies in Commonlib globals. Commonlib supplies its typed English fallback when another host omits the translator.
|
|
20
24
|
|
|
21
25
|
The consumer contract in `test/contracts/serviceContext.ts` checks shared result semantics and exact context identity across the composed services. The real-Obsidian suite documented in `test/e2e-obsidian/README.md` then covers plug-in loading, representative Svelte dialogue mounts, Vault reflection, CouchDB and Object Storage synchronisation, a two-device P2P Setup URI round-trip, two-Vault behaviour, and other Obsidian-owned boundaries.
|
|
22
26
|
|
|
23
27
|
Commonlib supplies the two sleep preferences and preserves them through Setup URI encoding. Self-hosted LiveSync applies those values once at its injected bounded-activity runner, so remote operations and downloaded-document application share the same host-owned Wake Lock policy. Focused downstream tests cover the platform preference table and both activity categories; operating-system suspend behaviour remains real-platform integration evidence rather than a Commonlib guarantee.
|
|
24
28
|
|
|
29
|
+
The focused [Setup URI sharing API](setup-uri.md) adds a fixed time window for new Ephemeral exports while leaving Persistent exports in the existing format. Commonlib unit tests cover window boundaries, encrypted round trips, and old-reader compatibility for Persistent URIs. The Obsidian generation dialogue, CLI import, browser generators, and real-runtime behaviour remain downstream responsibilities; package-level coverage alone does not establish those host interactions.
|
|
30
|
+
|
|
25
31
|
Commonlib's real-PouchDB and injected-boundary unit tests prove that conservative merge uses the nearest revision actually shared by both conflict leaves, multiple remaining leaves are selected in a deterministic order, each completed pair is reconstructed from the committed tree, storage content with exact provenance remains recognisable below a deleted losing branch after resolution, and ordinary file saves preserve edits below their recorded base or on an independent root when the base cannot be read. Incoming reflection uses the same classification. Current non-deleted leaf matches prevent duplicate preservation without using historical byte equality as proof of an unchanged file. Conflict-time deletion and rename retain their separate displayed-branch contracts. They also verify that a boolean history check stops after its first exact content match without reading an older unavailable revision, while revision enumeration still returns every match. Unknown-origin local content remains readable on a fresh independent root when the winning body is unavailable, including when the existing winner is generation one. A separately confirmed exact deletion of an unreadable current leaf remains an explicit repair operation. Exact reconciliation tests cover reflecting a selected live leaf, storing Vault content as its child, recording a matching leaf without creating a revision, clearing matching provenance after exact branch deletion, and refusing to record a stale revision or a revision whose content differs. Separate live-base tests advance a selected conflict leaf or logical-deletion leaf through PouchDB's ordinary revision check, retain the other live leaf, and reject reuse of a stale base. Self-hosted LiveSync supplies the host composition, persistent device-local provenance, and the per-revision repair interface. Its optional two-Vault scopes cover post-resolution propagation and edit, logical deletion, case-only rename, and cross-path rename while conflicts remain active. The conflict-operation scope passes in real Obsidian against the exact locally packed Commonlib artefact, including replicated parent revisions and preservation of the other live branches. Its Document History scenario restores readable historical bytes as a new live successor and reflects that exact revision to the Vault.
|
|
26
32
|
|
|
27
33
|
The equal-time scan test uses real in-memory PouchDB to verify that a missing record is established from unchanged current content before a newer revision arrives. It also verifies that existing provenance is retained and equal-time local edits remain protected as conflicts. Focused handler tests cover failures and changes during verification. Self-hosted LiveSync owns the persistent store and real-Obsidian restart check; these Commonlib tests do not exercise Windows file events or remote CouchDB timing.
|
|
@@ -42,6 +48,8 @@ The strict aggregate remains the default for Fast Setup, Fetch, Rebuild, direct
|
|
|
42
48
|
|
|
43
49
|
Commonlib's local-database lifecycle tests distinguish the settings-selected database from the active wrapper. They verify replacement before a changed-suffix reset, fail-closed cleanup after rejected physical preparation, application readiness after the requested scan and completion hooks, verbose diagnostics for rejected preparation stages, and the prevention of rebuilt events and later remote mutation after a failed local reset. Replication readiness tests verify that a descriptive application-initialisation diagnostic replaces the former bare diagnostic. Self-hosted LiveSync owns settings persistence, setup flags, user-facing notices, recovery dialogue, and real-Obsidian rebuild confirmation; those host results remain downstream evidence rather than Commonlib guarantees.
|
|
44
50
|
|
|
51
|
+
Commonlib's lifecycle tests verify that `markIsReady()` emits `EVENT_APPLICATION_READY` on the service context's event channel once per transition to readiness, after the flag is set, and that clearing readiness emits nothing. On 27th September 2026, a local packed candidate passed LiveSync 1.0.32's type check and replication unit tests together with a result processor which continues held replication results from that event, and a temporary downstream test showed documents restored during a real `prepareDatabaseForUse()` run held until readiness and applied immediately afterwards. Behaviour in a real Obsidian Vault remains downstream runtime evidence.
|
|
52
|
+
|
|
45
53
|
The focused `/replication` entry defines the provider capability, configuration identity, same-kind reconciliation, interaction authority, and truthful outcome contracts used when a host composes replication. A host selects its fixed provider subset and registers each definition during composition; an omitted role remains an explicit unsupported result rather than falling back to another provider. Commonlib serialises active replacement, rejects a candidate whose configuration changes before publication, and provides a transition-aware context acquisition boundary. The entry does not own user dialogue, P2P room policy, or selection of unknown providers.
|
|
46
54
|
|
|
47
55
|
The same entry distinguishes a central provider whose host prepares the Security Seed from one which prepares it within each transfer. Object Storage uses the latter: Journal reads fresh synchronisation parameters before compatibility checks, shares that result with its checkpoint epoch and encryption work, and releases it when the transfer settles. CouchDB retains host preparation. Focused Commonlib tests cover read reuse, later refresh, unavailable storage, and checkpoint reset; the maintained plug-in's provider tests and packed-package checks cover the declared readiness. Behaviour on the reporter's Android device remains a downstream runtime check.
|
package/docs/releasing.md
CHANGED
|
@@ -33,7 +33,7 @@ Before publication, run the downstream workflow against an exact Self-hosted Liv
|
|
|
33
33
|
|
|
34
34
|
## Preparing a release
|
|
35
35
|
|
|
36
|
-
Choose the version explicitly.
|
|
36
|
+
Choose the version explicitly. Prefer a `-next.N` prerelease, such as `0.1.32-next.0`, when registry installation must be validated before the stable version. Reserve `-rc.N` for an explicitly chosen release candidate. Package-proof versions are local artefacts and cannot be staged.
|
|
37
37
|
|
|
38
38
|
Prepare both stable releases and pre-releases on a reviewed pull request based on `main`. A pre-release may be staged from the exact reviewed pull-request branch commit so that the registry artefact can be validated in Self-hosted LiveSync before the Commonlib change is merged. A stable release must be staged only after its exact reviewed release commit is present on `main`.
|
|
39
39
|
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Setup URI sharing
|
|
2
|
+
|
|
3
|
+
The focused `@vrtmrz/livesync-commonlib/setup-uri` entry encodes and decodes
|
|
4
|
+
encrypted Setup URIs. A Setup URI carries settings and remote credentials;
|
|
5
|
+
share its URI and passphrase separately.
|
|
6
|
+
|
|
7
|
+
`encodeTimeBoundSetupURI` offers two generation modes. `ephemeral` is the
|
|
8
|
+
default. It binds the URI to the current seven-day UTC window, anchored at the
|
|
9
|
+
Unix epoch, and returns the exclusive end of that window as `usableUntil` in
|
|
10
|
+
Unix milliseconds. This is a fixed window, so a newly generated URI may have
|
|
11
|
+
less than seven days remaining. Show the returned instant in the user's time
|
|
12
|
+
zone when presenting the URI.
|
|
13
|
+
|
|
14
|
+
`persistent` returns `usableUntil: null` and delegates to the original
|
|
15
|
+
`encodeSettingsToSetupURI` algorithm with the entered passphrase. A reader
|
|
16
|
+
which already supports that original encryption format can open it. Both modes
|
|
17
|
+
have the same URI structure and carry no visible mode or timestamp field.
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import {
|
|
21
|
+
encodeTimeBoundSetupURI,
|
|
22
|
+
decodeSettingsFromSetupURI,
|
|
23
|
+
getTimeBoundSetupURIUsableUntil,
|
|
24
|
+
isTimeBoundSetupURIUsableNow,
|
|
25
|
+
} from '@vrtmrz/livesync-commonlib/setup-uri';
|
|
26
|
+
|
|
27
|
+
const endShownBeforeGeneration = getTimeBoundSetupURIUsableUntil();
|
|
28
|
+
const generated = await encodeTimeBoundSetupURI(settings, enteredPassphrase, {
|
|
29
|
+
mode: 'ephemeral',
|
|
30
|
+
removeProperties: ['pluginSyncExtendedSetting'],
|
|
31
|
+
skipDefaultValue: true,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const importedSettings = await decodeSettingsFromSetupURI(generated.uri.trim(), enteredPassphrase);
|
|
35
|
+
const canStillCopy = isTimeBoundSetupURIUsableNow(generated.usableUntil);
|
|
36
|
+
const endWasAccurate = generated.usableUntil === endShownBeforeGeneration;
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
The decoder automatically tries the current Ephemeral window and the entered
|
|
40
|
+
passphrase. Previous and future windows are not searched. Existing Setup URIs
|
|
41
|
+
remain readable. An Ephemeral URI cannot be opened through the unchanged old
|
|
42
|
+
decoder with the entered passphrase.
|
|
43
|
+
|
|
44
|
+
The receiving device supplies the clock. Someone who knows the passphrase
|
|
45
|
+
can reproduce historical time factors or alter that clock. Opening a URI does
|
|
46
|
+
not revoke credentials already imported, and Ephemeral does not mean one-time
|
|
47
|
+
use. An unsuccessful opening attempt cannot reliably distinguish an incorrect
|
|
48
|
+
passphrase, damaged ciphertext, or a different time window.
|
|
49
|
+
|
|
50
|
+
The encoder checks that its Ephemeral window has not changed during encryption.
|
|
51
|
+
`getTimeBoundSetupURIUsableUntil` lets a host show the exact end before a user
|
|
52
|
+
selects the mode. Compare that value with the generated `usableUntil` and
|
|
53
|
+
present the new end if the window changed during selection. A host may also use
|
|
54
|
+
`isTimeBoundSetupURIUsableNow` before showing or copying an open result; it
|
|
55
|
+
checks both edges of the selected window, including a clock moved backwards to
|
|
56
|
+
an earlier window. An already open copy dialogue can otherwise retain a URI
|
|
57
|
+
after its window ends, but the reader will reject that URI. The selected export
|
|
58
|
+
mode is an interaction choice; it is not a synchronised Vault setting.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vrtmrz/livesync-commonlib",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.32",
|
|
4
4
|
"description": "Shared data, storage, and replication primitives for Self-hosted LiveSync clients.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -77,6 +77,11 @@
|
|
|
77
77
|
"import": "./dist/settings.js",
|
|
78
78
|
"default": "./dist/settings.js"
|
|
79
79
|
},
|
|
80
|
+
"./setup-uri": {
|
|
81
|
+
"types": "./dist/setupUri.d.ts",
|
|
82
|
+
"import": "./dist/setupUri.js",
|
|
83
|
+
"default": "./dist/setupUri.js"
|
|
84
|
+
},
|
|
80
85
|
"./compat/API/processSetting": {
|
|
81
86
|
"types": "./dist/API/processSetting.d.ts",
|
|
82
87
|
"import": "./dist/API/processSetting.js",
|
|
@@ -651,6 +656,9 @@
|
|
|
651
656
|
"settings": [
|
|
652
657
|
"dist/settings.d.ts"
|
|
653
658
|
],
|
|
659
|
+
"setup-uri": [
|
|
660
|
+
"dist/setupUri.d.ts"
|
|
661
|
+
],
|
|
654
662
|
"compat/API/processSetting": [
|
|
655
663
|
"dist/API/processSetting.d.ts"
|
|
656
664
|
],
|