Skip to content

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

2.6 KB
Raw Blame
// <auto-generated />
// This file is auto-generated from core/models/src/vault/VaultTableRegistry.ts
// Do not edit this file directly. Run 'core/models/build.sh' (or
// 'node core/models/scripts/generate-vault-table-registry.cjs') to regenerate.

#nullable enable

namespace AliasClientDb.Models;

using System.Collections.Generic;

/// <summary>
/// The client vault datamodel registry: one entry per syncable vault table, generated from the
/// TypeScript source of truth shared with the Rust codec. A unit test asserts the EF model
/// matches this registry, so a datamodel change that skips one of the encodings fails loudly.
/// </summary>
public static class VaultTableRegistry
{
    /// <summary>
    /// Gets all syncable client vault tables, in registry order.
    /// </summary>
    public static IReadOnlyList<VaultTableDefinition> Tables { get; } = new VaultTableDefinition[]
    {
        new("Items", new[] { "Id" }, ManifestScoped: true, ItemChild: false),
        new("ItemStats", new[] { "Id", "DeviceId" }, ManifestScoped: true, ItemChild: true),
        new("FieldValues", new[] { "Id" }, ManifestScoped: true, ItemChild: true),
        new("Folders", new[] { "Id" }, ManifestScoped: true, ItemChild: false),
        new("Tags", new[] { "Id" }, ManifestScoped: true, ItemChild: false),
        new("ItemTags", new[] { "ItemId", "TagId" }, ManifestScoped: true, ItemChild: true),
        new("Attachments", new[] { "Id" }, ManifestScoped: true, ItemChild: true),
        new("TotpCodes", new[] { "Id" }, ManifestScoped: true, ItemChild: true),
        new("Passkeys", new[] { "Id" }, ManifestScoped: true, ItemChild: true),
        new("FieldDefinitions", new[] { "Id" }, ManifestScoped: true, ItemChild: false),
        new("FieldHistories", new[] { "Id" }, ManifestScoped: true, ItemChild: true),
        new("Logos", new[] { "Id" }, ManifestScoped: true, ItemChild: false),
        new("EncryptionKeys", new[] { "Id" }, ManifestScoped: true, ItemChild: false),
        new("Settings", new[] { "Key" }, ManifestScoped: true, ItemChild: false),
    };
}

/// <summary>
/// Metadata for one syncable client vault table.
/// </summary>
/// <param name="Name">Table name in the client SQLite database.</param>
/// <param name="PrimaryKey">The columns that name a row within its manifest, excluding ManifestId.</param>
/// <param name="ManifestScoped">True when the table's rows are namespaced per manifest.</param>
/// <param name="ItemChild">True when the table's rows are child rows of an Item row.</param>
public sealed record VaultTableDefinition(string Name, IReadOnlyList<string> PrimaryKey, bool ManifestScoped, bool ItemChild);