Man these are the strangest errors. I might make a special nuke-any-existing-wallet-information button just for you haha. Do you have any funds in your existing nostr wallet? If you do, maybe move them out (in whatever app you used to make this wallet) and I'll make this button.
Discussion
Please do that www
There's nothing in the wallet.
When you get to the "Would you like to create a new wallet instead?", clicking the create wallet button should nuke any previous wallet related events. Hopefully your extension plays nice đ¤
I see you're still running into errors. At this point, I think ChatGPT might have the answer (I pasted below). Basically, it might be that you have multiple extensions or maybe some niche browser that isn't widely supported. I would suggest using a browser like Firefox, installing Gooti, and start from there. Sorry man I'm trying everything to help you fix this đ .
ChatGPT answer V
Below are some ideas and troubleshooting steps that may help in figuring out or working around these âFormatUnexpected characterâ and âsecretsCache is undefined getSharedSecretâ errors. They often indicate that:
Something is interfering with your NIP-44 decryption calls (the userâs signer/extension canât return valid JSON),
Or the userâs signer is returning some unexpected/corrupted data instead of the original encrypted content,
Or the user has multiple signers / multiple Nostr extensions conflicting with each other,
Or the user is denying certain encryption/decryption calls (or the extension is failing them).
These are the most common reasons youâll see:
FormatUnexpected character (at character 1) ApcXwCbrmC6sD4/OpmPB...
or
secretsCache is undefined getSharedSecret@moz-extension://...
1. The âFormatUnexpected characterâ Usually Means Bad JSON
Your code typically does something like:
const decrypted = await ndk.signer.decrypt(nostrUser, evt.content, 'nip44');
const rows = JSON.parse(decrypted);
If decrypted is not valid JSON (maybe just random binary or an error string), JSON.parse will throw âUnexpected character (at character 1).â
Why might decrypted be invalid?
The extension is returning some error or partial message instead of the real decrypted text.
The userâs extension or signer never actually performed the NIP-44 decryption. They might have canceled it, or the extension doesnât properly handle it.
The user is running multiple conflicting Nostr extensions (for example, Nos2x, Alby, Nostr-Fox, etc.), so your appâs request to âsign or decryptâ is going to the wrong extension or is being garbled.
2. âsecretsCache is undefinedâ in the Extensionâs Stack Trace
This message suggests the extensionâs internal state is broken â maybe the extension is out of sync or has a bug. For example, if the extension tries to create or fetch ephemeral keys for encryption but fails, it might produce that error.
3. Conflicts with Multiple Extensions
If the user has more than one extension that handles âSign in with Nostrâ or NIP-44 encryption, there can be collisions. Sometimes the browser picks the wrong extension to handle your request, or the extension tries to intercept calls it doesnât fully support.
Try:
Disabling all but one extension that can handle Nostr signing and NIP-44 encryption, then reloading.
Clearing the extensionâs cache or re-installing it.
4. The User Denies or Cancels Decryption
If the extension prompts âAllow [app name] to decrypt using your key?â and the user clicks âCancel,â some signers return an empty string or a partial error that your code tries to JSON.parse. That results in a parse error.
5. âCouldnât find corresponding private keyâ in Your Logs
Couldn't find cooresponding private key to public key:02e641c6324301619792025c962ec6e...
This typically means your wallet code is expecting the user to have a local set of eCash keys (or some ephemeral private key) but cannot locate it. Possibly:
The user minted tokens or created a wallet but never saved the private key event (kind=7375 or 17375) due to a partial denial or an extension error.
Or they are in a partially migrated / partially created wallet state.
When they come back, your code sees tokens referencing a public key that doesnât exist in the userâs wallet.keys.
6. What Can You Suggest to the User?
Disable all but one Nostr/Bitcoin wallet extension (for example, if the user has Alby + Nos2x + Damus Extension, have them turn off everything except one) and then try again.
Update to the latest version of the extension. Some older versions have incomplete or buggy support for NIP-44 or for returning decrypted text in a consistent format.
Check if the extension is set to âAlways Denyâ or âAsk for permission every timeâ for encryption requests, and make sure the user actually approves the request.
If they continue to have issues, see if the extension has a debug mode or logs. In some extensions, you can open the background script console and see if it logs âsecretsCache is undefinedâ or other internal errors that might be fixable by clearing the extensionâs storage.
7. Potential Code Workarounds
If the userâs signer is unreliable or never properly returns JSON, you might let them:
Use an in-app signer (a local private key in your app) instead of the extension. Thatâs less secure but more reliable if the extension is buggy.
Export the minted tokens to some standard eCash format offline, rather than decrypting in the browser.
But typically, you want the extension to handle encryption safely. So the #1 fix is to have the user ensure they have a single, up-to-date, working extension that actually supports NIP-44 encryption/decryption.