Skip to content

BimaPangestu28/Digital-Identity-Management-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Digital Identity Management System

A Self-Sovereign Identity (SSI) system built on Polygon blockchain using ERC-1056 DID standard with BBS+ signatures for privacy-preserving selective disclosure.

Homepage Screenshot

Features

  • Decentralized Identity (DID): Create and manage your own digital identity based on ERC-1056 standard
  • Verifiable Credentials: Receive W3C-compliant credentials from trusted issuers (universities, employers, government)
  • Selective Disclosure: Share only specific attributes without revealing full data using BBS+ signatures
  • On-chain Verification: Instant credential verification with revocation support on Polygon
  • Privacy-Preserving: Zero-knowledge proofs enable proving claims without exposing underlying data

Tech Stack

Component Technology
Blockchain Polygon (EVM compatible, low gas fees)
Smart Contracts Solidity 0.8.24 + Foundry
Identity Standard ERC-1056 (ethr-did-registry)
Credential Standard W3C Verifiable Credentials
Cryptography BBS+ Signatures (@mattrglobal/bbs-signatures)
Frontend React 18 + Vite + TailwindCSS + shadcn/ui
Web3 ethers.js v6

Architecture

┌─────────────────────────────────────────────────────────────────┐
│                        FRONTEND (React)                         │
│  • Wallet connection (MetaMask)                                 │
│  • Credential management UI                                     │
│  • Selective disclosure interface                               │
│  • Verifier portal                                              │
└─────────────────────────────────────────────────────────────────┘
                              │
                              ▼
┌─────────────────────────────────────────────────────────────────┐
│                     OFF-CHAIN SERVICES                          │
│  • BBS+ signature creation/verification                         │
│  • Selective disclosure proof generation                        │
│  • DID document resolution                                      │
└─────────────────────────────────────────────────────────────────┘
                              │
                              ▼
┌─────────────────────────────────────────────────────────────────┐
│                    ON-CHAIN (Polygon)                           │
│  • DIDRegistry: Identity ownership & delegation                 │
│  • IssuerRegistry: Trusted issuer management                    │
│  • CredentialRegistry: Credential anchoring & revocation        │
└─────────────────────────────────────────────────────────────────┘

Project Structure

.
├── contracts/                    # Solidity smart contracts (Foundry)
│   ├── src/
│   │   ├── DIDRegistry.sol       # ERC-1056 identity registry
│   │   ├── CredentialRegistry.sol # Credential hash & revocation
│   │   ├── IssuerRegistry.sol    # Trusted issuer management
│   │   └── interfaces/           # Contract interfaces
│   ├── test/                     # Foundry tests
│   └── script/                   # Deployment scripts
├── packages/
│   ├── credential-service/       # Off-chain BBS+ credential service
│   │   └── src/
│   │       ├── bbs/              # BBS+ signing, verification, selective disclosure
│   │       ├── did/              # DID resolution and document management
│   │       └── credential/       # Issuer, holder, verifier modules
│   └── frontend/                 # React application
│       └── src/
│           ├── components/       # UI components (shadcn/ui)
│           ├── hooks/            # React hooks (useWallet, useContracts, etc.)
│           └── pages/            # Page components
├── docs/                         # Documentation
└── public/                       # Static assets & screenshots

Prerequisites

  • Node.js >= 22.0.0
  • npm or yarn
  • Foundry for smart contract development
  • MetaMask or compatible Web3 wallet

Quick Start

1. Clone and Install

git clone <repository-url>
cd Digital-Identity-Management-System

# Install Foundry (if not installed)
curl -L https://foundry.paradigm.xyz | bash
foundryup

2. Build Smart Contracts

cd contracts
forge build
forge test

3. Setup Frontend

cd packages/frontend
npm install

4. Local Development with Anvil

# Terminal 1: Start local blockchain
cd contracts
anvil

# Terminal 2: Deploy contracts
forge script script/Deploy.s.sol:DeployLocal --rpc-url http://localhost:8545 --broadcast

After deployment, you'll see output like:

=== Local Deployment Summary ===
DIDRegistry:         0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9
IssuerRegistry:      0x5FC8d32690cc91D4c39d9d3abcBD16989F875707
CredentialRegistry:  0x0165878A594ca255338adfa4d48449f69242Eb8F
Test Issuer:         0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266

