Identity Rollout Playbook
Operators can authenticate using multiple methods in the Zenpower ecosystem:
- Email-First (Recommended) — Start with email registration and verification. This is the primary onboarding path that unlocks basic access without requiring Web3 knowledge.
- Sign-In with Ethereum (SIWE) — For advanced users, connect a MetaMask wallet for full ecosystem access, including on-chain identity and premium features.
- Keycloak SSO (Legacy) — Traditional OAuth2/OIDC flows for operators transitioning from existing identity providers.
Use this playbook to coordinate the rollout across dev, staging, and production.
Scope
- Surfaces — admin.zenpower.at, status.zenpower.at, landing portals, API docs/swagger, ZenControl CLI.
- Backends —
apps/apiFastAPI service (wallet endpoints), Traefik forward-auth, Keycloak. - Wallet tooling — MetaMask, WalletConnect (optional),
zenctlCLI helpers.
Phased Rollout
Dev PC / WSL (Environment assignment: dev PC / WSL)
- Keep
SIWE_ENABLED=0in.env.devpcwhile developing. - Implement and test nonce + verification endpoints locally (
make api-wallet-smokeonce implemented). - Verify CLI flow:
- Run
zenctl auth wallet --dry-runto ensure the helper opens a browser and returns a mock token. - Capture transcripts under
docs/status/sessions/with timestamps.
- Run
- Update docs (
wallet-auth-roadmap.md) after each milestone.
Staging Cluster
- Toggle
SIWE_ENABLED=1andSIWE_DOMAIN=staging.zenpower.at. - Deploy updated frontend bundles with wallet CTA and ensure fallback login remains available.
- Log outcomes in
logs/dispatch/wallet-auth-staging-<date>.md. - Run browser-based manual tests (MetaMask signature success, rejection, cancellation).
Production Rollout
- Schedule maintenance window; announce change in
docs/status/priorities.docs.json. - Mirror staging config with production domain values.
- Update Keycloak realm to trust wallet-issued tokens (if bridging is required).
- Monitor logs for signature failures and replay attempts; keep
SIWE_REPLAY_CAP=5. - Document the switchover in
docs/status/sessions/<date>-wallet-go-live.md.
Configuration Flags
Add these to .env.example and environment-specific files:
| Variable | Description | Default |
|---|---|---|
SIWE_ENABLED |
Enable wallet endpoints and frontend CTA | 0 |
SIWE_DOMAIN |
Domain used in SIWE message (EIP-4361) | zenpower.at |
SIWE_ALLOWED_ORIGINS |
Comma-separated list for CORS | https://*.zenpower.at |
SIWE_MESSAGE_TEMPLATE |
Custom message suffix for signing prompt | "Sign in to Zenpower Construct" |
SIWE_SESSION_TTL_SECONDS |
Lifetime of wallet-backed session token | 3600 |
SIWE_NONCE_TTL_SECONDS |
TTL for nonce storage | 300 |
API Contract
POST /auth/wallet/nonce→201with{"nonce": "<hex>"}when SIWE is enabled.POST /auth/wallet/verifyexpectsaddress,signature,nonce, and the signedmessage(EIP-4361). Success returns202with{"token": "...", "address": "...", "issued_at": "...", "expires_at": "..."}.- Disabled environments respond with
501for both endpoints; replayed or invalid signatures return401.
Operator Checklist
- Ensure MetaMask is installed and pointing to the correct EVM-compatible network.
- Use
zenctl auth walletor web CTA to link wallet. - Confirm identity in the UI (address, ENS badge, capability NFT status).
- Retain legacy Keycloak credentials as fallback until wallets are primary.
- Report issues via
docs/status/sessions/entries within 30 minutes.
Troubleshooting
- Signature rejected — Validate nonce freshness, domain mismatch, and user signature. Rotate nonce cache if stuck.
- Wallet not detected — Provide instructions for MetaMask installation or use legacy login.
- Replay attack flagged — Ensure backend invalidates nonce after first use; investigate repeated attempts.
- CLI headless usage — Use
zenctl auth wallet --uri-onlyto copy the SIWE URL into another device for signing.
Documentation Tasks
- Sync with
docs/ops/wallet-auth-roadmap.mdmilestones. - Update
docs/ops/forward-auth.mdonce Traefik headers are finalized. - Append wallet onboarding steps to
docs/dev/ONBOARDING.mdanddocs/ops/security-segregation.md. - Add FAQs to
docs/ops/runbooks/identity-wallet.mdwhen established. - Coordinate front-end env vars (
NEXT_PUBLIC_SIWE_DOMAIN,NEXT_PUBLIC_SIWE_URI,NEXT_PUBLIC_SIWE_CHAIN_ID,NEXT_PUBLIC_SIWE_STATEMENT) with backend defaults so the MetaMask flow matches API expectations (seeapps/web/README.md).