NIP-07: let clients pin the user key - #2431
Open
nogringo wants to merge 1 commit into
Open
Conversation
Member
|
The client should just check the result of signEvent and throw an error if the pubkey doesn't match the logged-in user. |
Author
|
A check tells the client that the key is wrong, but not how to make it right. Signers can hold several keys, and today the client has no way to say which one it means, so the only remedy is asking the user to go switch accounts in the signer, even though they already picked an account in the app. It also doesn't cover the encryption functions: NIP-55 already solved this with |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The key behind
window.nostrcan change at any time without the page knowing:the user switches account in the signer, or logs out and logs back in with a
different key. A client that called
getPublicKey()at login has no way torequire that later calls still use that key, so it can keep acting under an
identity the user has left.
This adds an optional
pubkeyon thesignEventevent object, and an optionalcurrent_useron thenip04andnip44functions. When set, the signer MUSTuse that key or reject the request. Signers that ignore them behave as today.