5. Configure Frontend

Create .env file in packages/frontend/:

VITE_DID_REGISTRY_ADDRESS=0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9
VITE_ISSUER_REGISTRY_ADDRESS=0x5FC8d32690cc91D4c39d9d3abcBD16989F875707
VITE_CREDENTIAL_REGISTRY_ADDRESS=0x0165878A594ca255338adfa4d48449f69242Eb8F

6. Run Frontend

cd packages/frontend
npm run dev

Open http://localhost:5173 in your browser.

7. Setup MetaMask for Local Testing

  1. Add Anvil Network:

    • Network Name: Anvil Local
    • RPC URL: http://localhost:8545
    • Chain ID: 31337
    • Currency Symbol: ETH
  2. Import Test Account (this account is pre-registered as an issuer):

    Private Key: 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
    Address: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
    

Usage

For Holders (Users)

  1. Connect your MetaMask wallet
  2. Your Ethereum address automatically becomes your DID (did:ethr:polygon:0x...)
  3. Receive credentials from trusted issuers
  4. Use Selective Disclosure to create presentations with only the claims you want to reveal
  5. Share presentations with verifiers

For Issuers

  1. Get registered as a trusted issuer (admin adds you via IssuerRegistry.addIssuer())
  2. Access the Issuer Portal to issue verifiable credentials
  3. Choose credential type: UniversityDegree, EmploymentCredential, or GovernmentID
  4. Fill in the holder's DID and credential claims
  5. Credentials are hashed and anchored on-chain
  6. Revoke credentials when needed via Manage Revocations

For Verifiers

  1. Access the Verifier page
  2. Paste the verifiable presentation JSON from the holder
  3. The system verifies:
    • Credential structure and format
    • On-chain status (not revoked, not expired)
    • Issuer is trusted in the registry
    • Issuer and holder addresses match on-chain record

Smart Contracts

DIDRegistry (ERC-1056)

Manages decentralized identifiers with ownership and delegation.

function identityOwner(address identity) returns (address)
function changeOwner(address identity, address newOwner)
function addDelegate(address identity, bytes32 delegateType, address delegate, uint256 validity)
function revokeDelegate(address identity, bytes32 delegateType, address delegate)

IssuerRegistry

Manages trusted credential issuers with role-based access.

function addIssuer(address issuer, string name, string did, string[] credentialTypes)
function removeIssuer(address issuer)
function isIssuer(address issuer) returns (bool)
function canIssue(address issuer, string credentialType) returns (bool)

CredentialRegistry

Manages credential hashes and revocation status.

function registerCredential(bytes32 credentialHash, address holder, uint256 expiresAt)
function revokeCredential(bytes32 credentialHash)
function getCredentialStatus(bytes32 credentialHash) returns (CredentialStatus)
function isCredentialValid(bytes32 credentialHash) returns (bool)

Deployment

Polygon Amoy Testnet

  1. Create .env file in contracts/:
PRIVATE_KEY=your_private_key
POLYGON_AMOY_RPC_URL=https://rpc-amoy.polygon.technology
POLYGONSCAN_API_KEY=your_api_key
  1. Deploy:
cd contracts
source .env
forge script script/Deploy.s.sol:Deploy --rpc-url $POLYGON_AMOY_RPC_URL --broadcast --verify

Polygon Mainnet

forge script script/Deploy.s.sol:Deploy --rpc-url $POLYGON_RPC_URL --broadcast --verify

Credential Types

Type Description Example Claims
UniversityDegree Academic credentials degreeName, fieldOfStudy, university, graduationDate
EmploymentCredential Employment history employer, jobTitle, department, startDate, endDate
GovernmentID Government-issued ID idType, idNumber, fullName, dateOfBirth, nationality

Security Considerations

  • Private keys never leave the user's wallet
  • BBS+ signatures enable unlinkable presentations
  • On-chain revocation provides instant status updates
  • Role-based access control for issuer management
  • Credential hashes (not full data) stored on-chain

Testing

# Smart contract tests
cd contracts
forge test -vvv

# Credential service tests
cd packages/credential-service
npm test

# Frontend build check
cd packages/frontend
npm run build

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Resources

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors