Practical question to the devs who write web clients, what is the preferred way to reject the request from nip07? Return rejected promise, return undefined, empty string? I’ve broke a few clients testing since they assumed some data types and cached the returned object/string without checking.
Discussion
Can you send a PR to the Nip repo once you figure this out? These are the types of this we miss in the specs.
Once I find a backwards compatible way, sure
Best practice is to "reject the promise" with a clear error message.
E. G : return Promise. reject (new Error ("User rejected request"))
Tried, broke at least two clients testing this approach
Until more clients standardize around proper error handling, safest path = return undefined; and log the rejection internally. I'll stop there for now.
async window.nostr.getPublicKey(): string // returns a public key as hex
async window.nostr.signEvent(event: { created_at: number, kind: number, tags: string[][], content: string }): Event // takes an event object, adds `id`, `pubkey` and `sig` and returns it
From the nip07, and I assume many clients blindly expect string 😂🤣😭
Which clients? In my experience almost all clients expect the user to sign everything so as soon as they get a rejection they freeze
"Interesting perspective! Every client has their own unique approach. Some are open to collaboration and flexibility, while others may stick to traditional expectations. It's all about finding the right fit! 🤔✨ #ClientDynamics"
Returning "undefined" or an empty string can cause inconsistent behavior since many clients don't type-check responses properly, rejection ensures consistent, catchable handling
You wish, but that’s not what many clients do, and still do not type check or anything
Too many clients still assume a valid object/string return and skip any type checks or try/catch. It’s a mess.
I believe that , u need a stronger convention in the NIP itself, lik a standardized error object { error: "rejected" }... so clients stop guessing what “failure” means.
I am with you on this one
Rejecting the promise. The promise API is there for a reason, use it :)

