mirror of
https://github.com/nostr-protocol/nips.git
synced 2025-08-23 02:40:47 -04:00
01.md
02.md
03.md
04.md
05.md
06.md
07.md
08.md
09.md
10.md
11.md
12.md
13.md
14.md
15.md
16.md
17.md
18.md
19.md
20.md
21.md
22.md
23.md
24.md
25.md
26.md
27.md
28.md
29.md
30.md
31.md
32.md
33.md
34.md
35.md
36.md
37.md
38.md
39.md
40.md
42.md
44.md
45.md
46.md
47.md
48.md
49.md
50.md
51.md
52.md
53.md
54.md
55.md
56.md
57.md
58.md
59.md
60.md
61.md
62.md
64.md
65.md
66.md
68.md
69.md
70.md
71.md
72.md
73.md
75.md
78.md
7D.md
84.md
86.md
88.md
89.md
90.md
92.md
94.md
96.md
98.md
99.md
BREAKING.md
C0.md
C7.md
README.md
33 lines
1.5 KiB
Markdown
33 lines
1.5 KiB
Markdown
NIP-07
|
|
======
|
|
|
|
`window.nostr` capability for web browsers
|
|
------------------------------------------
|
|
|
|
`draft` `optional`
|
|
|
|
The `window.nostr` object may be made available by web browsers or extensions and websites or web-apps may make use of it after checking its availability.
|
|
|
|
That object must define the following methods:
|
|
|
|
```
|
|
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
|
|
```
|
|
|
|
Aside from these two basic above, the following functions can also be implemented optionally:
|
|
```
|
|
async window.nostr.nip04.encrypt(pubkey, plaintext): string // returns ciphertext and iv as specified in nip-04 (deprecated)
|
|
async window.nostr.nip04.decrypt(pubkey, ciphertext): string // takes ciphertext and iv as specified in nip-04 (deprecated)
|
|
async window.nostr.nip44.encrypt(pubkey, plaintext): string // returns ciphertext as specified in nip-44
|
|
async window.nostr.nip44.decrypt(pubkey, ciphertext): string // takes ciphertext as specified in nip-44
|
|
```
|
|
|
|
### Recommendation to Extension Authors
|
|
To make sure that the `window.nostr` is available to nostr clients on page load, the authors who create Chromium and Firefox extensions should load their scripts by specifying `"run_at": "document_end"` in the extension's manifest.
|
|
|
|
|
|
### Implementation
|
|
|
|
See https://github.com/aljazceru/awesome-nostr#nip-07-browser-extensions.
|