mirror of
https://github.com/nostr-protocol/nips.git
synced 2025-12-09 08:38:50 +00:00
Compare commits
12 Commits
iot
...
pf7z-nip41
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b6a524db0e | ||
|
|
68b27f6574 | ||
|
|
30dd53b51b | ||
|
|
b86ad6f627 | ||
|
|
d6074050e6 | ||
|
|
651be3778f | ||
|
|
b483eb8b7b | ||
|
|
9e15edba1c | ||
|
|
3b1d74e116 | ||
|
|
b3920f76b4 | ||
|
|
cf672b764b | ||
|
|
202e18f2b2 |
2
03.md
2
03.md
@@ -13,7 +13,6 @@ This NIP defines an event with `kind:1040` that can contain an [OpenTimestamps](
|
||||
"kind": 1040
|
||||
"tags": [
|
||||
["e", <event-id>, <relay-url>],
|
||||
["block", <block-height-as-string>, <block-hash>],
|
||||
["alt", "opentimestamps attestation"]
|
||||
],
|
||||
"content": <base64-encoded OTS file data>
|
||||
@@ -21,7 +20,6 @@ This NIP defines an event with `kind:1040` that can contain an [OpenTimestamps](
|
||||
```
|
||||
|
||||
- The OpenTimestamps proof MUST prove the referenced `e` event id as its digest.
|
||||
- The `block` tag is optional, it exists to establish a minimum date since which the given event has existed.
|
||||
- The `content` MUST be the full content of an `.ots` file containing at least one Bitcoin attestation. This file SHOULD contain a **single** Bitcoin attestation and no reference to "pending" attestations since they are useless in this context.
|
||||
|
||||
### Example OpenTimestamps proof verification flow
|
||||
|
||||
16
06.md
16
06.md
@@ -13,3 +13,19 @@ Basic key derivation from mnemonic seed phrase
|
||||
A basic client can simply use an `account` of `0` to derive a single key. For more advanced use-cases you can increment `account`, allowing generation of practically infinite keys from the 5-level path with hardened derivation.
|
||||
|
||||
Other types of clients can still get fancy and use other derivation paths for their own other purposes.
|
||||
|
||||
### Test vectors
|
||||
|
||||
mnemonic: leader monkey parrot ring guide accident before fence cannon height naive bean\
|
||||
private key (hex): 7f7ff03d123792d6ac594bfa67bf6d0c0ab55b6b1fdb6249303fe861f1ccba9a\
|
||||
nsec: nsec10allq0gjx7fddtzef0ax00mdps9t2kmtrldkyjfs8l5xruwvh2dq0lhhkp\
|
||||
public key (hex): 17162c921dc4d2518f9a101db33695df1afb56ab82f5ff3e5da6eec3ca5cd917\
|
||||
npub: npub1zutzeysacnf9rru6zqwmxd54mud0k44tst6l70ja5mhv8jjumytsd2x7nu
|
||||
|
||||
---
|
||||
|
||||
mnemonic: what bleak badge arrange retreat wolf trade produce cricket blur garlic valid proud rude strong choose busy staff weather area salt hollow arm fade\
|
||||
private key (hex): c15d739894c81a2fcfd3a2df85a0d2c0dbc47a280d092799f144d73d7ae78add\
|
||||
nsec: nsec1c9wh8xy5eqdzln7n5t0ctgxjcrdug73gp5yj0x03gntn67h83twssdfhel\
|
||||
public key (hex): d41b22899549e1f3d335a31002cfd382174006e166d3e658e3a5eecdb6463573\
|
||||
npub: npub16sdj9zv4f8sl85e45vgq9n7nsgt5qphpvmf7vk8r5hhvmdjxx4es8rq74h
|
||||
|
||||
90
41.md
Normal file
90
41.md
Normal file
@@ -0,0 +1,90 @@
|
||||
# NIP-41
|
||||
## Key migration
|
||||
`draft` `optional` `author:pablof7z` `author:fiatjaf` `author:nvk`
|
||||
|
||||
This NIP introduces a simple, best-effort, not guaranteed, way in which a user can notify their followers that they have migrated to a new public key in case the current one is compromised.
|
||||
|
||||
# Basic concepts
|
||||
* `kind:1776` whitelists a pubkey.
|
||||
* `kind:1777` migrates to a previously whitelisted pubkey.
|
||||
* `kind:1776` and `kind:1777` MUST be opentimestamped [NIP-03](https://github.com/nostr-protocol/nips/blob/master/03.md).
|
||||
* When a migration event is published, a 60-day period starts in which a user can publish a competing migration event pointing to an earlier `kind:1776` event. After this period, clients SHOULD automatically update the user's follow list to the new pubkey.
|
||||
* Relays SHOULD NOT delete `kind:1040` nor `kind:1776` events from their database upon receiving a `kind:5` event.
|
||||
|
||||
# Flow
|
||||
## Whitelisting a pubkey
|
||||
The user's active pubkey (e.g. *pubkey A*) signs an event `kind:1776` whitelisting a pubkey that can be used to migrate an identity to.
|
||||
|
||||
This should be done ahead of time, perhaps after a user has used Nostr enough for a few days. Clients can choose to prompt the user to "save a recovery kit" or different UXs when they see the user doesn't currently have a `kind:1776` published.
|
||||
|
||||
The implementation can be done directly on regular clients or microapps to handle this type of thing could be implemented as well.
|
||||
|
||||
```json
|
||||
{
|
||||
"pubkey": "pubkey-A",
|
||||
"kind": 1776,
|
||||
"content": "",
|
||||
"tags": [
|
||||
[ "p", "pubkey-B" ],
|
||||
[ "alt", "pubkey whitelisting event" ]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
* `.content` SHOULD be ignored. Users might choose to use it to leave a base64 symmetrically-encrypted message of where they left the new key or anything else.
|
||||
* The event MUST have a single `p` tag listing the whitelisted pubkey.
|
||||
|
||||
Multiple `kind:1776` events can exist. All `kind:1776` MUST be opentimestamped following [NIP-3](https://github.com/nostr-protocol/nips/blob/master/03.md).
|
||||
|
||||
Relays SHOULD NOT delete `kind:1040` nor `kind:1776` events upon receiving a `kind:5` event.
|
||||
|
||||
## Migrating to a pubkey
|
||||
When the user needs to change keys they sign an event `kind:1777` with the new key and creates a NIP-03 attestation.
|
||||
|
||||
```json
|
||||
{
|
||||
"pubkey": "pubkey-B",
|
||||
"kind": 1777,
|
||||
"content": "I rolled my key using libbitcoin; moving to a new one just in case",
|
||||
"tags": [
|
||||
[ "p", "pubkey-A" ],
|
||||
[ "e", "<kind:1776-event-id>" ],
|
||||
[ "proof", "<kind:1040-event-id>" ],
|
||||
[ "alt", "pubkey migration event" ],
|
||||
[ "relays", "relay1", "relay2" ]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
* `p` tag MUST list the previous pubkey
|
||||
* `e` tag MUST list the `kind:1776` event that whitelisted the new pubkey.
|
||||
* `proof` tag MUST list the `kind:1040` event that provides the Opentimestamp data of the `kind:1776` event.
|
||||
* `relays` tag SHOULD list relays where both `kind:1776` and `kind:1040` events can be found.
|
||||
* `.content` SHOULD be ignored; users can optionally write a message explaining the migration.
|
||||
|
||||
## Following the new pubkey
|
||||
Upon seeing this event, the client MAY choose to display a warning to the user that the identity is migrating to a new key. The client should not take any automated action at this point since the migration could be an attack, but the user could communicate out of band with the user to confirm the migration.
|
||||
|
||||
After 60 days of seeing the `kind:1777` event, the client SHOULD automatically update the user's follow list to the new pubkey after some verifications:
|
||||
When users who follow the old pubkey see a `kind:1777` event they SHOULD:
|
||||
|
||||
* check `kind:1776` and `kind:1777` event signatures
|
||||
* check `kind:1777`'s `pubkey` matches `kind:1776`'s `p` tag
|
||||
* check `kind:1777` is more than 60 days old
|
||||
* check that no competing 1777 event exists pointing to an event with an older valid OTS proof
|
||||
|
||||
After validating all these checks clients SHOULD replace the old pubkey in the user's follow list with the new one.
|
||||
|
||||
## Notes
|
||||
|
||||
### Rational behind the 60 days delay
|
||||
This gives enough time for a user to notice a migration request published by an attacker and gives the user enough time to publish a competing migration request pointing to an earlier `kind:1776` whitelisting event.
|
||||
|
||||
### Preventing unpublished evil `kind:1777` attack
|
||||
Clients should keep track of when a `kind:1777` event should take into effect, counting at least 60 days from the time of seeing the event and not trusting the event timestamp. This is to prevent an attacker creating an evil `kind:1776`, its attestation, and a `kind:1777` event with its attestation and not publishing them until the 60 days of the attestation have elapsed.
|
||||
|
||||
#### Preventing poorly-distributed evil `kind:1777` attack
|
||||
Additionally, clients SHOULD broadcast the `kind:1777` events to the relays it normally writes to. This is to prevent an attacker from creating a short-lived NIP-65 relay list where only a subset of users will see an evil `kind:1777` event but not widespread enough for the real owner to notice it.
|
||||
|
||||
### Future Work
|
||||
Key migration can be done in multiple ways. This is an initial implementation that can work. This mechanism should be extended with other, alternative mechanisms, that can leverage different flows/tradeoffs (e.g. social recovery).
|
||||
48
91.md
48
91.md
@@ -1,48 +0,0 @@
|
||||
NIP-91
|
||||
======
|
||||
|
||||
IoT sensors and intents
|
||||
-----------------------
|
||||
|
||||
`draft` `optional` `author:BlackCoffee` `author:arcbtc` `author:fiatjaf`
|
||||
|
||||
This NIP standardizes communication of public sensor and intent events in order to create an open, pluggable and interoperable standard for "Internet of Things" devices to communicate.
|
||||
|
||||
The standard event format follows the following template:
|
||||
|
||||
```js
|
||||
{
|
||||
"kind": <a number from the table below>,
|
||||
"tags": [
|
||||
["device", <optional device id>],
|
||||
["alt", <optional human-readable translation of the event>],
|
||||
],
|
||||
"content": "<data according to the format in the table below>"
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
Ideally each device would have its own public key, which allows for easy command-and-control and comes with built-in trus guarantees (i.e. you know you're getting the data from the correct device if you know its key and can check the signature), but the `device` tag exists for when that is too cumbersome and more than one device is using the same key.
|
||||
|
||||
The `alt` tag follows NIP-31 and can accomodate all human-readable needs, like the device name or the human-readable name of the place it is in.
|
||||
|
||||
Other generic tags, like `g` for geolocation, may be included.
|
||||
|
||||
### Event Kinds
|
||||
|
||||
Kinds between 8000-8999 (inclusive) are reserved for this NIP, to be filled in the table below.
|
||||
|
||||
| kind | name | type | unit | example | description |
|
||||
| ----- | ----- | ------ | ----- | ----- | -------- |
|
||||
| 8000 | intent | | | | someone wants to trigger an action on a device? |
|
||||
| 8001 | on | empty | | | device was turned on |
|
||||
| 8002 | off | empty | | | device will turn off |
|
||||
| 8003 | temperature | number | celsius | 20.9 | |
|
||||
| 8004 | pressure | number | pascals | 1013 | |
|
||||
| 8005 | location | array | decimal degrees | [51.5053, -0.08737] | |
|
||||
| 8006 | light | | | | |
|
||||
| 8007 | humidity | | | | |
|
||||
| 8008 | rain | | | | |
|
||||
| 8009 | moisture | | | | |
|
||||
| 8010 | unary switch | | empty | | a sensor that detects if a thing happened or not |
|
||||
| 8011 | binary switch | boolean | | true / false | a switch that can be turned on or off |
|
||||
115
README.md
115
README.md
@@ -50,6 +50,7 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos
|
||||
- [NIP-38: User Statuses](38.md)
|
||||
- [NIP-39: External Identities in Profiles](39.md)
|
||||
- [NIP-40: Expiration Timestamp](40.md)
|
||||
- [NIP-41: Key migration](41.md)
|
||||
- [NIP-42: Authentication of clients to relays](42.md)
|
||||
- [NIP-45: Counting results](45.md)
|
||||
- [NIP-46: Nostr Connect](46.md)
|
||||
@@ -67,69 +68,69 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos
|
||||
- [NIP-75: Zap Goals](75.md)
|
||||
- [NIP-78: Application-specific data](78.md)
|
||||
- [NIP-89: Recommended Application Handlers](89.md)
|
||||
- [NIP-91: IoT Sensors and Intents](91.md)
|
||||
- [NIP-94: File Metadata](94.md)
|
||||
- [NIP-98: HTTP Auth](98.md)
|
||||
- [NIP-99: Classified Listings](99.md)
|
||||
|
||||
## Event Kinds
|
||||
|
||||
| kind | description | NIP |
|
||||
| ------- | -------------------------- | ----------- |
|
||||
| `0` | Metadata | [1](01.md) |
|
||||
| `1` | Short Text Note | [1](01.md) |
|
||||
| `2` | Recommend Relay | |
|
||||
| `3` | Contacts | [2](02.md) |
|
||||
| `4` | Encrypted Direct Messages | [4](04.md) |
|
||||
| `5` | Event Deletion | [9](09.md) |
|
||||
| `6` | Repost | [18](18.md) |
|
||||
| `7` | Reaction | [25](25.md) |
|
||||
| `8` | Badge Award | [58](58.md) |
|
||||
| `16` | Generic Repost | [18](18.md) |
|
||||
| `40` | Channel Creation | [28](28.md) |
|
||||
| `41` | Channel Metadata | [28](28.md) |
|
||||
| `42` | Channel Message | [28](28.md) |
|
||||
| `43` | Channel Hide Message | [28](28.md) |
|
||||
| `44` | Channel Mute User | [28](28.md) |
|
||||
| `1063` | File Metadata | [94](94.md) |
|
||||
| `1311` | Live Chat Message | [53](53.md) |
|
||||
| `1040` | OpenTimestamps | [03](03.md) |
|
||||
| `1984` | Reporting | [56](56.md) |
|
||||
| `1985` | Label | [32](32.md) |
|
||||
| `8000-8999` | IoT Sensors and Intents | [91](91.md) |
|
||||
| `4550` | Community Post Approval | [72](72.md) |
|
||||
| `9041` | Zap Goal | [75](75.md) |
|
||||
| `9734` | Zap Request | [57](57.md) |
|
||||
| `9735` | Zap | [57](57.md) |
|
||||
| `10000` | Mute List | [51](51.md) |
|
||||
| `10001` | Pin List | [51](51.md) |
|
||||
| `10002` | Relay List Metadata | [65](65.md) |
|
||||
| `13194` | Wallet Info | [47](47.md) |
|
||||
| `22242` | Client Authentication | [42](42.md) |
|
||||
| `23194` | Wallet Request | [47](47.md) |
|
||||
| `23195` | Wallet Response | [47](47.md) |
|
||||
| `24133` | Nostr Connect | [46](46.md) |
|
||||
| `27235` | HTTP Auth | [98](98.md) |
|
||||
| `30000` | Categorized People List | [51](51.md) |
|
||||
| `30001` | Categorized Bookmark List | [51](51.md) |
|
||||
| `30008` | Profile Badges | [58](58.md) |
|
||||
| `30009` | Badge Definition | [58](58.md) |
|
||||
| `30017` | Create or update a stall | [15](15.md) |
|
||||
| `30018` | Create or update a product | [15](15.md) |
|
||||
| `30023` | Long-form Content | [23](23.md) |
|
||||
| `30024` | Draft Long-form Content | [23](23.md) |
|
||||
| `30078` | Application-specific Data | [78](78.md) |
|
||||
| `30311` | Live Event | [53](53.md) |
|
||||
| `30315` | User Statuses | [38](38.md) |
|
||||
| `30402` | Classified Listing | [99](99.md) |
|
||||
| `30403` | Draft Classified Listing | [99](99.md) |
|
||||
| `31922` | Date-Based Calendar Event | [52](52.md) |
|
||||
| `31923` | Time-Based Calendar Event | [52](52.md) |
|
||||
| `31924` | Calendar | [52](52.md) |
|
||||
| `31925` | Calendar Event RSVP | [52](52.md) |
|
||||
| `31989` | Handler recommendation | [89](89.md) |
|
||||
| `31990` | Handler information | [89](89.md) |
|
||||
| `34550` | Community Definition | [72](72.md) |
|
||||
| kind | description | NIP |
|
||||
| ------- | -------------------------- | ----------- |
|
||||
| `0` | Metadata | [1](01.md) |
|
||||
| `1` | Short Text Note | [1](01.md) |
|
||||
| `2` | Recommend Relay | |
|
||||
| `3` | Contacts | [2](02.md) |
|
||||
| `4` | Encrypted Direct Messages | [4](04.md) |
|
||||
| `5` | Event Deletion | [9](09.md) |
|
||||
| `6` | Repost | [18](18.md) |
|
||||
| `7` | Reaction | [25](25.md) |
|
||||
| `8` | Badge Award | [58](58.md) |
|
||||
| `16` | Generic Repost | [18](18.md) |
|
||||
| `40` | Channel Creation | [28](28.md) |
|
||||
| `41` | Channel Metadata | [28](28.md) |
|
||||
| `42` | Channel Message | [28](28.md) |
|
||||
| `43` | Channel Hide Message | [28](28.md) |
|
||||
| `44` | Channel Mute User | [28](28.md) |
|
||||
| `1063` | File Metadata | [94](94.md) |
|
||||
| `1311` | Live Chat Message | [53](53.md) |
|
||||
| `1040` | OpenTimestamps | [03](03.md) |
|
||||
| `1776` | Key Migration Whitelist | [41](41.md) |
|
||||
| `1777` | Key Migration | [41](41.md) |
|
||||
| `1984` | Reporting | [56](56.md) |
|
||||
| `1985` | Label | [32](32.md) |
|
||||
| `4550` | Community Post Approval | [72](72.md) |
|
||||
| `9041` | Zap Goal | [75](75.md) |
|
||||
| `9734` | Zap Request | [57](57.md) |
|
||||
| `9735` | Zap | [57](57.md) |
|
||||
| `10000` | Mute List | [51](51.md) |
|
||||
| `10001` | Pin List | [51](51.md) |
|
||||
| `10002` | Relay List Metadata | [65](65.md) |
|
||||
| `13194` | Wallet Info | [47](47.md) |
|
||||
| `22242` | Client Authentication | [42](42.md) |
|
||||
| `23194` | Wallet Request | [47](47.md) |
|
||||
| `23195` | Wallet Response | [47](47.md) |
|
||||
| `24133` | Nostr Connect | [46](46.md) |
|
||||
| `27235` | HTTP Auth | [98](98.md) |
|
||||
| `30000` | Categorized People List | [51](51.md) |
|
||||
| `30001` | Categorized Bookmark List | [51](51.md) |
|
||||
| `30008` | Profile Badges | [58](58.md) |
|
||||
| `30009` | Badge Definition | [58](58.md) |
|
||||
| `30017` | Create or update a stall | [15](15.md) |
|
||||
| `30018` | Create or update a product | [15](15.md) |
|
||||
| `30023` | Long-form Content | [23](23.md) |
|
||||
| `30024` | Draft Long-form Content | [23](23.md) |
|
||||
| `30078` | Application-specific Data | [78](78.md) |
|
||||
| `30311` | Live Event | [53](53.md) |
|
||||
| `30315` | User Statuses | [38](38.md) |
|
||||
| `30402` | Classified Listing | [99](99.md) |
|
||||
| `30403` | Draft Classified Listing | [99](99.md) |
|
||||
| `31922` | Date-Based Calendar Event | [52](52.md) |
|
||||
| `31923` | Time-Based Calendar Event | [52](52.md) |
|
||||
| `31924` | Calendar | [52](52.md) |
|
||||
| `31925` | Calendar Event RSVP | [52](52.md) |
|
||||
| `31989` | Handler recommendation | [89](89.md) |
|
||||
| `31990` | Handler information | [89](89.md) |
|
||||
| `34550` | Community Definition | [72](72.md) |
|
||||
|
||||
|
||||
## Message types
|
||||
|
||||
Reference in New Issue
Block a user