nips icon indicating copy to clipboard operation
nips copied to clipboard

nip-07 does not work for multiple accounts

Open Giszmo opened this issue 2 years ago • 7 comments

The current API with extension by Alby and nos2x:

async window.nostr.getPublicKey(): string // returns your public key as hex
async window.nostr.signEvent(event): Event // returns the full event object signed
async window.nostr.getRelays(): { [url: string]: RelayPolicy } // returns a map of relays
async window.nostr.nip04.encrypt(pubkey, plaintext): string // returns ciphertext+iv as specified in nip04
async window.nostr.nip04.decrypt(pubkey, ciphertext): string // takes ciphertext+iv as specified in nip04

is not designed to manage multiple keys.

Should it be amended or would that be a new nip?

Giszmo avatar Dec 18 '22 02:12 Giszmo

Perhaps there could be an extension that held multiple keys and prompted the user with which of the multiple keys they want to sign before actually signing, or lets them choose one for each domain in a popup, then be compatible with the same API.

fiatjaf avatar Dec 18 '22 10:12 fiatjaf

I need multiple on the same domain. Many are in the same boat when running secondary accounts for their projects. I would have posted much more as Walletscrutiny already, had it been easy to switch accounts but so far, only Nostroid is supporting multiple accounts but it needs nip-07 next ;)

Giszmo avatar Dec 19 '22 18:12 Giszmo

I still think this doesn't make sense as a standard since it would require client support and probably very few people are going to implement that. It is much better for everyone if there is one NIP-07 extension for power users like you that allows you to choose what key to sign with. That approach may come with its own set of challenges though, but this problem is not trivial anywhere.

fiatjaf avatar Dec 19 '22 19:12 fiatjaf

So I'll make a different nip for that. Fine with me but I'll need it and I think you underestimate how many people want multiple accounts. Basically every company- or project account is controlled by somebody who also has at least one private account.

Giszmo avatar Dec 20 '22 05:12 Giszmo

I want to understand why you think my suggestion is not good and how it doesn't solve the problem.

fiatjaf avatar Dec 20 '22 10:12 fiatjaf

Oh! I misread you! So you suggest to amend nip-07?

I didn't mean to keep tools separate but the nip. So if nos2x has multi-account support it may advertise supporting nip-07 and nip-whatever and same for the clients that make use of it. Amending nips leads to confusion about feature sets but as we are early on and nips are drafts anyway, it might be preferred to just polish nips.

Giszmo avatar Dec 20 '22 16:12 Giszmo

No!

I suggested to make an extension that is compatible with NIP-07 as it is now, but support multiple accounts in it!

fiatjaf avatar Dec 20 '22 18:12 fiatjaf

Closed due to inactivity

staab avatar Mar 23 '23 14:03 staab