Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Refactor (#2159)

Leendert de Borst9ba1e344b7a5
diff --git a/apps/browser-extension/src/utils/VaultSyncService.ts b/apps/browser-extension/src/utils/VaultSyncService.ts
index dbd39fed8..e744b2bd9 100644
--- a/apps/browser-extension/src/utils/VaultSyncService.ts
+++ b/apps/browser-extension/src/utils/VaultSyncService.ts
@@ -163,8 +163,8 @@ type PullResult = {
};
/**
- * What {@link VaultSyncService.openManifestsAndAdoptSyncState} produces: every manifest of one snapshot,
- * decrypted and ready to materialize or merge, with the local sync state already adopted from it.
+ * What {@link VaultSyncService.openManifestsAndRecordSyncState} produces: every manifest of one snapshot,
+ * decrypted and ready to materialize or merge, with the local sync state already recorded from it.
*/
type OpenedManifestSet = {
resolved: ResolvedManifest[];
@@ -462,7 +462,7 @@ export class VaultSyncService {
}
try {
- const opened = await this.openManifestsAndAdoptSyncState(snapshot, encryptionKey, { deferRevisionCommit: true });
+ const opened = await this.openManifestsAndRecordSyncState(snapshot, encryptionKey, { deferRevisionCommit: true });
try {
const localSide = await this.localSideForMerge(localCanonicalized, localClient, opened);
@@ -777,20 +777,20 @@ export class VaultSyncService {
* @param vek - the personal manifest's symmetric key (from the unlock chain); decrypts the personal manifest and the data buckets
*/
private async materializeFromSnapshot(snapshot: GetResponseDto, vek: string): Promise<PullResult> {
- const opened = await this.openManifestsAndAdoptSyncState(snapshot, vek);
+ const opened = await this.openManifestsAndRecordSyncState(snapshot, vek);
const sqliteBytes = await this.materializeToSqlite(opened.resolved.map(m => m.manifest), opened.dataBuckets, opened.blobMap);
return { sqliteBytes, manifestRevision: opened.personalRevision };
}
/**
- * Open every manifest a snapshot carries (the personal one plus each shared one) and adopt the snapshot as
+ * Open every manifest a snapshot carries (the personal one plus each shared one) and record the snapshot as
* this device's sync state.
* @param snapshot - the raw GET /v2/Vault response
* @param vek - the personal manifest's symmetric key (from the unlock chain); every other manifest key resolves from it
* @param options - set deferRevisionCommit to hand the revision write back to the caller as `commitRevisions`,
* for when the pulled revisions may only become local truth once a later step has succeeded
*/
- private async openManifestsAndAdoptSyncState(snapshot: GetResponseDto, vek: string, options?: { deferRevisionCommit?: boolean }): Promise<OpenedManifestSet> {
+ private async openManifestsAndRecordSyncState(snapshot: GetResponseDto, vek: string, options?: { deferRevisionCommit?: boolean }): Promise<OpenedManifestSet> {
const personalDto = selectPersonalManifest(snapshot);
if (!personalDto) {
throw new Error('VaultSyncService: server returned no personal manifest, refusing to assemble.');
diff --git a/apps/server/AliasVault.Client/Services/VaultSync/VaultSyncService.cs b/apps/server/AliasVault.Client/Services/VaultSync/VaultSyncService.cs
index bc3773ccf..69ffb1645 100644
--- a/apps/server/AliasVault.Client/Services/VaultSync/VaultSyncService.cs
+++ b/apps/server/AliasVault.Client/Services/VaultSync/VaultSyncService.cs
@@ -29,7 +29,7 @@ using Microsoft.JSInterop;
/// <param name="vaultKeyService">VaultKeyService instance.</param>
/// <param name="jsInteropService">JsInteropService instance.</param>
/// <param name="rustCoreService">RustCoreService instance.</param>
-/// <param name="state">The sync state this pull adopts the snapshot into.</param>
+/// <param name="state">The sync state this pull records the snapshot into.</param>
/// <param name="logger">ILogger instance.</param>
public sealed class VaultSyncService(HttpClient httpClient, AuthService authService, VaultKeyService vaultKeyService, JsInteropService jsInteropService, RustCoreService rustCoreService, VaultSyncState state, ILogger<VaultSyncService> logger)
{
@@ -48,7 +48,7 @@ public sealed class VaultSyncService(HttpClient httpClient, AuthService authServ
private const int BlobTransferBatchMaxCount = 100;
/// <summary>
- /// Gets the sync state adopted from the last pull.
+ /// Gets the sync state recorded by the last pull.
/// </summary>
public VaultSyncState State => state;
@@ -94,7 +94,7 @@ public sealed class VaultSyncService(HttpClient httpClient, AuthService authServ
try
{
logger.LogInformation("[V2Pull] Step 2/3: decrypting manifests, buckets and blobs...");
- var opened = await OpenManifestsAndAdoptSyncStateAsync(snapshot, personalDto);
+ var opened = await OpenManifestsAndRecordSyncStateAsync(snapshot, personalDto);
var blobs = await DownloadReferencedBlobsAsync(opened);
logger.LogInformation("[V2Pull] Step 3/3: materializing {ManifestCount} manifest(s) into a fresh SQLite database...", opened.Resolved.Count);
@@ -285,12 +285,12 @@ public sealed class VaultSyncService(HttpClient httpClient, AuthService authServ
}
/// <summary>
- /// Open every manifest a snapshot carries (the personal one plus each shared one) and adopt the snapshot as this device's sync state.
+ /// Open every manifest a snapshot carries (the personal one plus each shared one) and record the snapshot as this device's sync state.
/// </summary>
/// <param name="snapshot">The raw snapshot.</param>
/// <param name="personalDto">The caller's own manifest.</param>
/// <returns>The opened set.</returns>
- private async Task<OpenedManifestSet> OpenManifestsAndAdoptSyncStateAsync(GetResponse snapshot, Manifest personalDto)
+ private async Task<OpenedManifestSet> OpenManifestsAndRecordSyncStateAsync(GetResponse snapshot, Manifest personalDto)
{
var personalVek = authService.GetEncryptionKeyAsBase64Async();
var resolved = new List<ResolvedManifest>();
@@ -332,7 +332,7 @@ public sealed class VaultSyncService(HttpClient httpClient, AuthService authServ
// 2) Open the data buckets belonging to those manifests.
var (dataBuckets, bucketRevisions) = await OpenDataBucketsAsync(snapshot, resolved, fingerprints);
- // 3) Adopt the snapshot as local truth.
+ // 3) Record the snapshot as local truth.
state.SharedManifests.Clear();
foreach (var (id, record) in sharedRecords)
{
@@ -362,7 +362,7 @@ public sealed class VaultSyncService(HttpClient httpClient, AuthService authServ
state.ContentFingerprints[key] = fingerprint;
}
- logger.LogInformation("[V2Pull] Adopted revisions of {ManifestCount} manifest(s) and {BucketCount} bucket(s); {FingerprintCount} fingerprint baseline(s) stored.", state.ManifestRevisions.Count, state.BucketRevisions.Count, state.ContentFingerprints.Count);
+ logger.LogInformation("[V2Pull] Recorded revisions of {ManifestCount} manifest(s) and {BucketCount} bucket(s); {FingerprintCount} fingerprint baseline(s) stored.", state.ManifestRevisions.Count, state.BucketRevisions.Count, state.ContentFingerprints.Count);
return new OpenedManifestSet(resolved, dataBuckets, contentlessRevisions.Keys.ToList(), resolved[0].Revision);
}
diff --git a/apps/server/AliasVault.Client/Services/VaultSync/VaultSyncState.cs b/apps/server/AliasVault.Client/Services/VaultSync/VaultSyncState.cs
index bb5105059..3329a17bc 100644
--- a/apps/server/AliasVault.Client/Services/VaultSync/VaultSyncState.cs
+++ b/apps/server/AliasVault.Client/Services/VaultSync/VaultSyncState.cs
@@ -10,7 +10,7 @@ namespace AliasVault.Client.Services.VaultSync;
using AliasVault.Client.Services.VaultSync.Models;
/// <summary>
-/// The client's sync state as adopted from the last pull.
+/// The client's sync state as recorded by the last pull.
/// </summary>
public sealed class VaultSyncState
{