{"id":47301319,"url":"https://github.com/subc0der/midnight-cloak","last_synced_at":"2026-03-31T07:00:46.658Z","repository":{"id":342326154,"uuid":"1120722297","full_name":"subc0der/midnight-cloak","owner":"subc0der","description":"Zero-knowledge identity verification infrastructure for Midnight","archived":false,"fork":false,"pushed_at":"2026-03-21T01:37:26.000Z","size":1086,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-03-21T13:56:43.787Z","etag":null,"topics":["cardano","compact","identity","midnightntwrk","privacy","sdk","typescript","zero-knowledge"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/subc0der.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-21T20:08:27.000Z","updated_at":"2026-03-21T01:37:29.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/subc0der/midnight-cloak","commit_stats":null,"previous_names":["subc0der/midnight-cloak"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/subc0der/midnight-cloak","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/subc0der%2Fmidnight-cloak","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/subc0der%2Fmidnight-cloak/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/subc0der%2Fmidnight-cloak/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/subc0der%2Fmidnight-cloak/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/subc0der","download_url":"https://codeload.github.com/subc0der/midnight-cloak/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/subc0der%2Fmidnight-cloak/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31224249,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-31T04:08:55.938Z","status":"ssl_error","status_checked_at":"2026-03-31T04:08:47.883Z","response_time":111,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cardano","compact","identity","midnightntwrk","privacy","sdk","typescript","zero-knowledge"],"created_at":"2026-03-17T03:00:22.711Z","updated_at":"2026-03-31T07:00:46.631Z","avatar_url":"https://github.com/subc0der.png","language":"TypeScript","funding_links":[],"categories":["Identity \u0026 Privacy"],"sub_categories":[],"readme":"# Midnight Cloak\n\n\u003e This project is built on the Midnight Network.\n\nZero-knowledge identity verification infrastructure for [Midnight](https://midnight.network).\n\n**Prove who you are without revealing who you are.**\n\nMidnight Cloak enables dApp developers to verify user attributes (age, credentials, token holdings) using zero-knowledge proofs on the Midnight blockchain. Users prove facts about themselves without exposing underlying personal data.\n\n## Status\n\n**Phase 4: Mainnet Preparation** - Beta Preview\n\n\u003e **Beta Notice:** This SDK currently uses mock proofs. Real ZK proofs will be enabled once Midnight SDK browser patterns stabilize post-mainnet (est. mid-April 2026). The verification UX is fully functional.\n\n| Component | Status | Notes |\n|-----------|--------|-------|\n| @midnight-cloak/core | 0.2.0 | 15 tests passing |\n| @midnight-cloak/react | 0.1.0 | 56 tests passing |\n| @midnight-cloak/wallet | 0.1.0 | 70 tests passing |\n| Wallet Extension | 0.1.0 | 217 tests passing |\n| Contracts | Deployed | Age Verifier + Credential Registry on Preprod |\n| Lace/Eternl Wallets | Working | Multi-wallet support |\n| ZK Proofs | Beta | Mock proofs (real proofs awaiting SDK support) |\n\n## Features\n\n- Age verification without revealing birthdate\n- Credential ownership proofs\n- Token balance verification (planned - awaiting bridge)\n- NFT ownership verification (planned - awaiting bridge)\n- Midnight wallet integration (Lace, Eternl)\n- React components for common verification flows\n- Mock mode for development without wallet\n- Chrome extension for credential management\n\n## Packages\n\n```\npackages/\n  core/             @midnight-cloak/core      Core SDK and verification logic\n  react/            @midnight-cloak/react     React components and hooks\n  wallet/           @midnight-cloak/wallet    Wallet utilities\n  wallet-extension/ Chrome extension          Credential wallet with Lace integration\n  contracts/        @midnight-cloak/contracts Contract types\napps/\n  demo/             Demo application\n```\n\n## Installation\n\n```bash\nnpm install @midnight-cloak/core @midnight-cloak/react\n```\n\n## Quick Start\n\n### Basic Age Verification\n\n```typescript\nimport { MidnightCloakClient } from '@midnight-cloak/core';\n\nconst client = new MidnightCloakClient({ network: 'preprod' });\n\n// Connect Lace Midnight wallet\nawait client.connectWallet('lace');\n\n// Verify age (user signs with wallet, ZK proof generated)\nconst result = await client.verify({\n  type: 'AGE',\n  policy: { kind: 'age', minAge: 18 }\n});\n\nif (result.verified) {\n  // User proved they are 18+ without revealing birthdate\n}\n```\n\n### React Components\n\n```tsx\nimport { MidnightCloakProvider, VerifyButton, CredentialGate } from '@midnight-cloak/react';\n\nfunction App() {\n  return (\n    \u003cMidnightCloakProvider network=\"preprod\"\u003e\n      {/* Simple verification button */}\n      \u003cVerifyButton\n        policy={{ kind: 'age', minAge: 18 }}\n        onVerified={(result) =\u003e console.log('Verified:', result)}\n      \u003e\n        Verify Age (18+)\n      \u003c/VerifyButton\u003e\n\n      {/* Gate content behind verification */}\n      \u003cCredentialGate\n        policy={{ kind: 'age', minAge: 21 }}\n        fallback={({ verify }) =\u003e (\n          \u003cbutton onClick={verify}\u003eVerify to continue\u003c/button\u003e\n        )}\n      \u003e\n        \u003cRestrictedContent /\u003e\n      \u003c/CredentialGate\u003e\n    \u003c/MidnightCloakProvider\u003e\n  );\n}\n```\n\n### Development Mode (No Wallet)\n\n```typescript\nconst client = new MidnightCloakClient({ network: 'preprod' });\n\n// Use mock wallet for testing (disabled in production)\nclient.useMockWallet({ network: 'preprod' });\n\n// Verification works without a real wallet\nconst result = await client.verify({\n  type: 'AGE',\n  policy: { kind: 'age', minAge: 18 }\n});\n```\n\n## API Reference\n\n### MidnightCloakClient\n\n```typescript\nnew MidnightCloakClient(config: ClientConfig)\n\ninterface ClientConfig {\n  network: 'preprod' | 'mainnet' | 'standalone';\n  apiKey?: string;\n  proofServerUrl?: string;  // Default: http://localhost:6300\n  timeout?: number;         // Default: 30000ms\n  preferredWallet?: 'lace' | 'nufi' | 'vespr';\n}\n```\n\n**Methods:**\n\n| Method | Description |\n|--------|-------------|\n| `verify(request)` | Perform ZK verification |\n| `connectWallet(type?)` | Connect to Midnight wallet |\n| `disconnectWallet()` | Disconnect wallet |\n| `isWalletConnected()` | Check connection status |\n| `isLaceAvailable()` | Check if Lace is installed |\n| `useMockWallet(options?)` | Enable mock mode (dev only) |\n| `isProofServerAvailable()` | Check proof server health |\n| `on(event, handler)` | Subscribe to events |\n| `off(event, handler)` | Unsubscribe from events |\n\n### PolicyBuilder\n\n```typescript\nimport { PolicyBuilder } from '@midnight-cloak/core';\n\nconst policy = new PolicyBuilder()\n  .requireAge(21)\n  .and()\n  .requireTokenBalance('ADA', 1000)\n  .build();\n```\n\n### React Components\n\n**MidnightCloakProvider** - Context provider for SDK client\n\n```tsx\n\u003cMidnightCloakProvider\n  network=\"preprod\"\n  apiKey=\"optional-api-key\"\n  onError={(err) =\u003e console.error(err)}\n\u003e\n  {children}\n\u003c/MidnightCloakProvider\u003e\n```\n\n**VerifyButton** - One-click verification button\n\n```tsx\n\u003cVerifyButton\n  policy={{ kind: 'age', minAge: 18 }}\n  onVerified={(result) =\u003e {}}\n  onDenied={() =\u003e {}}\n  onVerificationError={(error) =\u003e {}}\n\u003e\n  Verify Age\n\u003c/VerifyButton\u003e\n```\n\n**CredentialGate** - Conditionally render content based on verification\n\n```tsx\n\u003cCredentialGate\n  policy={{ kind: 'age', minAge: 21 }}\n  persistSession={true}\n  sessionDuration={3600}\n  loading={\u003cSpinner /\u003e}\n  fallback={({ verify, error, status }) =\u003e (\n    \u003cdiv\u003e\n      {error \u0026\u0026 \u003cp\u003e{error.message}\u003c/p\u003e}\n      \u003cbutton onClick={verify}\u003e\n        {status === 'error' ? 'Try Again' : 'Verify to continue'}\n      \u003c/button\u003e\n    \u003c/div\u003e\n  )}\n\u003e\n  \u003cProtectedContent /\u003e\n\u003c/CredentialGate\u003e\n```\n\n### Error Codes\n\n| Code | Constant | Description |\n|------|----------|-------------|\n| E001 | WALLET_NOT_CONNECTED | No wallet connected |\n| E002 | VERIFICATION_DENIED | User rejected verification |\n| E003 | VERIFICATION_TIMEOUT | Request timed out |\n| E004 | INVALID_POLICY | Invalid policy configuration |\n| E005 | CREDENTIAL_NOT_FOUND | Required credential not found |\n| E006 | PROOF_GENERATION_FAILED | ZK proof generation failed |\n| E007 | NETWORK_ERROR | Network request failed |\n| E008 | CONTRACT_ERROR | Smart contract error |\n| E009 | UNSUPPORTED_VERIFICATION_TYPE | Verification type not implemented |\n| E010 | WALLET_ERROR | Wallet operation failed |\n\n## Development\n\n### Prerequisites\n\n- Node.js 18+\n- pnpm 8+\n- Docker (for proof server)\n- Lace Midnight wallet (Chrome extension)\n\n### Setup\n\n```bash\ngit clone \u003crepo-url\u003e\ncd midnight-cloak\npnpm install\n```\n\n### Start Proof Server\n\n```bash\ndocker run -d -p 6300:6300 midnightntwrk/proof-server:7.0.0 midnight-proof-server -v\n\n# Verify it's running\ncurl http://localhost:6300/health\n```\n\n### Build\n\n```bash\n# Build all packages\npnpm build\n\n# Build specific package\npnpm --filter @midnight-cloak/core build\npnpm --filter @midnight-cloak/react build\n```\n\n### Test\n\n```bash\n# Run all tests\npnpm test\n\n# Run specific package tests\npnpm --filter @midnight-cloak/core test\n\n# Watch mode\npnpm --filter @midnight-cloak/core test:watch\n```\n\n### Demo App\n\n```bash\npnpm dev\n```\n\nOpens demo application at `http://localhost:5173`\n\n## Project Structure\n\n```\nmidnight-cloak/\n  packages/\n    core/                 Core SDK\n      src/\n        client.ts         Main client class\n        verifier.ts       Verification logic\n        policy-builder.ts Policy construction\n        wallet-connector.ts Wallet integration\n        errors.ts         Error definitions\n        types.ts          TypeScript types\n    react/                React integration\n      src/\n        components/\n          MidnightCloakProvider.tsx  Context provider\n          VerifyButton.tsx    Verification button\n          CredentialGate.tsx  Content gating\n        hooks/\n          useMidnightCloak.ts        Client hook\n    wallet-extension/     Chrome extension\n      src/\n        popup/            Extension UI\n        background/       Service worker\n        content/          Content scripts and page API\n    contracts/            Contract interfaces\n  apps/\n    demo/                 Demo application\n```\n\n## Technology\n\n| Layer | Technology |\n|-------|------------|\n| Smart Contracts | Compact (Midnight ZK language) |\n| SDK | TypeScript |\n| React Components | React 18+ |\n| Wallet Integration | CIP-30 (Cardano) |\n| Network | Midnight Preprod / Mainnet |\n\n## Roadmap\n\n1. **Phase 1** - Foundation (Complete)\n   - Environment setup\n   - Architecture design\n\n2. **Phase 2** - Core SDK MVP (Complete)\n   - Age verification flow\n   - React components\n   - Mock wallet for development\n   - Contract deployment to Preprod\n\n3. **Phase 3** - Wallet Extension (Complete)\n   - Chrome extension with password-protected vault\n   - Argon2id encryption with 12+ character password requirements\n   - Lace and Eternl wallet integration\n   - Credential management and verification request flows\n   - dApp API (`window.midnightCloak`)\n\n4. **Phase 4** - Mainnet Preparation (Current - Beta Preview)\n   - 358 tests across all packages\n   - Security hardening (password strength, policy validation)\n   - Real ZK proofs: Awaiting SDK browser support (est. mid-April 2026)\n   - Additional credential types: Awaiting Cardano↔Midnight bridge\n\n5. **Phase 5** - $Handle Shield (Planned)\n   - Cardano to Midnight bridge integration (~May-June 2026)\n   - $handle claim circuit\n   - Asset shielding UI\n   - ZK proofs for hidden holdings\n\n6. **Phase 6** - Production \u0026 Growth\n   - Mainnet deployment\n   - Developer dashboard\n   - Additional verification types\n   - Partner integrations\n\n## Documentation\n\n- [Integration Guide](docs/INTEGRATION.md) - Step-by-step tutorial for dApp developers\n- [Core SDK Reference](packages/core/README.md) - Full API documentation\n- [React Components](packages/react/README.md) - Component props and hooks\n- [Security Architecture](docs/SECURITY.md) - Cryptographic choices and design\n\n## License\n\nApache 2.0 - See [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsubc0der%2Fmidnight-cloak","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsubc0der%2Fmidnight-cloak","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsubc0der%2Fmidnight-cloak/lists"}