This commit is contained in:
2026-06-14 03:52:08 -04:00
parent e105d191c3
commit a44ab4b760
3 changed files with 148 additions and 53 deletions

View File

@@ -6,33 +6,31 @@
* Knows nothing about crypto — that lives entirely in g1wallet.js.
*/
// ----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// ACCESS WALL
// ----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
function g1wallet_render_access_wall() {
$directory_url = g1wallet_h(z_root() . '/channel/theron');
return '
<div class="g1wallet-content">
<div class="alert alert-info" role="alert">
<strong>SASE verification required to access the Ğ1 Wallet.</strong>
This wallet is available to verified HOA participants only.
To participate, you must complete the SASE process.
Visit <a href="https://directory.diagnostics.kane-il.us/channel/theron">
directory.diagnostics.kane-il.us
</a> to begin.
Visit <a href="' . $directory_url . '">' . g1wallet_h(App::get_hostname()) . '</a> to begin.
</div>
</div>
';
}
// ----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// WALLET LANDING
// ----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
function g1wallet_render_landing($access) {
// Wallet landing: shows unlock form or unlocked interface depending on JS session state.
// At skeleton stage, always shows the unlock form.
// Once g1wallet.js is wired, the JS will swap to the unlocked view on successful derivation.
// JS swaps to the unlocked view on successful derivation.
$out = '<div class="g1wallet-content">';
$out .= '<div class="g1wallet-header mb-3">';
@@ -63,18 +61,21 @@ function g1wallet_render_landing($access) {
return $out;
}
// ----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// UNLOCK FORM
// ----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
function g1wallet_render_unlock_form() {
// Renders the wallet unlock form.
// The form is handled entirely by g1wallet.js — it does NOT POST to the server.
// The mnemonic never leaves the browser.
//
// Per Duniter HD Wallet RFC 0015 (Dubp_HD_Wallet), the wallet's keypair is
// derived from a 12-word BIP39 mnemonic (English wordlist), using its
// entropy as input to a BIP32-Ed25519 derivation — not a raw PBKDF2 seed.
// Derivation (Duniter v2 / Substrate / Ğecko standard):
// 12-word BIP39 mnemonic
// → mnemonicToEntropy() → 16 bytes of raw entropy
// → use entropy directly as 32-byte Ed25519 seed (zero-padded right)
// → derive Ed25519 keypair (SubtleCrypto, non-extractable private key)
// → SS58-encode public key with Ğ1 network prefix → g1... address
$out = '<div class="g1wallet-unlock-form">';
$out .= '<h4>Unlock Your Wallet</h4>';
@@ -99,13 +100,13 @@ function g1wallet_render_unlock_form() {
return $out;
}
// ----------------------------------------------------------------------------
// UNLOCKED INTERFACE (PLACEHOLDER)
// ----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// UNLOCKED INTERFACE
// -----------------------------------------------------------------------------
function g1wallet_render_unlocked_placeholder($access) {
// Placeholder for the unlocked wallet interface.
// Populated by g1wallet.js once key derivation is implemented.
// Unlocked wallet interface.
// Populated by g1wallet.js after key derivation.
$out = '<div class="g1wallet-unlocked">';
$out .= '<div class="alert alert-success d-flex justify-content-between align-items-center">';
@@ -114,7 +115,7 @@ function g1wallet_render_unlocked_placeholder($access) {
$out .= '</div>';
$out .= '<div class="mb-3">';
$out .= '<h5 class="g1wallet-section-label">Public Key</h5>';
$out .= '<h5 class="g1wallet-section-label">Public Key (Ğ1 Address)</h5>';
$out .= '<p id="g1wallet-pubkey-display" class="font-monospace text-muted small">—</p>';
$out .= '</div>';
@@ -141,9 +142,9 @@ function g1wallet_render_unlocked_placeholder($access) {
return $out;
}
// ----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// ERROR
// ----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
function g1wallet_render_error($message) {
// Shows a plain-language error. Never shows a blank page or stack trace.