Introduction
Midnight Auth is a TypeScript library for connecting React applications to the Midnight Network. It provides a simple, secure way to authenticate users, manage sessions, and sign zero-knowledge transactions through the Lace Midnight wallet.
What is Midnight?
Midnight is a data protection blockchain that uses zero-knowledge cryptography to enable private smart contracts. Unlike traditional blockchains where all data is public, Midnight allows developers to build applications that protect sensitive user information while maintaining verifiability.
Why Midnight Auth?
Connecting to Midnight wallets and managing authentication sessions requires boilerplate code that's repetitive across projects. Midnight Auth provides the infrastructure layer so you can focus on building your application.
Core Capabilities
🔐 Wallet Authentication - Connect to Lace Midnight wallet with session persistence and auto-reconnect.
📝 Transaction Signing - Sign and submit zero-knowledge transactions with a simple API.
⚡ Session Management - Automatic session handling with configurable timeouts and reconnection logic.
📘 TypeScript Native - Full type safety with comprehensive type definitions for all Midnight APIs.
Package Information
- Package:
@uppzen/midnight-auth - Version: 1.0.1
- License: MIT
- Repository: github.com/uppzen/midnight-auth
What's Included
Components:
MidnightAuthProvider- Authentication context providerMidnightConnectButton- Pre-built wallet connection UIMidnightWalletInfo- Display connected wallet informationProtectedRoute- Protect routes requiring authentication
Hooks:
useMidnightAuth- Core authentication and wallet operationsuseMidnightWallet- Access wallet state and account datauseMidnightSession- Session status and management
Requirements
- React 18+
- Lace Midnight Wallet browser extension
- Modern browser (Chrome, Firefox, Safari, Edge)
Next Steps
- Installation - Add Midnight Auth to your project
- Quick Start - Basic integration example
- API Reference - Complete API documentation