Skip to content

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

Update core/models structure (#2159)

Leendert de Borstf6655fefbcae
diff --git a/core/README.md b/core/README.md
index be68b0553..0071f8da1 100644
--- a/core/README.md
+++ b/core/README.md
@@ -1,9 +1,7 @@
# Core Libraries
-
This folder contains core modules that are used by multiple applications in the AliasVault monorepo.
## rust (Primary)
-
**Primary cross-platform core library** written in Rust, providing shared business logic across ALL platforms:
- Browser extensions (Chrome, Firefox, Edge, Safari) via WebAssembly
- Mobile apps (iOS via Swift bindings, Android via Kotlin bindings)
@@ -18,8 +16,10 @@ Currently implements:
See [rust/README.md](rust/README.md) for detailed documentation.
-## models
+## client
+Platform-neutral TypeScript client logic (`@aliasvault/client`): API access, SRP and key hierarchy, vault sync and codec, sharing, the SQLite repositories and item helpers.
+## models
TypeScript models that are auto-generated to platform-specific code:
- TypeScript (source of truth)
- C# (.NET)
@@ -27,7 +27,6 @@ TypeScript models that are auto-generated to platform-specific code:
- Kotlin (Android)
## vault
-
Vault database schema and SQL utilities for:
- Browser extension
- Mobile apps (React Native)
diff --git a/core/models/README.md b/core/models/README.md
index e7e484d91..fef432f28 100644
--- a/core/models/README.md
+++ b/core/models/README.md
@@ -6,12 +6,10 @@ This package serves as the **single source of truth** for data models across all
This package performs two key functions:
-### 1. TypeScript Distribution (As-Is)
-Builds and copies TypeScript models directly to:
-- **Browser Extension**: `apps/browser-extension/src/utils/dist/core/models`
-- **Mobile App**: `apps/mobile-app/utils/dist/core/models`
-
-These apps consume the TypeScript models as-is, enabling type-safe development with no manual synchronization needed.
+### 1. TypeScript Distribution (Linked as Source)
+TypeScript models are consumed as the `@aliasvault/models` package:
+- **Browser Extension**: linked as source through `@aliasvault/models` (see `core/client`)
+- **Mobile App**: TODO: migrate to linked source via `@aliasvault/models` (currently still copied to `apps/mobile-app/utils/dist/core/models` for legacy reasons)
### 2. Native Code Generation (Transformed)
Automatically generates platform-specific models from TypeScript sources:
diff --git a/core/models/build.sh b/core/models/build.sh
index fa32d2824..02a609d4e 100755
--- a/core/models/build.sh
+++ b/core/models/build.sh
@@ -4,8 +4,8 @@ set -e # Stop on error
set -u # Treat unset variables as errors
# Define output targets for models
+# TODO: remove this whole copy logic once the mobile app is migrated to the new core
TARGETS=(
- "../../apps/browser-extension/src/utils/dist/core/models"
"../../apps/mobile-app/utils/dist/core/models"
)
diff --git a/core/models/package.json b/core/models/package.json
index d8a318e85..d1da7c0e7 100644
--- a/core/models/package.json
+++ b/core/models/package.json
@@ -4,6 +4,14 @@
"type": "module",
"main": "dist/index.mjs",
"types": "dist/index.d.mts",
+ "exports": {
+ "./defaults": "./src/defaults/index.ts",
+ "./icons": "./src/icons/index.ts",
+ "./identity": "./src/identity/index.ts",
+ "./metadata": "./src/metadata/index.ts",
+ "./vault": "./src/vault/index.ts",
+ "./webapi": "./src/webapi/index.ts"
+ },
"scripts": {
"build": "tsup",
"clean": "rm -rf dist",