I offer a 1Msat bounty for extending [nos2x-fox](https://github.com/diegogurpegui/nos2x-fox) to multiple accounts.

* When I pinned the extension, switching between keys can be done in the dropdown. With only this implemented (and the configuration of multiple keys) I offer 0.5Msat.

* nip07 methods accept an additional parameter - the expected pubkey. For example `window.nostr.nip04.encrypt(correspondentPubkey, plaintext, myPubkey)` instead of `window.nostr.nip04.encrypt(pubkey, plaintext)`

#[0]

Reply to this note

Please Login to reply.

Discussion

why would you change the signature of the nip07 calls? that'll mean that each website using it would have to support this off-nip

why not just switch accounts at the extension level and the nip07 is called with the active key?

JS doesn't care if the method would accept more parameters so it should be backwards compatible or in other words, that extra parameter may be undefined in which case it would behave as before.

On the other hand as the client would need to be changed to take advantage of this, a new method could be introduced. It would just clutter the API if you had both `encrypt()` and `encryptWith()`.

Another alternative would be to let the plugin change the account, not the client. Since in Nostr is the plugin that really manages it.

A new API function could be define that allows the client to notify the website that the account changed so the website acts accordingly.

I'm still not decided on which is the best approach.

> why not just switch accounts at the extension level and the nip07 is called with the active key?

The problem is that I want clients to support multiple accounts. In fact I did start implementing such a client but could not keep up with the other emerging clients. Think about how Twitter works. You can add multiple accounts to your app/website and then switch with a click in the app. You would not want to mirror that click with a click in the plugin. So either the client has to tell the plugin with each function the pubkey it wants to act on behalf or - and I guess that's inferior - it has to tell the plugin when to switch accounts. The latter is problematic as I might be working on multiple tabs and the plugin would have to maintain state per tab to not encrypt messages from the wrong user for example.