Skip to content

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

Add vault databucket category central enum generation (#2159)

Leendert de Borstb93ac84a618c
diff --git a/apps/browser-extension/src/utils/dist/core/models/vault/index.d.ts b/apps/browser-extension/src/utils/dist/core/models/vault/index.d.ts
index 9c8824821..14afb0668 100644
--- a/apps/browser-extension/src/utils/dist/core/models/vault/index.d.ts
+++ b/apps/browser-extension/src/utils/dist/core/models/vault/index.d.ts
@@ -274,6 +274,28 @@ declare const FieldKey: {
*/
type FieldKeyValue = typeof FieldKey[keyof typeof FieldKey];
+/**
+ * <auto-generated />
+ * This file is auto-generated from core/rust/src/vault_codec/types.rs (BUCKET_TABLES).
+ * Do not edit this file directly. Run 'core/models/build.sh' (or 'node core/models/scripts/generate-bucket-categories.cjs') to regenerate.
+ */
+/**
+ * Known data-bucket categories for the manifest-v1 storage format. Each value is one small,
+ * independently-versioned, user-scoped category of encrypted data kept out of the main vault content
+ * manifest so it syncs cheaply. Serialized as its string name on the wire. The canonical list lives in
+ * the Rust codec's BUCKET_TABLES.
+ */
+declare const VaultDataBucketCategory: {
+ /**
+ * User client settings (sort order, autofill prefs, identity defaults, etc.).
+ */
+ readonly Settings: "Settings";
+};
+/**
+ * Type representing all valid vault data bucket category values.
+ */
+type VaultDataBucketCategoryValue = typeof VaultDataBucketCategory[keyof typeof VaultDataBucketCategory];
+
type Tag = {
Id: string;
Name: string;
@@ -590,4 +612,4 @@ type FieldHistory = {
*/
declare const MAX_FIELD_HISTORY_RECORDS = 10;
-export { type Alias, type Attachment, type CreateCustomFieldOptions, type CreateSystemFieldOptions, type Credential, type DicewareCapitalization, type DicewareSalt, type DicewareSeparator, type EncryptionKey, FieldCategories, type FieldCategory, type FieldHistory, FieldKey, type FieldKeyValue, type FieldType, FieldTypes, type Item, type ItemField, type ItemTag, type ItemTagRef, type ItemType, type ItemTypeFieldConfig, ItemTypes, MAX_FIELD_HISTORY_RECORDS, type Passkey, type PasswordGeneratorType, type PasswordSettings, type SystemFieldDefinition, SystemFieldRegistry, type Tag, type TotpCode, createCustomField, createSystemField, fieldAppliesToType, getAllSystemFieldKeys, getDefaultFieldsForItemType, getFieldConfigForType, getFieldValue, getFieldValues, getOptionalFieldsForItemType, getSystemField, getSystemFieldsForItemType, groupFields, groupFieldsByCategory, hasField, isFieldShownByDefault, isSystemField, isSystemFieldPrefix, itemToCredential };
+export { type Alias, type Attachment, type CreateCustomFieldOptions, type CreateSystemFieldOptions, type Credential, type DicewareCapitalization, type DicewareSalt, type DicewareSeparator, type EncryptionKey, FieldCategories, type FieldCategory, type FieldHistory, FieldKey, type FieldKeyValue, type FieldType, FieldTypes, type Item, type ItemField, type ItemTag, type ItemTagRef, type ItemType, type ItemTypeFieldConfig, ItemTypes, MAX_FIELD_HISTORY_RECORDS, type Passkey, type PasswordGeneratorType, type PasswordSettings, type SystemFieldDefinition, SystemFieldRegistry, type Tag, type TotpCode, VaultDataBucketCategory, type VaultDataBucketCategoryValue, createCustomField, createSystemField, fieldAppliesToType, getAllSystemFieldKeys, getDefaultFieldsForItemType, getFieldConfigForType, getFieldValue, getFieldValues, getOptionalFieldsForItemType, getSystemField, getSystemFieldsForItemType, groupFields, groupFieldsByCategory, hasField, isFieldShownByDefault, isSystemField, isSystemFieldPrefix, itemToCredential };
diff --git a/apps/browser-extension/src/utils/dist/core/models/vault/index.js b/apps/browser-extension/src/utils/dist/core/models/vault/index.js
index d4e20c67b..01064877c 100644
--- a/apps/browser-extension/src/utils/dist/core/models/vault/index.js
+++ b/apps/browser-extension/src/utils/dist/core/models/vault/index.js
@@ -81,6 +81,14 @@ var FieldKey = {
NotesContent: "notes.content"
};
+// src/vault/VaultDataBucketCategory.ts
+var VaultDataBucketCategory = {
+ /**
+ * User client settings (sort order, autofill prefs, identity defaults, etc.).
+ */
+ Settings: "Settings"
+};
+
// src/vault/Item.ts
var ItemTypes = {
Login: "Login",
@@ -443,4 +451,4 @@ function createCustomField(options) {
// src/vault/FieldHistory.ts
var MAX_FIELD_HISTORY_RECORDS = 10;
-export { FieldCategories, FieldKey, FieldTypes, ItemTypes, MAX_FIELD_HISTORY_RECORDS, SystemFieldRegistry, createCustomField, createSystemField, fieldAppliesToType, getAllSystemFieldKeys, getDefaultFieldsForItemType, getFieldConfigForType, getFieldValue, getFieldValues, getOptionalFieldsForItemType, getSystemField, getSystemFieldsForItemType, groupFields, groupFieldsByCategory, hasField, isFieldShownByDefault, isSystemField, isSystemFieldPrefix, itemToCredential };
+export { FieldCategories, FieldKey, FieldTypes, ItemTypes, MAX_FIELD_HISTORY_RECORDS, SystemFieldRegistry, VaultDataBucketCategory, createCustomField, createSystemField, fieldAppliesToType, getAllSystemFieldKeys, getDefaultFieldsForItemType, getFieldConfigForType, getFieldValue, getFieldValues, getOptionalFieldsForItemType, getSystemField, getSystemFieldsForItemType, groupFields, groupFieldsByCategory, hasField, isFieldShownByDefault, isSystemField, isSystemFieldPrefix, itemToCredential };
diff --git a/apps/browser-extension/src/utils/types/VaultMutationScope.ts b/apps/browser-extension/src/utils/types/VaultMutationScope.ts
index 2ac424ac5..f5efc8ab4 100644
--- a/apps/browser-extension/src/utils/types/VaultMutationScope.ts
+++ b/apps/browser-extension/src/utils/types/VaultMutationScope.ts
@@ -3,15 +3,18 @@
* full manifest push and a more efficient bucket-only push.
*/
+import { VaultDataBucketCategory, type VaultDataBucketCategoryValue } from '@/utils/dist/core/models/vault';
+
export type VaultManifestScope = 'Main';
-export type VaultBucketScope = 'Settings';
+// A bucket scope is one of the generated data-bucket categories (single source of truth: Rust BUCKET_TABLES).
+export type VaultBucketScope = VaultDataBucketCategoryValue;
export type VaultMutationScope = VaultManifestScope | VaultBucketScope;
export const ALL_VAULT_MANIFEST_SCOPES: readonly VaultManifestScope[] = ['Main'];
-export const ALL_VAULT_BUCKET_SCOPES: readonly VaultBucketScope[] = ['Settings'];
+export const ALL_VAULT_BUCKET_SCOPES: readonly VaultBucketScope[] = Object.values(VaultDataBucketCategory);
export const ALL_VAULT_MUTATION_SCOPES: readonly VaultMutationScope[] = [...ALL_VAULT_MANIFEST_SCOPES, ...ALL_VAULT_BUCKET_SCOPES];
diff --git a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/models/VaultDataBucketCategory.kt b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/models/VaultDataBucketCategory.kt
new file mode 100644
index 000000000..e97c474d5
--- /dev/null
+++ b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/models/VaultDataBucketCategory.kt
@@ -0,0 +1,21 @@
+// <auto-generated />
+// This file is auto-generated from core/rust/src/vault_codec/types.rs (BUCKET_TABLES).
+// Do not edit this file directly. Run 'core/models/build.sh' (or 'node core/models/scripts/generate-bucket-categories.cjs') to regenerate.
+
+package net.aliasvault.app.vaultstore.models
+
+/**
+ * Known data-bucket categories for the manifest-v1 storage format.
+ * The canonical list lives in the Rust codec's BUCKET_TABLES.
+ */
+object VaultDataBucketCategory {
+ /**
+ * User client settings (sort order, autofill prefs, identity defaults, etc.).
+ */
+ const val SETTINGS = "Settings"
+
+ /**
+ * All known data bucket categories.
+ */
+ val all = listOf(SETTINGS)
+}
diff --git a/apps/mobile-app/ios/VaultModels/VaultDataBucketCategory.swift b/apps/mobile-app/ios/VaultModels/VaultDataBucketCategory.swift
new file mode 100644
index 000000000..b2d20b742
--- /dev/null
+++ b/apps/mobile-app/ios/VaultModels/VaultDataBucketCategory.swift
@@ -0,0 +1,15 @@
+// <auto-generated />
+// This file is auto-generated from core/rust/src/vault_codec/types.rs (BUCKET_TABLES).
+// Do not edit this file directly. Run 'core/models/build.sh' (or 'node core/models/scripts/generate-bucket-categories.cjs') to regenerate.
+
+import Foundation
+
+/// Known data-bucket categories for the manifest-v1 storage format.
+/// The canonical list lives in the Rust codec's BUCKET_TABLES.
+public struct VaultDataBucketCategory {
+ /// User client settings (sort order, autofill prefs, identity defaults, etc.).
+ public static let settings = "Settings"
+
+ /// All known data bucket categories.
+ public static let all = [settings]
+}
diff --git a/apps/mobile-app/utils/dist/core/models/vault/index.d.ts b/apps/mobile-app/utils/dist/core/models/vault/index.d.ts
index 9c8824821..14afb0668 100644
--- a/apps/mobile-app/utils/dist/core/models/vault/index.d.ts
+++ b/apps/mobile-app/utils/dist/core/models/vault/index.d.ts
@@ -274,6 +274,28 @@ declare const FieldKey: {
*/
type FieldKeyValue = typeof FieldKey[keyof typeof FieldKey];
+/**
+ * <auto-generated />
+ * This file is auto-generated from core/rust/src/vault_codec/types.rs (BUCKET_TABLES).
+ * Do not edit this file directly. Run 'core/models/build.sh' (or 'node core/models/scripts/generate-bucket-categories.cjs') to regenerate.
+ */
+/**
+ * Known data-bucket categories for the manifest-v1 storage format. Each value is one small,
+ * independently-versioned, user-scoped category of encrypted data kept out of the main vault content
+ * manifest so it syncs cheaply. Serialized as its string name on the wire. The canonical list lives in
+ * the Rust codec's BUCKET_TABLES.
+ */
+declare const VaultDataBucketCategory: {
+ /**
+ * User client settings (sort order, autofill prefs, identity defaults, etc.).
+ */
+ readonly Settings: "Settings";
+};
+/**
+ * Type representing all valid vault data bucket category values.
+ */
+type VaultDataBucketCategoryValue = typeof VaultDataBucketCategory[keyof typeof VaultDataBucketCategory];
+
type Tag = {
Id: string;
Name: string;
@@ -590,4 +612,4 @@ type FieldHistory = {
*/
declare const MAX_FIELD_HISTORY_RECORDS = 10;
-export { type Alias, type Attachment, type CreateCustomFieldOptions, type CreateSystemFieldOptions, type Credential, type DicewareCapitalization, type DicewareSalt, type DicewareSeparator, type EncryptionKey, FieldCategories, type FieldCategory, type FieldHistory, FieldKey, type FieldKeyValue, type FieldType, FieldTypes, type Item, type ItemField, type ItemTag, type ItemTagRef, type ItemType, type ItemTypeFieldConfig, ItemTypes, MAX_FIELD_HISTORY_RECORDS, type Passkey, type PasswordGeneratorType, type PasswordSettings, type SystemFieldDefinition, SystemFieldRegistry, type Tag, type TotpCode, createCustomField, createSystemField, fieldAppliesToType, getAllSystemFieldKeys, getDefaultFieldsForItemType, getFieldConfigForType, getFieldValue, getFieldValues, getOptionalFieldsForItemType, getSystemField, getSystemFieldsForItemType, groupFields, groupFieldsByCategory, hasField, isFieldShownByDefault, isSystemField, isSystemFieldPrefix, itemToCredential };
+export { type Alias, type Attachment, type CreateCustomFieldOptions, type CreateSystemFieldOptions, type Credential, type DicewareCapitalization, type DicewareSalt, type DicewareSeparator, type EncryptionKey, FieldCategories, type FieldCategory, type FieldHistory, FieldKey, type FieldKeyValue, type FieldType, FieldTypes, type Item, type ItemField, type ItemTag, type ItemTagRef, type ItemType, type ItemTypeFieldConfig, ItemTypes, MAX_FIELD_HISTORY_RECORDS, type Passkey, type PasswordGeneratorType, type PasswordSettings, type SystemFieldDefinition, SystemFieldRegistry, type Tag, type TotpCode, VaultDataBucketCategory, type VaultDataBucketCategoryValue, createCustomField, createSystemField, fieldAppliesToType, getAllSystemFieldKeys, getDefaultFieldsForItemType, getFieldConfigForType, getFieldValue, getFieldValues, getOptionalFieldsForItemType, getSystemField, getSystemFieldsForItemType, groupFields, groupFieldsByCategory, hasField, isFieldShownByDefault, isSystemField, isSystemFieldPrefix, itemToCredential };
diff --git a/apps/mobile-app/utils/dist/core/models/vault/index.js b/apps/mobile-app/utils/dist/core/models/vault/index.js
index d4e20c67b..01064877c 100644
--- a/apps/mobile-app/utils/dist/core/models/vault/index.js
+++ b/apps/mobile-app/utils/dist/core/models/vault/index.js
@@ -81,6 +81,14 @@ var FieldKey = {
NotesContent: "notes.content"
};
+// src/vault/VaultDataBucketCategory.ts
+var VaultDataBucketCategory = {
+ /**
+ * User client settings (sort order, autofill prefs, identity defaults, etc.).
+ */
+ Settings: "Settings"
+};
+
// src/vault/Item.ts
var ItemTypes = {
Login: "Login",
@@ -443,4 +451,4 @@ function createCustomField(options) {
// src/vault/FieldHistory.ts
var MAX_FIELD_HISTORY_RECORDS = 10;
-export { FieldCategories, FieldKey, FieldTypes, ItemTypes, MAX_FIELD_HISTORY_RECORDS, SystemFieldRegistry, createCustomField, createSystemField, fieldAppliesToType, getAllSystemFieldKeys, getDefaultFieldsForItemType, getFieldConfigForType, getFieldValue, getFieldValues, getOptionalFieldsForItemType, getSystemField, getSystemFieldsForItemType, groupFields, groupFieldsByCategory, hasField, isFieldShownByDefault, isSystemField, isSystemFieldPrefix, itemToCredential };
+export { FieldCategories, FieldKey, FieldTypes, ItemTypes, MAX_FIELD_HISTORY_RECORDS, SystemFieldRegistry, VaultDataBucketCategory, createCustomField, createSystemField, fieldAppliesToType, getAllSystemFieldKeys, getDefaultFieldsForItemType, getFieldConfigForType, getFieldValue, getFieldValues, getOptionalFieldsForItemType, getSystemField, getSystemFieldsForItemType, groupFields, groupFieldsByCategory, hasField, isFieldShownByDefault, isSystemField, isSystemFieldPrefix, itemToCredential };
diff --git a/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Vault/VaultDataBucketCategory.cs b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Vault/VaultDataBucketCategory.cs
index b21f0f89e..6f24d21c5 100644
--- a/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Vault/VaultDataBucketCategory.cs
+++ b/apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Vault/VaultDataBucketCategory.cs
@@ -1,9 +1,6 @@
-//-----------------------------------------------------------------------
-// <copyright file="VaultDataBucketCategory.cs" company="aliasvault">
-// Copyright (c) aliasvault. All rights reserved.
-// Licensed under the AGPLv3 license. See LICENSE.md file in the project root for full license information.
-// </copyright>
-//-----------------------------------------------------------------------
+// <auto-generated />
+// This file is auto-generated from core/rust/src/vault_codec/types.rs (BUCKET_TABLES).
+// Do not edit this file directly. Run 'core/models/build.sh' (or 'node core/models/scripts/generate-bucket-categories.cjs') to regenerate.
namespace AliasVault.Shared.Models.WebApi.V2.Vault;
@@ -14,7 +11,7 @@ using System.Text.Json.Serialization;
/// user-scoped category of encrypted data kept out of the main vault content manifest so it syncs cheaply.
/// Serialized as its string name on the wire (not the numeric value) and stored as a string in the database.
/// Adding a new kind requires a server-side rollout first, because the server reasons about kinds for
-/// per-kind retention policies.
+/// per-kind retention policies. The canonical list lives in the Rust codec's BUCKET_TABLES.
/// </summary>
[JsonConverter(typeof(JsonStringEnumConverter))]
public enum VaultDataBucketCategory
diff --git a/core/models/build.sh b/core/models/build.sh
index cdd9261f5..ba6c8a62e 100755
--- a/core/models/build.sh
+++ b/core/models/build.sh
@@ -14,7 +14,14 @@ package_name="models"
package_path="."
echo "πŸ“¦ Building $package_name..."
-npm install && npm run lint && npm run test && npm run build
+npm install
+
+echo ""
+echo "πŸ”„ Generating vault data bucket categories (C#, TS, Swift, Kotlin) from Rust source..."
+# Run before the build so the generated TS lands in src/ and is compiled into dist/ (and linted).
+node scripts/generate-bucket-categories.cjs
+
+npm run lint && npm run test && npm run build
echo ""
echo "πŸ”„ Generating platform-specific models (C#, Swift, Kotlin)..."
diff --git a/core/models/scripts/generate-bucket-categories.cjs b/core/models/scripts/generate-bucket-categories.cjs
new file mode 100644
index 000000000..d23c36150
--- /dev/null
+++ b/core/models/scripts/generate-bucket-categories.cjs
@@ -0,0 +1,246 @@
+#!/usr/bin/env node
+/**
+ * Generates the VaultDataBucketCategory representation for C#, TypeScript, Swift, and Kotlin.
+ *
+ * The single source of truth is the Rust codec's `BUCKET_TABLES` static in
+ * core/rust/src/vault_codec/types.rs, which owns the manifest-v1 table -> bucket-category mapping
+ * shared by every platform. The distinct bucket categories are a projection of that mapping, so we
+ * parse them straight out of the Rust source and emit the per-platform category types.
+ */
+
+const fs = require('fs');
+const path = require('path');
+
+// Paths
+const REPO_ROOT = path.join(__dirname, '../../..');
+const RUST_SOURCE = path.join(REPO_ROOT, 'core/rust/src/vault_codec/types.rs');
+const CS_OUTPUT = path.join(REPO_ROOT, 'apps/server/Shared/AliasVault.Shared/Models/WebApi/V2/Vault/VaultDataBucketCategory.cs');
+const TS_OUTPUT = path.join(REPO_ROOT, 'core/models/src/vault/VaultDataBucketCategory.ts');
+const SWIFT_OUTPUT = path.join(REPO_ROOT, 'apps/mobile-app/ios/VaultModels/VaultDataBucketCategory.swift');
+const KOTLIN_OUTPUT = path.join(REPO_ROOT, 'apps/mobile-app/android/app/src/main/java/net/aliasvault/app/vaultstore/models/VaultDataBucketCategory.kt');
+
+/**
+ * Human-readable description per category, keyed by the category name declared in Rust.
+ * Purely presentational (the category set itself always comes from Rust); an unknown category
+ * falls back to a generic description so a new bucket never breaks generation.
+ */
+const CATEGORY_DESCRIPTIONS = {
+ Settings: 'User client settings (sort order, autofill prefs, identity defaults, etc.).',
+};
+const DEFAULT_DESCRIPTION = 'A manifest-v1 data bucket category.';
+
+const AUTOGEN_NOTE = 'core/rust/src/vault_codec/types.rs (BUCKET_TABLES)';
+const REGEN_HINT = "Run 'core/models/build.sh' (or 'node core/models/scripts/generate-bucket-categories.cjs') to regenerate.";
+
+/**
+ * Parse the distinct bucket categories out of the Rust BUCKET_TABLES static, in declaration order.
+ * Each entry is `("Table", "Category")`; the category is the second string literal.
+ */
+function parseBucketCategories(rustSource) {
+ const arrayMatch = rustSource.match(/BUCKET_TABLES\s*:\s*&\[[^\]]*\]\s*=\s*&\[([\s\S]*?)\];/);
+ if (!arrayMatch) {
+ throw new Error(`Could not find BUCKET_TABLES in ${RUST_SOURCE}`);
+ }
+
+ const categories = [];
+ const entryRegex = /\(\s*"[^"]*"\s*,\s*"([^"]*)"\s*\)/g;
+ let match;
+ while ((match = entryRegex.exec(arrayMatch[1])) !== null) {
+ const category = match[1];
+ if (!categories.includes(category)) {
+ categories.push(category);
+ }
+ }
+
+ if (categories.length === 0) {
+ throw new Error('Parsed zero categories from BUCKET_TABLES; the parser or the Rust format changed.');
+ }
+
+ return categories;
+}
+
+/**
+ * Description for a category, falling back to a generic one for categories without an explicit entry.
+ */
+function describe(category) {
+ return CATEGORY_DESCRIPTIONS[category] || DEFAULT_DESCRIPTION;
+}
+
+/** Convert a PascalCase category to camelCase (Swift). */
+function toCamelCase(name) {
+ return name.charAt(0).toLowerCase() + name.slice(1);
+}
+
+/** Convert a PascalCase category to SCREAMING_SNAKE_CASE (Kotlin). */
+function toScreamingSnakeCase(name) {
+ return name.replace(/([A-Z])/g, '_$1').toUpperCase().replace(/^_/, '');
+}
+
+/**
+ * Generate the C# enum. Serialized as its string name (JsonStringEnumConverter) and stored as a
+ * string in the database, so the numeric backing is cosmetic; ordinals follow declaration order.
+ */
+function generateCSharp(categories) {
+ const members = categories
+ .map((category, index) => ` /// <summary>${describe(category)}</summary>
+ ${category} = ${index},`)
+ .join('\n\n');
+
+ return `// <auto-generated />
+// This file is auto-generated from ${AUTOGEN_NOTE}.
+// Do not edit this file directly. ${REGEN_HINT}
+
+namespace AliasVault.Shared.Models.WebApi.V2.Vault;
+
+using System.Text.Json.Serialization;
+
+/// <summary>
+/// Known data-bucket categories for the manifest-v1 storage format. Each value is one small, independently-versioned,
+/// user-scoped category of encrypted data kept out of the main vault content manifest so it syncs cheaply.
+/// Serialized as its string name on the wire (not the numeric value) and stored as a string in the database.
+/// Adding a new kind requires a server-side rollout first, because the server reasons about kinds for
+/// per-kind retention policies. The canonical list lives in the Rust codec's BUCKET_TABLES.
+/// </summary>
+[JsonConverter(typeof(JsonStringEnumConverter))]
+public enum VaultDataBucketCategory
+{
+${members}
+}
+`;
+}
+
+/**
+ * Generate the TypeScript const object (consumed as-is by the browser extension and mobile app).
+ */
+function generateTypeScript(categories) {
+ const members = categories
+ .map(category => ` /**
+ * ${describe(category)}
+ */
+ ${category}: '${category}',`)
+ .join('\n\n');
+
+ return `/**
+ * <auto-generated />
+ * This file is auto-generated from ${AUTOGEN_NOTE}.
+ * Do not edit this file directly. ${REGEN_HINT}
+ */
+
+/**
+ * Known data-bucket categories for the manifest-v1 storage format. Each value is one small,
+ * independently-versioned, user-scoped category of encrypted data kept out of the main vault content
+ * manifest so it syncs cheaply. Serialized as its string name on the wire. The canonical list lives in
+ * the Rust codec's BUCKET_TABLES.
+ */
+export const VaultDataBucketCategory = {
+${members}
+} as const;
+
+/**
+ * Type representing all valid vault data bucket category values.
+ */
+export type VaultDataBucketCategoryValue = typeof VaultDataBucketCategory[keyof typeof VaultDataBucketCategory];
+`;
+}
+
+/**
+ * Generate the Swift string-constant struct (mirrors the FieldType.swift convention).
+ */
+function generateSwift(categories) {
+ const members = categories
+ .map(category => ` /// ${describe(category)}
+ public static let ${toCamelCase(category)} = "${category}"`)
+ .join('\n\n');
+
+ const all = categories.map(toCamelCase).join(', ');
+
+ return `// <auto-generated />
+// This file is auto-generated from ${AUTOGEN_NOTE}.
+// Do not edit this file directly. ${REGEN_HINT}
+
+import Foundation
+
+/// Known data-bucket categories for the manifest-v1 storage format.
+/// The canonical list lives in the Rust codec's BUCKET_TABLES.
+public struct VaultDataBucketCategory {
+${members}
+
+ /// All known data bucket categories.
+ public static let all = [${all}]
+}
+`;
+}
+
+/**
+ * Generate the Kotlin string-constant object (mirrors the FieldType.kt convention).
+ */
+function generateKotlin(categories) {
+ const members = categories
+ .map(category => ` /**
+ * ${describe(category)}
+ */
+ const val ${toScreamingSnakeCase(category)} = "${category}"`)
+ .join('\n\n');
+
+ const all = categories.map(toScreamingSnakeCase).join(', ');
+
+ return `// <auto-generated />
+// This file is auto-generated from ${AUTOGEN_NOTE}.
+// Do not edit this file directly. ${REGEN_HINT}
+
+package net.aliasvault.app.vaultstore.models
+
+/**
+ * Known data-bucket categories for the manifest-v1 storage format.
+ * The canonical list lives in the Rust codec's BUCKET_TABLES.
+ */
+object VaultDataBucketCategory {
+${members}
+
+ /**
+ * All known data bucket categories.
+ */
+ val all = listOf(${all})
+}
+`;
+}
+
+/**
+ * Ensure the directory for a file path exists.
+ */
+function ensureDir(filePath) {
+ const dir = path.dirname(filePath);
+ if (!fs.existsSync(dir)) {
+ fs.mkdirSync(dir, { recursive: true });
+ }
+}
+
+/**
+ * Main execution.
+ */
+function main() {
+ if (!fs.existsSync(RUST_SOURCE)) {
+ throw new Error(`Source file not found: ${RUST_SOURCE}`);
+ }
+
+ const rustSource = fs.readFileSync(RUST_SOURCE, 'utf8');
+ const categories = parseBucketCategories(rustSource);
+ console.log(`Parsed ${categories.length} bucket categorie(s): ${categories.join(', ')}`);
+
+ const outputs = [
+ [CS_OUTPUT, generateCSharp(categories)],
+ [TS_OUTPUT, generateTypeScript(categories)],
+ [SWIFT_OUTPUT, generateSwift(categories)],
+ [KOTLIN_OUTPUT, generateKotlin(categories)],
+ ];
+
+ for (const [outputPath, content] of outputs) {
+ ensureDir(outputPath);
+ fs.writeFileSync(outputPath, content, 'utf8');
+ console.log(`Generated: ${outputPath}`);
+ }
+
+ console.log('\nVaultDataBucketCategory generation complete!');
+}
+
+main();
diff --git a/core/models/src/vault/VaultDataBucketCategory.ts b/core/models/src/vault/VaultDataBucketCategory.ts
new file mode 100644
index 000000000..239b242bb
--- /dev/null
+++ b/core/models/src/vault/VaultDataBucketCategory.ts
@@ -0,0 +1,23 @@
+/**
+ * <auto-generated />
+ * This file is auto-generated from core/rust/src/vault_codec/types.rs (BUCKET_TABLES).
+ * Do not edit this file directly. Run 'core/models/build.sh' (or 'node core/models/scripts/generate-bucket-categories.cjs') to regenerate.
+ */
+
+/**
+ * Known data-bucket categories for the manifest-v1 storage format. Each value is one small,
+ * independently-versioned, user-scoped category of encrypted data kept out of the main vault content
+ * manifest so it syncs cheaply. Serialized as its string name on the wire. The canonical list lives in
+ * the Rust codec's BUCKET_TABLES.
+ */
+export const VaultDataBucketCategory = {
+ /**
+ * User client settings (sort order, autofill prefs, identity defaults, etc.).
+ */
+ Settings: 'Settings',
+} as const;
+
+/**
+ * Type representing all valid vault data bucket category values.
+ */
+export type VaultDataBucketCategoryValue = typeof VaultDataBucketCategory[keyof typeof VaultDataBucketCategory];
diff --git a/core/models/src/vault/index.ts b/core/models/src/vault/index.ts
index 02a0626cd..15611807d 100644
--- a/core/models/src/vault/index.ts
+++ b/core/models/src/vault/index.ts
@@ -8,6 +8,7 @@ export * from './Credential';
export * from './Attachment';
export * from './Passkey';
export * from './FieldKey';
+export * from './VaultDataBucketCategory';
export * from './Tag';
export * from './ItemTag';
export * from './Item';