aZKey is a privacy-preserving authentication system for Aztec Network that allows users to:
- Create accounts using familiar Web2 identity providers (Google)
- Recover accounts without seed phrases
- Maintain privacy through zero-knowledge proofs
- Control accounts with session owners (ephemeral keys)
# Coming soon - demo will be deployed at azkey.example.com# Clone the repository
git clone https://github.com/eth-ecuador/aZKey.git
cd aZKey
# Install dependencies
pnpm install
# Start the dev interface
cd apps/interface
pnpm dev
# Open http://localhost:5173 in your browsernpm install azkey-sdk
# or
pnpm add azkey-sdkimport { AccountManager } from 'azkey-sdk';
const accountManager = new AccountManager({
googleClientId: process.env.GOOGLE_CLIENT_ID!,
googleClientSecret: process.env.GOOGLE_CLIENT_SECRET,
aztecRpcUrl: process.env.AZTEC_RPC_URL || 'http://localhost:8080',
redirectUri: 'https://yourapp.com/oauth/callback'
});
// Start OAuth flow
const authUrl = accountManager.getAuthUrl();
window.location.href = authUrl;
// Handle callback
const code = new URLSearchParams(window.location.search).get('code');
const authResult = await accountManager.exchangeCode(code);
// Create account
const accountInfo = await accountManager.createAccount(authResult);
console.log('Account created at:', accountInfo.address);
console.log('Session owner:', accountInfo.sessionOwner);User authenticates with Google OAuth, receiving a JWT token.
The SDK derives a permanent account_id from the JWT:
account_id = hash(jwt.sub, jwt.aud)
jwt.sub= Google's unique user ID (private)jwt.aud= Your app's OAuth client ID- This hash is deterministic and consistent
Client-side Noir circuit generates a ZK proof that:
- ✓ The JWT signature is valid (verified with Google's public key)
- ✓ The
account_idmatcheshash(sub, aud) - ✓ Private inputs (JWT content, Google key) stay off-chain
Smart contract is deployed with the account_id stored immutably.
A temporary session_owner (ephemeral key) is authorized to control the account:
- Users sign transactions with this temporary key
- If lost, users can recover with Google OAuth and set a new session owner
- The
account_idensures the same person recovers their own account
┌─────────────────────────────────────────────────────────┐
│ User's Browser │
├──────────────────┬──────────────────┬──────────────────┤
│ Google OAuth │ SDK │ Interface │
│ (Google.com) │ (azkey-sdk) │ (SvelteKit) │
└──────────────────┴──────────────────┴──────────────────┘
│ │ │
├──────────────────┴──────────────────┤
│ │
v v
┌──────────────────┐ ┌───────────────────────┐
│ Google OAuth │ │ Proof Generator │
│ (JWT Issuance) │ │ (Noir Client) │
│ │ │ │
│ Returns: JWT │ │ Generates: ZK Proof │
└──────────────────┘ └───────────────────────┘
│ │
└──────────────────┬───────────────┘
│
v
┌──────────────────────────────────┐
│ Aztec Network (L2) │
├──────────────────────────────────┤
│ JWT Account Contract │
│ - Stores account_id (immutable) │
│ - Stores session_owner (mutable) │
│ - Verifies ZK proofs │
└──────────────────────────────────┘
# Google OAuth
VITE_GOOGLE_CLIENT_ID=your-client-id.apps.googleusercontent.com
VITE_GOOGLE_CLIENT_SECRET=your-client-secret
# Aztec Network
VITE_AZTEC_RPC_URL=http://localhost:8080 # or Aztec testnet RPC
# Callback URL
VITE_REDIRECT_URI=http://localhost:5173/oauth/callbackcd apps/interface
pnpm devcd packages/sdk
pnpm build# Unit tests
pnpm test:unit
# Integration tests (requires Aztec sandbox)
RUN_INTEGRATION_TESTS=true pnpm test:integration
# E2E tests
RUN_E2E_TESTS=true pnpm test:e2eaZKey/
├── apps/
│ └── interface/ # SvelteKit demo app
│ ├── src/
│ │ ├── routes/ # Page routes (home, create-account, etc.)
│ │ └── lib/ # Components (GoogleSignIn, etc.)
│ └── package.json
├── packages/
│ ├── sdk/ # TypeScript SDK
│ │ ├── src/
│ │ │ ├── account/ # Account manager
│ │ │ ├── proof/ # Proof generation
│ │ │ ├── providers/ # OAuth providers (Google, etc.)
│ │ │ └── aztec/ # Aztec client
│ │ └── package.json
│ └── contracts/ # Noir circuits (under development)
│ └── noir/
│ ├── jwt/ # JWT parsing and verification
│ └── jwt_account/ # Main account circuit
├── AGENTS.md # Commands reference
├── README.md # Project overview
└── GETTING_STARTED.md # This file
- Create
packages/sdk/src/providers/apple.ts:
import { BaseProvider } from './base';
export class AppleProvider extends BaseProvider {
// Implement getAuthUrl(), exchangeCode(), etc.
}-
Update
AccountManagerto support the new provider -
Test with the interface
- Set real Google OAuth credentials
- Point to Aztec mainnet RPC
- Deploy interface to Vercel:
vercel deploy - Publish SDK:
npm publish
# Install Aztec
npm install -g @aztec/cli
# Start sandbox
aztec-nargo sandbox
# Interface will connect to http://localhost:8080- Check
VITE_GOOGLE_CLIENT_IDin.env.local - Ensure redirect URI matches in Google Cloud Console
- Browser console should show Google SDK loading
- In demo mode, should work without Aztec
- For real contracts, ensure Aztec RPC is accessible
- Check network tab for failed requests
- Run
pnpm installto ensure dependencies - SDK must be built:
cd packages/sdk && pnpm build - Check TypeScript types with
pnpm check
- Read the API Reference for SDK methods
- Explore Architecture for technical details
- Check Examples for integration patterns
- Join the community - GitHub Discussions coming soon
- 📖 Documentation
- 🐛 Report Issues
- 💬 Discussions
- 📧 Email: team@azkey.dev
MIT - See LICENSE file