mirror of
https://github.com/nostr-protocol/nips.git
synced 2024-12-22 16:35:52 -05:00
Add user experience recommendation about NIP-07
Invoking NIP-07 methods as a part of page-load event listener creates intermittent issues due to race conditions between the browser's extension script and the client's page scripts.
This commit is contained in:
parent
4208652dc7
commit
b8f2e14e6d
5
07.md
5
07.md
|
@ -22,6 +22,11 @@ async window.nostr.nip04.encrypt(pubkey, plaintext): string // returns ciphertex
|
||||||
async window.nostr.nip04.decrypt(pubkey, ciphertext): string // takes ciphertext and iv as specified in nip-04
|
async window.nostr.nip04.decrypt(pubkey, ciphertext): string // takes ciphertext and iv as specified in nip-04
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### User experience recommendation
|
||||||
|
Due to the way browsers load the extensions, it may take some time for `window.nostr` object will be fully ready to accept requests. Hence, it is a good idea to run the first `window.nostr` interaction on a user action on the web page (like a button click), and not during the page load.
|
||||||
|
|
||||||
|
Calling the `window.nostr` based methods during the page load runs the risk of intermittent issues due to race conditions between the client page's script and the extension's script
|
||||||
|
|
||||||
### Implementation
|
### Implementation
|
||||||
|
|
||||||
- [horse](https://github.com/fiatjaf/horse) (Chrome and derivatives)
|
- [horse](https://github.com/fiatjaf/horse) (Chrome and derivatives)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user