feat(example): add MPC generation test interface

This commit is contained in:
2026-01-10 14:54:39 -05:00
parent 634e62dc81
commit e7202256c3
2 changed files with 32 additions and 0 deletions

View File

@@ -407,6 +407,14 @@
</div>
<div id="log-load" class="log"></div>
</div>
<div class="card" style="border-color: var(--warning);">
<h3>test_mpc() <span class="badge" style="background: var(--warning); color: #000;">debug</span></h3>
<div class="btn-row">
<button class="btn" style="background: var(--warning); color: #000;" onclick="testMPC()">Test MPC Generation</button>
</div>
<div id="log-mpc" class="log"></div>
</div>
</section>
<section id="section-explorer" class="tab-content">

View File

@@ -147,6 +147,30 @@ window.testPing = async function() {
}
};
window.testMPC = async function() {
if (!enclave) return log('mpc', 'err', 'Plugin not loaded');
log('mpc', 'info', 'Testing MPC key generation...');
try {
const result = await enclave.plugin.call('test_mpc', '{}');
if (!result) {
log('mpc', 'err', 'No response from plugin');
return;
}
const output = result.json();
if (output.result?.startsWith('SUCCESS')) {
log('mpc', 'ok', output.result);
} else if (output.result?.startsWith('PANIC')) {
log('mpc', 'err', output.result);
} else {
log('mpc', 'err', output.result || 'Unknown error');
}
} catch (err) {
log('mpc', 'err', `Exception: ${err?.message || JSON.stringify(err)}`);
}
};
window.testGenerate = async function() {
if (!enclave) return log('generate', 'err', 'Plugin not loaded');