How extendedguru4883/encryptednotes works
Project type and purpose
• This is a full-stack demo application showcasing zero-knowledge, end-to-end encrypted note taking.
• Frontend: Blazor WebAssembly client performs all encryption/decryption.
• Backend: .NET 8 Web API supporting authentication (challenge-response) and CRUD operations on encrypted notes.
• Layered architecture: API → BusinessLogic → DataAccess; Shared and Core projects hold DTOs, entities, abstractions.
File structure
• Top-level folders:
• Api: Web API controllers, middleware, JWT settings, mapping, program entry.
• BusinessLogic: core services (Auth, Note, Crypto, Signature, User) and mapping profiles.
• DataAccess: EF Core DbContext, migrations, repository implementations.
• Core: entity models, service/repository/infrastructure interfaces (abstractions).
• Shared: cross-cutting DTOs, constants, validation attributes, shared result types.
• Client: Blazor WASM app with pages, components, services (API client, crypto, auth state), models.
• Test: unit and integration tests for all layers.
• Configuration: launchSettings.json in Api and Client, .github/workflows for CI.
Insights from the README
• Client-side encryption with BlazorSodium; server uses Sodium.Core.
• Authentication uses a signed-nonce protocol; no passwords on server.
• SQLite (or pluggable) via EF Core; JWT for session tokens.
• Purpose is demo; not production grade.
a. Main components
• Blazor WebAssembly Client
• Web API (Api project)
• BusinessLogic layer
• DataAccess layer / SQLite database
• Shared/Core libraries (DTOs, entities, interfaces)
• External services: JWT issuer/audience configurations, optional CORS / static file hosting
b. Relationships & interactions
1. Client → Api (over HTTPS):
• Auth calls: Login / Signup (challenge-response endpoints)
• Calls: CRUD endpoints, sending/receiving encrypted payloads
2. Api → BusinessLogic: Api controllers use injected BusinessLogic services via Core abstractions
3. BusinessLogic → DataAccess: Services call repository interfaces to query/update data
4. DataAccess → SQLite: EF Core executes migrations and CRUD queries
5. Client Crypto: BlazorSodium library derives keys, encrypts/decrypts notes locally
6. Api Crypto: Sodium.Core verifies signatures, signs nonces, issues JWTs, but never sees plaintext notes
c. Architectural patterns & principles
• Onion/Clean architecture: UI → API → BusinessLogic → DataAccess → Database
• Dependency inversion: Core abstractions injected into upper layers
• Single responsibility: Controllers orchestrate, services implement logic, repos handle data
• Zero-knowledge encryption model enforced at client boundary
d. Key technologies/frameworks
• .NET 8 Web API, Blazor WebAssembly
• Entity Framework Core, SQLite
• BlazorSodium (client), Sodium.Core (server)
• AutoMapper profiles for mapping between DTOs/entities
• JWT for stateless auth