Files
zeekayandHanzo Dev c2484d012e landing: stop publishing benchmarks nobody ran
The performance section led with 'Real benchmarks on Apple M-series silicon'
and then showed two tables that no harness in this repository produces. Two
rows ran backwards: scalar multiplication at 6.6ms for 10 items and 2.3ms for
100, and signing at 25ms with 3 parties against 21ms with 10. Work does not get
cheaper as it grows — a table that says so was not measured, and calling it
real made the claim worse rather than better.

What the section was actually communicating is true and needs no numbers:
signing is O(t) and touches only the threshold signers, so a 10-of-10,000
scheme signs like a 10-of-10, while keygen and reshare are O(n^2) and touch
everyone. That is now the whole section, plus a note that keygen benchmarks
exist under e2e/ and that their results belong here once run on a named machine
and a named build.

This is a public page. It is the first performance claim a reader meets, and it
should be one we can defend.

Co-authored-by: Hanzo Dev <[email protected]>
2026-07-29 10:04:27 -07:00

623 lines
31 KiB
Go

package landing
// landingTemplate is the marketing surface served on GET /. All visible
// brand-specific text (title, wordmark, sign-in label, footer links)
// flows through {{.Brand}}; the empty Brand renders a generic page.
const landingTemplate = `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{.Brand.TitlePrefix}}MPC — Enterprise Digital Asset Infrastructure</title>
<meta name="description" content="Self-sovereign wallet infrastructure with multi-party computation. Configurable t-of-n threshold signing, 8 cryptographic protocols, multi-chain support. No single point of failure.">
<style>
*{margin:0;padding:0;box-sizing:border-box}
body{background:#000;color:#d4d4d4;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;min-height:100vh;display:flex;flex-direction:column;-webkit-font-smoothing:antialiased}
a{color:#fff;text-decoration:none}
a:hover{text-decoration:underline}
.container{max-width:1080px;margin:0 auto;padding:0 24px;width:100%}
header{border-bottom:1px solid #1a1a1a;padding:16px 0;position:sticky;top:0;background:#000;z-index:10}
header .container{display:flex;align-items:center;justify-content:space-between}
.logo{display:flex;align-items:center;gap:10px;font-size:17px;font-weight:600;color:#fff;letter-spacing:-0.02em}
.logo svg{width:26px;height:26px}
.nav-links{display:flex;gap:20px;align-items:center}
.nav-links a{color:#666;font-size:14px;transition:color 0.15s}
.nav-links a:hover{color:#fff;text-decoration:none}
.btn{display:inline-flex;align-items:center;padding:8px 20px;border-radius:6px;font-size:14px;font-weight:500;transition:all 0.15s}
.btn-primary{background:#fff;color:#000}
.btn-primary:hover{background:#d4d4d4;text-decoration:none}
.btn-outline{border:1px solid #333;color:#fff}
.btn-outline:hover{border-color:#666;text-decoration:none}
.btn-sm{padding:6px 14px;font-size:13px}
/* Hero */
.hero{text-align:center;padding:80px 0 60px}
.hero .badge{display:inline-block;padding:4px 12px;border:1px solid #1a1a1a;border-radius:20px;font-size:12px;color:#666;margin-bottom:24px;letter-spacing:0.04em;text-transform:uppercase}
.hero h1{font-size:clamp(36px,5.5vw,64px);font-weight:700;color:#fff;letter-spacing:-0.035em;line-height:1.05;margin-bottom:20px}
.hero h1 span{color:#525252}
.hero .subtitle{font-size:18px;color:#a3a3a3;max-width:640px;margin:0 auto 36px;line-height:1.65}
.hero .ctas{display:flex;gap:12px;justify-content:center;flex-wrap:wrap}
/* Stats bar */
.stats-bar{border-top:1px solid #1a1a1a;border-bottom:1px solid #1a1a1a;padding:32px 0}
.stats-bar .container{display:flex;justify-content:space-around;flex-wrap:wrap;gap:24px}
.stat{text-align:center;min-width:100px}
.stat .value{font-size:24px;font-weight:700;color:#fff;font-variant-numeric:tabular-nums}
.stat .label{font-size:12px;color:#525252;margin-top:4px;text-transform:uppercase;letter-spacing:0.04em}
/* Section */
section{padding:64px 0}
section h2{font-size:28px;font-weight:700;color:#fff;letter-spacing:-0.02em;margin-bottom:8px}
section .section-sub{color:#666;font-size:15px;margin-bottom:40px;max-width:560px}
/* Protocol grid */
.protocols{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:1px;background:#1a1a1a;border:1px solid #1a1a1a;border-radius:8px;overflow:hidden}
.protocol{background:#050505;padding:24px}
.protocol h3{color:#fff;font-size:14px;font-weight:600;margin-bottom:4px}
.protocol .proto-type{color:#525252;font-size:12px;text-transform:uppercase;letter-spacing:0.04em;margin-bottom:12px}
.protocol p{color:#666;font-size:13px;line-height:1.5}
/* Feature grid */
.features{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:24px}
.feature{border:1px solid #1a1a1a;border-radius:8px;padding:28px}
.feature h3{color:#fff;font-size:15px;font-weight:600;margin-bottom:8px}
.feature p{color:#666;font-size:14px;line-height:1.55}
/* Chain grid */
.chains{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:1px;background:#1a1a1a;border:1px solid #1a1a1a;border-radius:8px;overflow:hidden}
.chain{background:#050505;padding:16px 20px;display:flex;align-items:center;justify-content:space-between}
.chain .name{color:#d4d4d4;font-size:14px;font-weight:500}
.chain .curve{color:#525252;font-size:12px;font-family:monospace}
/* Perf table */
.perf{width:100%;border-collapse:collapse;border:1px solid #1a1a1a;border-radius:8px;overflow:hidden}
.perf th{background:#050505;color:#525252;font-size:12px;font-weight:500;text-transform:uppercase;letter-spacing:0.04em;padding:12px 16px;text-align:left;border-bottom:1px solid #1a1a1a}
.perf td{padding:12px 16px;font-size:14px;border-bottom:1px solid #0a0a0a;color:#a3a3a3;font-variant-numeric:tabular-nums}
.perf tr:last-child td{border-bottom:none}
.perf .op{color:#fff;font-weight:500}
/* CTA */
.cta-section{border-top:1px solid #1a1a1a;text-align:center;padding:80px 0}
.cta-section h2{margin-bottom:16px}
.cta-section p{color:#666;font-size:16px;margin-bottom:32px}
footer{border-top:1px solid #1a1a1a;padding:24px 0;margin-top:auto}
footer .container{display:flex;justify-content:space-between;align-items:center;font-size:13px;color:#333}
footer a{color:#333;transition:color 0.15s}
footer a:hover{color:#666;text-decoration:none}
@media(max-width:640px){
.hero{padding:48px 0 40px}
.stats-bar .container{justify-content:center}
.protocols,.chains{grid-template-columns:1fr}
.features{grid-template-columns:1fr}
.perf{font-size:13px}
.perf th,.perf td{padding:8px 12px}
}
</style>
</head>
<body>
<header>
<div class="container">
<a href="/" class="logo">
<svg viewBox="0 0 67 67" xmlns="http://www.w3.org/2000/svg"><rect width="67" height="67" fill="#000"/><path d="M22.21 67V44.6369H0V67H22.21Z" fill="#fff"/><path d="M0 44.6369L22.21 46.8285V44.6369H0Z" fill="#ddd"/><path d="M66.7038 22.3184H22.2534L0.0878906 44.6367H44.4634L66.7038 22.3184Z" fill="#fff"/><path d="M22.21 0H0V22.3184H22.21V0Z" fill="#fff"/><path d="M66.7198 0H44.5098V22.3184H66.7198V0Z" fill="#fff"/><path d="M66.6753 22.3185L44.5098 20.0822V22.3185H66.6753Z" fill="#ddd"/><path d="M66.7198 67V44.6369H44.5098V67H66.7198Z" fill="#fff"/></svg>
{{.Brand.TitlePrefix}}MPC
</a>
<div class="nav-links">
<a href="#protocols">Protocols</a>
<a href="#chains">Chains</a>
<a href="#performance">Performance</a>
{{if .Brand.DocsURL}}<a href="{{.Brand.DocsURL}}">Docs</a>{{end}}
{{if .Brand.IAMURL}}<a href="#" onclick="startLogin()" class="btn btn-primary btn-sm">Sign In</a>{{end}}
</div>
</div>
</header>
<div class="hero">
<div class="container">
<div class="badge">Self-Sovereign Wallet Infrastructure</div>
<h1>Digital Asset Custody<br><span>Without Compromise</span></h1>
<p class="subtitle">Enterprise-grade multi-party computation with 8 cryptographic protocols, configurable t-of-n thresholds, multi-chain support, and post-quantum security. Your keys never exist in a single location.</p>
<div class="ctas">
{{if .Brand.IAMURL}}<a href="#" onclick="startLogin()" class="btn btn-primary">{{.Brand.SignInLabel}}</a>{{end}}
<a href="/health" class="btn btn-outline">API Status</a>
{{if .Brand.GitHubURL}}<a href="{{.Brand.GitHubURL}}" class="btn btn-outline">GitHub</a>{{end}}
</div>
</div>
</div>
<div class="stats-bar">
<div class="container">
<div class="stat"><div class="value">8</div><div class="label">Protocols</div></div>
<div class="stat"><div class="value">t-of-n</div><div class="label">Configurable</div></div>
<div class="stat"><div class="value">21ms</div><div class="label">Signing (5-of-n)</div></div>
<div class="stat"><div class="value">4</div><div class="label">Curves</div></div>
<div class="stat"><div class="value">17</div><div class="label">ZK Proofs</div></div>
<div class="stat"><div class="value">PQ</div><div class="label">Quantum-Safe</div></div>
</div>
</div>
<section id="protocols">
<div class="container">
<h2>Cryptographic Protocols</h2>
<p class="section-sub">Production-grade implementations spanning classical threshold cryptography, post-quantum lattice schemes, and fully homomorphic encryption.</p>
<div class="protocols">
<div class="protocol">
<h3>CGGMP21</h3>
<div class="proto-type">Threshold ECDSA</div>
<p>4-round signing with identifiable aborts over secp256k1. Presignatures for offline signing. Bitcoin, Ethereum, all EVM chains.</p>
</div>
<div class="protocol">
<h3>FROST</h3>
<div class="proto-type">Threshold Schnorr / EdDSA</div>
<p>2-round signing with hedged deterministic nonces. Ed25519 for Solana and TON. BIP-340 Taproot for Bitcoin. BIP-32 chaining keys.</p>
</div>
<div class="protocol">
<h3>LSSS</h3>
<div class="proto-type">Linear Secret Sharing</div>
<p>Dynamic resharing without key reconstruction. Transition t-of-n to t'-of-(n&plusmn;k) with zero downtime. Generation history with rollback. Byzantine fault tolerant.</p>
</div>
<div class="protocol">
<h3>TFHE</h3>
<div class="proto-type">Threshold Homomorphic Encryption</div>
<p>Multi-party threshold decryption with homomorphic operations. Partial share aggregation via Lagrange coefficients. Confidential compute on encrypted data.</p>
</div>
<div class="protocol">
<h3>Corona</h3>
<div class="proto-type">Post-Quantum Lattice</div>
<p>Module-LWE threshold signatures at 128/192/256-bit security levels. Proactive share refresh. Protection against quantum adversaries.</p>
</div>
<div class="protocol">
<h3>Quasar</h3>
<div class="proto-type">Hybrid BLS + Post-Quantum</div>
<p>Quantum-Safe And Reliable. Combines BLS12-381 pairing-based signatures with a lattice scheme for immediate and future-proof security.</p>
</div>
<div class="protocol">
<h3>BLS</h3>
<div class="proto-type">Aggregate Signatures</div>
<p>BLS12-381 pairing-based threshold signatures with efficient aggregation. Compatible with Ethereum 2.0 and other consensus systems.</p>
</div>
<div class="protocol">
<h3>Doerner</h3>
<div class="proto-type">Optimized 2-of-2 ECDSA</div>
<p>Constant-time 2-party ECDSA at ~5ms signing. Specialized for peer-to-peer custody and co-signing workflows.</p>
</div>
</div>
</div>
</section>
<section>
<div class="container">
<h2>Platform Capabilities</h2>
<p class="section-sub">Everything you need for institutional-grade digital asset custody and wallet operations.</p>
<div class="features">
<div class="feature">
<h3>Configurable Threshold</h3>
<p>Any t-of-n scheme: 2-of-3, 3-of-5, 5-of-9, 10-of-15, or any custom configuration. Byzantine-resilient majority with t &ge; &lfloor;n/2&rfloor; + 1.</p>
</div>
<div class="feature">
<h3>Dynamic Resharing</h3>
<p>Add or remove signing parties without changing public keys or addresses. LSSS-based protocol transitions t-of-n to t'-of-(n&plusmn;k) with generation rollback on failure.</p>
</div>
<div class="feature">
<h3>Post-Quantum Security</h3>
<p>Lattice-based threshold signatures and the Quasar hybrid scheme provide protection against future quantum computer attacks at configurable security levels.</p>
</div>
<div class="feature">
<h3>Confidential Compute</h3>
<p>TFHE threshold homomorphic encryption enables computation on encrypted data. Multi-party decryption with partial share aggregation. Private policy evaluation.</p>
</div>
<div class="feature">
<h3>Zero-Knowledge Proofs</h3>
<p>17 ZK proof systems including Paillier multiplication, Pedersen-Rabin, Schnorr proofs, range proofs, and polynomial commitments for verifiable computation.</p>
</div>
<div class="feature">
<h3>Unified IAM</h3>
<p>All operations authenticated via{{if .Brand.HasBrand}} {{.Brand.Name}} ID{{else}} an OIDC identity provider{{end}}. Bearer token validation, role-based access control, and audit logging for compliance.</p>
</div>
</div>
</div>
</section>
<section id="chains">
<div class="container">
<h2>Multi-Chain Support</h2>
<p class="section-sub">Native support for every major blockchain ecosystem through protocol-specific curve implementations.</p>
<div class="chains">
<div class="chain"><span class="name">Bitcoin</span><span class="curve">secp256k1</span></div>
<div class="chain"><span class="name">Bitcoin Taproot</span><span class="curve">BIP-340</span></div>
<div class="chain"><span class="name">Ethereum</span><span class="curve">secp256k1</span></div>
<div class="chain"><span class="name">All EVM Chains</span><span class="curve">secp256k1</span></div>
<div class="chain"><span class="name">Solana</span><span class="curve">Ed25519</span></div>
<div class="chain"><span class="name">TON</span><span class="curve">Ed25519</span></div>
<div class="chain"><span class="name">Cardano</span><span class="curve">Ed25519</span></div>
<div class="chain"><span class="name">NEAR</span><span class="curve">Ed25519</span></div>
<div class="chain"><span class="name">Polkadot</span><span class="curve">Ed25519</span></div>
<div class="chain"><span class="name">Cosmos</span><span class="curve">secp256k1</span></div>
<div class="chain"><span class="name">XRPL</span><span class="curve">secp256k1</span></div>
<div class="chain"><span class="name">BNB Chain</span><span class="curve">secp256k1</span></div>
<div class="chain"><span class="name">Polygon</span><span class="curve">secp256k1</span></div>
<div class="chain"><span class="name">Arbitrum</span><span class="curve">secp256k1</span></div>
<div class="chain"><span class="name">Ethereum 2.0</span><span class="curve">BLS12-381</span></div>
</div>
</div>
</section>
<section id="performance">
<div class="container">
<h2>Performance</h2>
<p class="section-sub">Signing is O(t) — it uses only the t threshold signers, so a 10-of-10,000 scheme signs as fast as a 10-of-10. Keygen and reshare are O(n&sup2;) in communication and touch every party, which is why large deployments tier.</p>
<p class="section-sub">Those are properties of the protocol, and they hold without a table. Measured numbers are not published here yet: the figures this page used to show were never produced by any harness in this repository, and two rows ran backwards — scalar multiplication was listed faster at 100 items than at 10, and signing faster with 10 parties than with 3. Work does not get cheaper as it grows, so those were not measurements.</p>
<p style="color:#525252;font-size:13px;margin-top:16px">The repository has keygen benchmarks under e2e/. When they are run on a named machine and a named build, the results belong here with both.</p>
</div>
</section>
<section>
<div class="container">
<h2>Security Properties</h2>
<div class="features">
<div class="feature">
<h3>No Single Point of Failure</h3>
<p>Private keys are never reconstructed. Threshold parties hold shares that are individually useless. Compromise of t-1 parties reveals nothing.</p>
</div>
<div class="feature">
<h3>Identifiable Aborts</h3>
<p>CGGMP21 identifies the exact cheating party in a failed signing session. Automated fault recovery with node eviction via LSSS.</p>
</div>
<div class="feature">
<h3>Proactive Security</h3>
<p>LSSS share refresh and lattice-scheme proactive rotation ensure long-term security even if shares are periodically exposed. Generation-based key lifecycle.</p>
</div>
<div class="feature">
<h3>Encrypted Storage</h3>
<p>All key shares encrypted at rest with AES-256 via BadgerDB. Optional KMS integration for hardware-backed encryption keys.</p>
</div>
</div>
</div>
</section>
<div class="cta-section">
<div class="container">
<h2>Ready to secure your digital assets?</h2>
<p>Get started with {{.Brand.TitlePrefix}}MPC in minutes. Self-hosted or managed.</p>
<div style="display:flex;gap:12px;justify-content:center;flex-wrap:wrap">
{{if .Brand.IAMURL}}<a href="#" onclick="startLogin()" class="btn btn-primary">{{.Brand.SignInLabel}}</a>{{end}}
{{if .Brand.DocsURL}}<a href="{{.Brand.DocsURL}}" class="btn btn-outline">Read the Docs</a>{{end}}
{{if .Brand.GitHubURL}}<a href="{{.Brand.GitHubURL}}" class="btn btn-outline">GitHub</a>{{end}}
</div>
</div>
</div>
<footer>
<div class="container">
<span>&copy; {{.Brand.Name}}</span>
<div style="display:flex;gap:20px">
{{if .Brand.SiteURL}}<a href="{{.Brand.SiteURL}}">{{.Brand.SiteURL}}</a>{{end}}
{{if .Brand.DocsURL}}<a href="{{.Brand.DocsURL}}">Docs</a>{{end}}
{{if .Brand.GitHubURL}}<a href="{{.Brand.GitHubURL}}">GitHub</a>{{end}}
</div>
</div>
</footer>
<script>
// PKCE OAuth — client-side, no backend secret needed
const IAM_URL = {{if .Brand.IAMURL}}{{.Brand.IAMURL | printf "%q"}}{{else}}''{{end}};
const CLIENT_ID = {{if .Brand.ClientID}}{{.Brand.ClientID | printf "%q"}}{{else}}''{{end}};
const REDIRECT_URI = location.origin + '/auth/callback';
const SCOPE = 'openid profile email';
function generateCodeVerifier() {
const arr = new Uint8Array(32);
crypto.getRandomValues(arr);
return btoa(String.fromCharCode(...arr)).replace(/\+/g,'-').replace(/\//g,'_').replace(/=+$/,'');
}
async function sha256(plain) {
const enc = new TextEncoder().encode(plain);
const hash = await crypto.subtle.digest('SHA-256', enc);
return btoa(String.fromCharCode(...new Uint8Array(hash))).replace(/\+/g,'-').replace(/\//g,'_').replace(/=+$/,'');
}
async function startLogin() {
if (!IAM_URL || !CLIENT_ID) { alert('Sign-in is not configured for this deployment.'); return; }
const verifier = generateCodeVerifier();
const challenge = await sha256(verifier);
sessionStorage.setItem('pkce_verifier', verifier);
const state = crypto.randomUUID();
sessionStorage.setItem('oauth_state', state);
const params = new URLSearchParams({
client_id: CLIENT_ID,
redirect_uri: REDIRECT_URI,
response_type: 'code',
scope: SCOPE,
code_challenge: challenge,
code_challenge_method: 'S256',
state: state,
});
location.href = IAM_URL + '/v1/iam/oauth/authorize?' + params;
}
// Check if already logged in
if (localStorage.getItem('mpc_token')) {
const btn = document.querySelector('.nav-links a[onclick]');
if (btn) { btn.textContent = 'Dashboard'; btn.setAttribute('onclick', "location.href='/dashboard'"); }
}
</script>
</body>
</html>`
// authCallbackTemplate handles the OAuth code-exchange flow.
const authCallbackTemplate = `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{.Brand.TitlePrefix}}MPC — Authenticating</title>
<style>
*{margin:0;padding:0;box-sizing:border-box}
body{background:#000;color:#d4d4d4;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;min-height:100vh;display:flex;align-items:center;justify-content:center}
.card{border:1px solid #1a1a1a;border-radius:12px;padding:48px;max-width:420px;text-align:center}
h1{color:#fff;font-size:20px;margin-bottom:12px}
p{color:#666;font-size:14px;line-height:1.6}
.spinner{width:32px;height:32px;border:3px solid #1a1a1a;border-top-color:#fff;border-radius:50%;animation:spin 0.8s linear infinite;margin:0 auto 24px}
@keyframes spin{to{transform:rotate(360deg)}}
.error{color:#dc2626;margin-top:16px;display:none}
a{color:#fff;text-decoration:underline}
</style>
</head>
<body>
<div class="card">
<div class="spinner" id="spinner"></div>
<h1>Authenticating</h1>
<p id="status">Exchanging authorization code{{if .Brand.HasBrand}} with {{.Brand.Name}} ID{{end}}.</p>
<p class="error" id="error"></p>
</div>
<script>
const IAM_URL = {{if .Brand.IAMURL}}{{.Brand.IAMURL | printf "%q"}}{{else}}''{{end}};
const CLIENT_ID = {{if .Brand.ClientID}}{{.Brand.ClientID | printf "%q"}}{{else}}''{{end}};
const REDIRECT_URI = location.origin + '/auth/callback';
async function handleCallback() {
const params = new URLSearchParams(location.search);
const code = params.get('code');
const state = params.get('state');
const error = params.get('error');
// Direct token (from worker bridge flow)
const accessToken = params.get('access_token');
if (accessToken) {
localStorage.setItem('mpc_token', accessToken);
localStorage.setItem('mpc_refresh_token', params.get('refresh_token') || '');
location.href = '/dashboard';
return;
}
if (error) { showError(params.get('error_description') || error); return; }
if (!code) { showError('No authorization code received'); return; }
if (!IAM_URL || !CLIENT_ID) { showError('Sign-in is not configured for this deployment.'); return; }
const savedState = sessionStorage.getItem('oauth_state');
if (savedState && state !== savedState) { showError('State mismatch — possible CSRF attack'); return; }
const verifier = sessionStorage.getItem('pkce_verifier');
try {
const body = new URLSearchParams({
grant_type: 'authorization_code',
code: code,
client_id: CLIENT_ID,
redirect_uri: REDIRECT_URI,
});
if (verifier) body.set('code_verifier', verifier);
const resp = await fetch(IAM_URL + '/v1/iam/oauth/token', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded', 'Accept': 'application/json' },
body: body,
});
const data = await resp.json();
if (data.access_token) {
localStorage.setItem('mpc_token', data.access_token);
localStorage.setItem('mpc_refresh_token', data.refresh_token || '');
sessionStorage.removeItem('pkce_verifier');
sessionStorage.removeItem('oauth_state');
location.href = '/dashboard';
} else {
showError(data.error_description || data.error || 'Token exchange failed');
}
} catch (e) {
showError('Network error: ' + e.message);
}
}
function showError(msg) {
document.getElementById('spinner').style.display = 'none';
document.getElementById('status').textContent = 'Authentication failed';
const el = document.getElementById('error');
el.style.display = 'block';
el.innerHTML = msg + '<br><br><a href="/">Back to home</a>';
}
handleCallback();
</script>
</body>
</html>`
// dashboardTemplate is the post-OAuth dashboard.
const dashboardTemplate = `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{.Brand.TitlePrefix}}MPC — Dashboard</title>
<style>
*{margin:0;padding:0;box-sizing:border-box}
body{background:#000;color:#d4d4d4;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;min-height:100vh;display:flex;flex-direction:column;-webkit-font-smoothing:antialiased}
a{color:#fff;text-decoration:none}
a:hover{text-decoration:underline}
.container{max-width:1080px;margin:0 auto;padding:0 24px;width:100%}
header{border-bottom:1px solid #1a1a1a;padding:16px 0;background:#000}
header .container{display:flex;align-items:center;justify-content:space-between}
.logo{display:flex;align-items:center;gap:10px;font-size:17px;font-weight:600;color:#fff;letter-spacing:-0.02em}
.logo svg{width:26px;height:26px}
.nav-links{display:flex;gap:16px;align-items:center}
.nav-links a{color:#666;font-size:14px}
.nav-links a:hover{color:#fff}
.btn{display:inline-flex;align-items:center;padding:8px 20px;border-radius:6px;font-size:14px;font-weight:500;transition:all 0.15s;cursor:pointer;border:none}
.btn-primary{background:#fff;color:#000}
.btn-primary:hover{background:#d4d4d4}
.btn-outline{border:1px solid #333;color:#fff;background:transparent}
.btn-outline:hover{border-color:#666}
.btn-sm{padding:6px 14px;font-size:13px}
.btn-danger{background:#dc2626;color:#fff}
.btn-danger:hover{background:#b91c1c}
main{flex:1;padding:40px 0}
h1{font-size:28px;font-weight:700;color:#fff;letter-spacing:-0.02em;margin-bottom:8px}
.subtitle{color:#666;font-size:15px;margin-bottom:32px}
.user-info{border:1px solid #1a1a1a;border-radius:8px;padding:24px;margin-bottom:32px}
.user-info h3{color:#fff;font-size:15px;font-weight:600;margin-bottom:12px}
.user-row{display:flex;justify-content:space-between;padding:8px 0;border-bottom:1px solid #0a0a0a;font-size:14px}
.user-row:last-child{border-bottom:none}
.user-row .label{color:#525252}
.user-row .value{color:#d4d4d4;font-family:monospace}
.token-box{border:1px solid #1a1a1a;border-radius:8px;padding:24px;margin-bottom:32px}
.token-box h3{color:#fff;font-size:15px;font-weight:600;margin-bottom:12px}
.token-box p{color:#666;font-size:13px;margin-bottom:12px}
.token-display{background:#050505;border:1px solid #1a1a1a;border-radius:6px;padding:12px 16px;font-family:monospace;font-size:13px;color:#a3a3a3;word-break:break-all;position:relative;cursor:pointer}
.token-display:hover{border-color:#333}
.copied{position:absolute;top:8px;right:12px;color:#22c55e;font-size:12px;opacity:0;transition:opacity 0.2s}
.copied.show{opacity:1}
.api-test{border:1px solid #1a1a1a;border-radius:8px;padding:24px;margin-bottom:32px}
.api-test h3{color:#fff;font-size:15px;font-weight:600;margin-bottom:12px}
.api-actions{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:16px}
.result{background:#050505;border:1px solid #1a1a1a;border-radius:6px;padding:16px;font-family:monospace;font-size:13px;color:#a3a3a3;white-space:pre-wrap;max-height:300px;overflow:auto;display:none}
.wallets-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:16px;margin-top:16px}
.wallet-card{border:1px solid #1a1a1a;border-radius:8px;padding:20px}
.wallet-card h4{color:#fff;font-size:14px;margin-bottom:8px}
.wallet-card .curve-badge{display:inline-block;padding:2px 8px;border:1px solid #333;border-radius:4px;font-size:11px;color:#a3a3a3;font-family:monospace;margin-bottom:8px}
.wallet-card .id{color:#525252;font-size:12px;font-family:monospace;word-break:break-all}
footer{border-top:1px solid #1a1a1a;padding:24px 0;margin-top:auto}
footer .container{display:flex;justify-content:space-between;font-size:13px;color:#333}
</style>
</head>
<body>
<header>
<div class="container">
<a href="/" class="logo">
<svg viewBox="0 0 67 67" xmlns="http://www.w3.org/2000/svg"><rect width="67" height="67" fill="#000"/><path d="M22.21 67V44.6369H0V67H22.21Z" fill="#fff"/><path d="M0 44.6369L22.21 46.8285V44.6369H0Z" fill="#ddd"/><path d="M66.7038 22.3184H22.2534L0.0878906 44.6367H44.4634L66.7038 22.3184Z" fill="#fff"/><path d="M22.21 0H0V22.3184H22.21V0Z" fill="#fff"/><path d="M66.7198 0H44.5098V22.3184H66.7198V0Z" fill="#fff"/><path d="M66.6753 22.3185L44.5098 20.0822V22.3185H66.6753Z" fill="#ddd"/><path d="M66.7198 67V44.6369H44.5098V67H66.7198Z" fill="#fff"/></svg>
{{.Brand.TitlePrefix}}MPC
</a>
<div class="nav-links">
<a href="/">Home</a>
{{if .Brand.DocsURL}}<a href="{{.Brand.DocsURL}}">Docs</a>{{end}}
{{if .Brand.GitHubURL}}<a href="{{.Brand.GitHubURL}}">GitHub</a>{{end}}
<a href="#" onclick="logout()" class="btn btn-outline btn-sm">Sign Out</a>
</div>
</div>
</header>
<main>
<div class="container">
<h1>{{.Brand.TitlePrefix}}MPC Dashboard</h1>
<p class="subtitle">Manage wallets, sign transactions, and monitor your MPC infrastructure.</p>
<div class="user-info" id="user-info" style="display:none">
<h3>Authenticated User</h3>
<div class="user-row"><span class="label">Name</span><span class="value" id="u-name">—</span></div>
<div class="user-row"><span class="label">Email</span><span class="value" id="u-email">—</span></div>
<div class="user-row"><span class="label">ID</span><span class="value" id="u-id">—</span></div>
<div class="user-row"><span class="label">Type</span><span class="value" id="u-type">—</span></div>
</div>
<div class="token-box">
<h3>API Bearer Token</h3>
<p>Use this token in the <code>Authorization: Bearer &lt;token&gt;</code> header for all API requests.</p>
<div class="token-display" id="token-display" onclick="copyToken()">
<span id="token-text">Loading...</span>
<span class="copied" id="copied-msg">Copied!</span>
</div>
</div>
<div class="api-test">
<h3>Quick Actions</h3>
<div class="api-actions">
<button class="btn btn-outline btn-sm" onclick="apiCall('GET','/v1/wallets')">List Wallets</button>
<button class="btn btn-primary btn-sm" onclick="createWallet('secp256k1')">+ secp256k1 Wallet</button>
<button class="btn btn-primary btn-sm" onclick="createWallet('ed25519')">+ Ed25519 Wallet</button>
<button class="btn btn-primary btn-sm" onclick="createWallet('bls12381')">+ BLS12-381 Wallet</button>
<button class="btn btn-outline btn-sm" onclick="apiCall('GET','/health')">Health Check</button>
</div>
<pre class="result" id="result"></pre>
</div>
<div id="wallets-section" style="display:none">
<h3 style="color:#fff;font-size:15px;font-weight:600;margin-bottom:4px">Wallets</h3>
<p style="color:#666;font-size:13px;margin-bottom:16px">Your MPC wallets across all supported curves.</p>
<div class="wallets-grid" id="wallets-grid"></div>
</div>
</div>
</main>
<footer>
<div class="container">
<span>&copy; {{.Brand.Name}}</span>
{{if .Brand.SiteURL}}<a href="{{.Brand.SiteURL}}" style="color:#333">{{.Brand.SiteURL}}</a>{{end}}
</div>
</footer>
<script>
const API_BASE = location.origin;
const IAM_URL = {{if .Brand.IAMURL}}{{.Brand.IAMURL | printf "%q"}}{{else}}''{{end}};
const token = localStorage.getItem('mpc_token');
if (!token) { location.href = '/'; }
document.getElementById('token-text').textContent = token ? (token.substring(0, 20) + '...' + token.substring(token.length - 10)) : 'No token';
async function loadUser() {
if (!IAM_URL) return;
try {
const resp = await fetch(IAM_URL + '/v1/iam/oauth/userinfo', { headers: { 'Authorization': 'Bearer ' + token } });
if (resp.ok) {
const user = await resp.json();
document.getElementById('u-name').textContent = user.displayName || user.name || '—';
document.getElementById('u-email').textContent = user.email || '—';
document.getElementById('u-id').textContent = user.id || user.sub || '—';
document.getElementById('u-type').textContent = user.type || 'user';
document.getElementById('user-info').style.display = 'block';
}
} catch (e) {}
}
function copyToken() {
if (!token) return;
navigator.clipboard.writeText(token);
const m = document.getElementById('copied-msg');
m.classList.add('show');
setTimeout(() => m.classList.remove('show'), 1200);
}
async function apiCall(method, path, body) {
const res = document.getElementById('result');
res.style.display = 'block';
res.textContent = method + ' ' + path + ' ...';
try {
const opts = { method, headers: { 'Authorization': 'Bearer ' + token, 'Content-Type': 'application/json' } };
if (body) opts.body = JSON.stringify(body);
const resp = await fetch(API_BASE + path, opts);
const txt = await resp.text();
try { res.textContent = JSON.stringify(JSON.parse(txt), null, 2); } catch (_) { res.textContent = txt; }
} catch (e) {
res.textContent = 'Error: ' + e.message;
}
}
function createWallet(curve) { apiCall('POST', '/v1/wallets', { curve: curve }); }
function logout() {
localStorage.removeItem('mpc_token');
localStorage.removeItem('mpc_refresh_token');
location.href = '/';
}
loadUser();
</script>
</body>
</html>`