Add DEBUG mode with red banner and hardcoded mnemonic
All checks were successful
check / check (push) Successful in 12s
All checks were successful
check / check (push) Successful in 12s
When DEBUG=true: a sticky red "DEBUG / INSECURE" banner appears at the top of all views, and the die button returns a hardcoded test mnemonic instead of generating a random one.
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
// AutistMask popup UI — view management and event wiring
|
||||
const { Mnemonic } = require("ethers");
|
||||
|
||||
const DEBUG = true;
|
||||
const DEBUG_MNEMONIC =
|
||||
"cube evolve unfold result inch risk jealous skill hotel bulb night wreck";
|
||||
|
||||
const VIEWS = [
|
||||
"lock",
|
||||
"welcome",
|
||||
@@ -71,6 +75,7 @@ function makeStubAddress() {
|
||||
}
|
||||
|
||||
function generateMnemonic() {
|
||||
if (DEBUG) return DEBUG_MNEMONIC;
|
||||
const wallet = Mnemonic.fromEntropy(
|
||||
globalThis.crypto.getRandomValues(new Uint8Array(16)),
|
||||
);
|
||||
@@ -239,6 +244,14 @@ function backFromWalletAdd() {
|
||||
|
||||
// -- init --
|
||||
function init() {
|
||||
if (DEBUG) {
|
||||
const banner = document.createElement("div");
|
||||
banner.textContent = "DEBUG / INSECURE";
|
||||
banner.style.cssText =
|
||||
"background:#c00;color:#fff;text-align:center;font-size:10px;padding:1px 0;font-family:monospace;position:sticky;top:0;z-index:9999;";
|
||||
document.body.prepend(banner);
|
||||
}
|
||||
|
||||
if (!state.hasWallet) {
|
||||
showView("welcome");
|
||||
} else if (state.locked) {
|
||||
|
||||
Reference in New Issue
Block a user