@upv/identity-core
v0.0.1
Published
A modular identity + verification framework for Web3, healthcare, and trusted systems. This package provides strongly typed claim structures, Zod-based validation, and JWT-based session utilities — ready to integrate with systems like AWS Neptune, React,
Readme
🧠 identity-core
A modular identity + verification framework for Web3, healthcare, and trusted systems.
This package provides strongly typed claim structures, Zod-based validation, and JWT-based session utilities — ready to integrate with systems like AWS Neptune, React, or any decentralized credential ecosystem.
📦 Installation
npm install identity-core✨ Features
- ✅ Type-safe Claim system
- 📚 Predefined ClaimTypes (identity, medical, genetic, etc.)
- 🧠 Zod validation schemas
- 🔐 JWT signing / verification utilities
- 📄 Support for self-declared, pending, and verified claims
- 🧩 Designed for AWS Neptune (graph-compatible structure)
🔠 Claim Structure
export type Claim = {
id: string;
type: ClaimType;
value: string;
status: "self" | "pending" | "verified" | "declined";
issuedAt: string;
review?: {
by: string;
at: string;
note?: string;
};
meta?: {
source?: string;
context?: string;
tags?: string[];
note?: string;
confidence?: number;
};
};🧩 Supported Claim Types
type ClaimType =
// Identity
| "identity" | "firstName" | "lastName" | "fullName"
| "gender" | "dateOfBirth" | "age" | "nationality"
| "language" | "email" | "phoneNumber" | "location" | "address"
// Medical
| "diagnosis" | "condition" | "medication" | "treatment"
| "procedure" | "symptom" | "disability"
// Genetics
| "snp" | "genotype" | "geneticVariant" | "ancestry"
// Labs / Imaging
| "lab_result" | "neuropsychScore" | "mriReport"
| "eegReport" | "imagingFinding"
// Insurance / Admin
| "insuranceStatus" | "insuranceId" | "healthSystemId" | "patientId"
// Institution
| "providerName" | "institution" | "clinicalTrialParticipation"
// Employment / Education
| "education" | "profession" | "employmentStatus"
// Misc
| "custom";🧪 Validation with Zod
Each structured claim type can be validated using custom Zod schemas.
You can import templates from schemas/ and validate like so:
import { identityClaimSchema } from "identity-core";
identityClaimSchema.parse({
type: "identity",
value: {
fullName: "Jane Doe",
dateOfBirth: "1995-03-01",
gender: "female"
}
});🔐 JWT Utils
import { signToken, verifyToken } from "identity-core/utils/jwtUtils";
const token = signToken({ sub: "user123", role: "reviewer" }, JWT_SECRET);
const decoded = verifyToken(token, JWT_SECRET);🧠 Graph Model (AWS Neptune)
- Each
Claimis a node (type:claim) UserandReviewerare nodes- Relationships:
(:User)-[:HAS_CLAIM]->(:Claim)(:Claim)-[:REVIEWED_BY]->(:Reviewer)
📁 Project Structure
src/
├── types/
│ └── index.ts
├── schemas/
│ └── claimSchemas.ts
├── utils/
│ └── jwtUtils.ts
└── index.ts👤 Profile Type
export type Profile = {
userId: string;
claims: Claim[];
};📜 License
MIT © Upstream Vision
