diff options
| author | fiatjaf <fiatjaf@gmail.com> | 2023-07-03 13:17:57 -0300 |
|---|---|---|
| committer | fiatjaf <fiatjaf@gmail.com> | 2023-07-03 13:18:19 -0300 |
| commit | e057fa01ca3928a32bdc0e9a44c27f946f267041 (patch) | |
| tree | 3e485db8a47773d9e4f4b93af5c94e3f067d62eb /37.md | |
| parent | e0fc913719aae2ed1b10884e80f085218738f65d (diff) | |
add nip-37: general methods for dealing with lost keys.key-invalidation-and-migration
Diffstat (limited to '37.md')
| -rw-r--r-- | 37.md | 95 |
1 files changed, 95 insertions, 0 deletions
| @@ -0,0 +1,95 @@ | |||
| 1 | NIP-37 | ||
| 2 | ====== | ||
| 3 | |||
| 4 | Methods for dealing with lost or compromised keys | ||
| 5 | ------------------------------------------------- | ||
| 6 | |||
| 7 | `draft` `optional` `author:fiatjaf` | ||
| 8 | |||
| 9 | This NIP defines a series of methods that can be used to make catastrophic key loss events less horrible. | ||
| 10 | |||
| 11 | The intention here is not to claim that there is a generalized "key rotation" scheme on Nostr, but still make it | ||
| 12 | so that in most cases people are able to move to new keys and not lost 100% of their followers and reputation | ||
| 13 | when that happens, and also that it is possible to prevent most of the reputational damage that could be | ||
| 14 | caused by having an evil hacker take control of someone else's keys. | ||
| 15 | |||
| 16 | The implementation of this NIP could be done directly in social clients or in dedicated clients that users would | ||
| 17 | visit from time to time in order to have an automated scan be done on their contacts and then the dedicated app | ||
| 18 | could suggest migrating from old keys to new keys, or suggest stop following compromised keys, or even perform | ||
| 19 | these migrations automatically. | ||
| 20 | |||
| 21 | ### Method A: Simple Key Deletion | ||
| 22 | |||
| 23 | Based on https://github.com/nostr-protocol/nips/pull/377, the idea is that someone, after noticing that their key | ||
| 24 | has been compromised and deciding that it is not possible to use any of the other methods here described, can | ||
| 25 | proceed 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 | |||
| 42 | Upon receiving this, relays implementing this NIP SHOULD somehow mark it as invalid and refuse to store any more | ||
| 43 | events from this key. Relays MAY also decide to also delete all events from this key. | ||
| 44 | |||
| 45 | Upon receiving this, clients implementing this NIP SHOULD stop following the key. | ||
| 46 | |||
| 47 | Clients may give users the option to "delete your public key" with this type of event. Clients SHOULD display a | ||
| 48 | prominent message explaining that the action is not reversible, SHOULD explain that this does not guarantee their | ||
| 49 | posts 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 | |||
| 53 | The idea here is that users could pick some friends from their contact list and a threshold number to signal to | ||
| 54 | the rest that the old key has been lost and what is the new key -- e.g. Alice can determine that, from Bob, Carol | ||
| 55 | and Derek, if any 2 of these 3 agree, their recommendation is authoritative. | ||
| 56 | |||
| 57 | This 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 | |||
| 74 | And 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 | |||
| 90 | Very importantly, when evaluating events of kind `1521` for a given `p`, clients should ensure that their corresponding | ||
| 91 | event `10520` is at least 3 months older **and that an OpenTimestamps proof exists for that**. | ||
| 92 | |||
| 93 | ### Method C: Hierarchically Pregenerated Keys | ||
| 94 | |||
| 95 | I'll write this later, just a placeholder. It's probably better to see if methods A and B work first. | ||