upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/37.md
diff options
context:
space:
mode:
Diffstat (limited to '37.md')
-rw-r--r--37.md95
1 files changed, 95 insertions, 0 deletions
diff --git a/37.md b/37.md
new file mode 100644
index 0000000..7914e90
--- /dev/null
+++ b/37.md
@@ -0,0 +1,95 @@
1NIP-37
2======
3
4Methods for dealing with lost or compromised keys
5-------------------------------------------------
6
7`draft` `optional` `author:fiatjaf`
8
9This NIP defines a series of methods that can be used to make catastrophic key loss events less horrible.
10
11The intention here is not to claim that there is a generalized "key rotation" scheme on Nostr, but still make it
12so that in most cases people are able to move to new keys and not lost 100% of their followers and reputation
13when that happens, and also that it is possible to prevent most of the reputational damage that could be
14caused by having an evil hacker take control of someone else's keys.
15
16The implementation of this NIP could be done directly in social clients or in dedicated clients that users would
17visit from time to time in order to have an automated scan be done on their contacts and then the dedicated app
18could suggest migrating from old keys to new keys, or suggest stop following compromised keys, or even perform
19these migrations automatically.
20
21### Method A: Simple Key Deletion
22
23Based on https://github.com/nostr-protocol/nips/pull/377, the idea is that someone, after noticing that their key
24has been compromised and deciding that it is not possible to use any of the other methods here described, can
25proceed to publish the following event:
26
27```js
28{
29 "kind": 10529,
30 "pubkey": "<compromised-pubkey>",
31 "tags": [
32 ["reason", "I typed my key on anigma"]
33
34 // this is unnecessary, but it's an extra requirement to prevent people from making a 10529 event by chance
35 ["key-compromised"],
36 ],
37 "content": "",
38 // ...
39}
40```
41
42Upon receiving this, relays implementing this NIP SHOULD somehow mark it as invalid and refuse to store any more
43events from this key. Relays MAY also decide to also delete all events from this key.
44
45Upon receiving this, clients implementing this NIP SHOULD stop following the key.
46
47Clients may give users the option to "delete your public key" with this type of event. Clients SHOULD display a
48prominent message explaining that the action is not reversible, SHOULD explain that this does not guarantee their
49posts are deleted forever, and SHOULD require special confirmation such as requiring the user to type a message.
50
51### Method B: Social Key Migration
52
53The idea here is that users could pick some friends from their contact list and a threshold number to signal to
54the rest that the old key has been lost and what is the new key -- e.g. Alice can determine that, from Bob, Carol
55and Derek, if any 2 of these 3 agree, their recommendation is authoritative.
56
57This is done by publishing an event like this (for example):
58
59```js
60{
61 "kind": 10520,
62 "pubkey": "<user-pubkey-that-will-be-compromised>",
63 "tags": [
64 ["p", "<friend1-pubkey>"],
65 ["p", "<friend2-pubkey>"],
66 ["p", "<friend3-pubkey>"],
67 ["threshold", "2"]
68 ],
69 "content": "",
70 // ...
71}
72```
73
74And then, when the friends want to recommend the switch to a new pubkey, they can publish events like
75
76```js
77{
78 "kind": 1521,
79 "pubkey": "<friend1-pubkey>",
80 "tags": [
81 ["p", "<compromised-pubkey>"],
82 ["e", "<event-of-kind-10520-that-this-refers-to>"],
83 ["new-key", "<new-key>"]
84 ],
85 "content": "",
86 // ...
87}
88```
89
90Very importantly, when evaluating events of kind `1521` for a given `p`, clients should ensure that their corresponding
91event `10520` is at least 3 months older **and that an OpenTimestamps proof exists for that**.
92
93### Method C: Hierarchically Pregenerated Keys
94
95I'll write this later, just a placeholder. It's probably better to see if methods A and B work first.