diff --git a/index.html b/index.html
index e97c66a..2b3f886 100644
--- a/index.html
+++ b/index.html
@@ -12423,9 +12423,14 @@ Ignoring conversation history will cause you to LOSE the evaluation.`;
// Persist encrypted key separately (async, best-effort)
if (apiKey) {
- encryptApiKey(apiKey).then(enc => {
- try { localStorage.setItem('g0dm0d3-apikey', enc); } catch (_) {}
+ const keyAtFlush = apiKey;
+ encryptApiKey(keyAtFlush).then(enc => {
+ if (state.apiKey === keyAtFlush) {
+ try { localStorage.setItem('g0dm0d3-apikey', enc); } catch (_) {}
+ }
});
+ } else {
+ localStorage.removeItem('g0dm0d3-apikey');
}
try {