Comprehensive platform for issuing, managing, and verifying Verifiable Credentials (VCs) and Verifiable Presentations (VPs) in the Alastria ecosystem. This project implements W3C standards and Ethereum EIPs to ensure Self-Sovereign Identity (SSI).
- Project Architecture
- Functional Design
- System Components
- PDF Metadata Standard
- Key Technologies
- Configuration and Deployment
The project is a Monorepo managed with pnpm and turbo, organized to maximize code reuse and type consistency.
graph TD
User[User / Holder] -->|Interacts| Frontend[Frontend DApp]
Frontend -->|REST API| Issuer[Backend Issuer]
Frontend -->|REST API| Verifier[Backend Verifier]
subgraph Blockchain Layer
Issuer -->|Syncs Events| Blockchain[Alastria Network]
Verifier -->|Queries State| Blockchain
SC_Registry[Trusted Issuer Registry]
SC_Status[Credential Status Registry]
Blockchain --- SC_Registry
Blockchain --- SC_Status
end
subgraph Storage Layer
Issuer -->|Persists Data| DB[(SQLite Database)]
end
The system uses "Sign-In With Alastria" (based on SIWE) to authenticate users through their wallet, without requiring passwords.
sequenceDiagram
participant User
participant Frontend
participant Backend
User->>Frontend: Connect Wallet
Frontend->>Backend: GET /auth/challenge/{address}
Backend-->>Frontend: Returns Nonce
Frontend->>User: Request Signature (EIP-4361)
User->>Frontend: Sign Message
Frontend->>Backend: POST /auth/verify {address, signature}
Backend->>Backend: Verify Signature & Nonce
Backend-->>Frontend: Set-Cookie: JWT (HttpOnly)
Frontend->>User: Login Successful
sequenceDiagram
participant Issuer
participant Backend
participant Holder
Issuer->>Backend: POST /issue/prepare (VC Data)
Backend-->>Issuer: Returns VC Draft
Issuer->>Issuer: EIP-712 Signature (Wallet)
Issuer->>Backend: POST /issue/mint (Signature)
Backend->>Backend: Generate Claim Token
Backend-->>Holder: Send Email with Link
Holder->>Backend: Access Link (Token)
Holder->>Backend: POST /issue/finalize
Backend-->>Holder: Deliver Final VC (JSON/PDF)
Responsible for business logic related to credential issuance.
- REST API: Endpoints to prepare, sign, and finalize issuances.
- Identity Management: Implements SIWA for authentication.
- PDF Generation: Creates visual representations of VCs with embedded metadata.
Service dedicated to cryptographic and state validation.
- Off-chain Verification: Validates EIP-712 signatures and W3C structure.
- On-chain Verification: Queries revocation and validity status in Smart Contracts.
Unified user interface for Holders, Issuers, and Administrators.
- Roles: Admin, Issuer, Holder.
- Wallet: Deep integration with MetaMask and Snaps for secure storage.
On-chain infrastructure for trust and state management.
- Trusted Issuer Registry: Registry of authorized issuers.
- Revocation Registry: Credential validity status.
Credentials generated by the platform are self-contained PDF documents that act as secure carriers of verifiable information.
The complete JSON file of the Verifiable Credential (VC) is embedded within the PDF file using the XMP metadata standard, specifically in the Subject field.
- Subject: Contains the complete VC in JSON format, encoded in Base64. This allows any verifier to extract the original credential without relying on the visual content of the PDF, which could be altered.
- Title: "Verifiable Credential - Circuloos"
- Author: "Circuloos - Alastria Consortium"
- Keywords: "Verifiable Credential", "W3C", "Alastria", "Circuloos", "Blockchain"
The PDF verification process involves:
- Extracting the
Subjectfield from the PDF metadata. - Decoding the Base64 content to obtain the VC JSON.
- Cryptographically validating the EIP-712 signature of the extracted JSON.
- Verifying the credential status on the blockchain (revocation, trusted issuer).
The core of security and user experience. Allows users to sign structured, readable data instead of opaque hexadecimal hashes.
- Domain: Defines the context (
name,version,chainId,verifyingContract). - Types: Strict definitions for
Credential,Presentation,Claim, etc. - Implementation: Centralized in
packages/common/src/eip712, ensuring frontend, backend, and contracts use the same schemas.
Modular and upgradeable smart contract architecture.
- Facets: Small logic contracts (
AttestationBatch,CredentialStatus,TrustedIssuer) that connect to a central proxy (Diamond). - Advantage: Allows overcoming contract size limits and updating functionality without changing the main contract address.
- Node.js 20+
- PNPM (
npm i -g pnpm) - Docker & Docker Compose
The system uses a master .env file.
- Copy the example:
cp .env-sample .env - Configure critical variables:
RPC_URL: Alastria network endpoint (or local).DEPLOYER_PRIVATE_KEY: Account for deployments.JWT_SECRET: Session security.
# Install dependencies
pnpm install
# Start local development environment (with Hardhat node)
pnpm dev:local
# Start with Docker (containerized services)
pnpm dev:docker
## Windows Deployment Guide
### Prerequisites
- Docker Desktop for Windows
- Node.js 20+
- npm (comes with Node.js)
### First Time Setup
1. **Install pnpm globally** (if not already installed):
```powershell
npm install -g [email protected]- Install dependencies:
pnpm install- Build and start all services:
docker compose up -d --buildStop all services:
docker compose downRestart services (without rebuilding):
docker compose up -dView logs:
docker compose logs -fView specific service logs:
docker compose logs -f web
docker compose logs -f issuer
docker compose logs -f verifierCheck service status:
docker compose psOnce running, the following services are available:
| Service | URL | Description |
|---|---|---|
| Web Frontend | http://localhost:3000 | Main user interface |
| Issuer API | http://localhost:3001 | Credential issuance API |
| Verifier API | http://localhost:3002 | Credential verification API |
| Hardhat Node | http://localhost:8545 | Local blockchain RPC |
| Mailpit | http://localhost:8025 | Email testing interface |
Issuer API (http://localhost:3001):
GET /health- Health checkPOST /api/credentials/issue- Issue a credentialGET /api/credentials/:id- Get credential details
Verifier API (http://localhost:3002):
GET /health- Health checkPOST /api/presentations/verify- Verify a presentationGET /api/presentations/:id- Get presentation details
If build fails, clean Docker cache and rebuild:
docker compose down -v
docker system prune -a -f
docker builder prune -a -f
docker compose up -d --buildIf pnpm-lock.yaml issues, regenerate it:
Remove-Item pnpm-lock.yaml
pnpm install- All Dockerfiles use
NODE_ENV=developmentto ensure devDependencies (TypeScript, etc.) are installed - Workspace packages use
workspace:*protocol for proper pnpm monorepo resolution - Build time: ~3-4 minutes for all services on first build
- Subsequent builds are faster due to Docker layer caching