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.

Reply to this note

Please Login to reply.

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.