2024-04-09 15:59:49 -04:00
|
|
|
NIP-41
|
|
|
|
======
|
|
|
|
|
|
|
|
Relational Database
|
|
|
|
-------------------
|
|
|
|
|
|
|
|
`draft` `optional`
|
|
|
|
|
|
|
|
This NIP offers a plug-and-play method to export/sync information from existing systems using relational databases into Nostr.
|
|
|
|
|
|
|
|
Event kind `31200` represents a row in a database. Each value of the row is added as a tag whose name is the column's name.
|
|
|
|
|
2024-04-09 17:27:05 -04:00
|
|
|
The `d` tag is used for the row's primary key, the `n` tag places the row into an unbound list and the optional `u` tag references a database name.
|
|
|
|
|
2024-04-09 15:59:49 -04:00
|
|
|
Values can be public or encrypted to the user.
|
|
|
|
|
|
|
|
```js
|
|
|
|
{
|
|
|
|
"kind": 31200,
|
|
|
|
"tags": [
|
2024-04-09 17:27:05 -04:00
|
|
|
["d", "<row-primary-key>"]
|
2024-04-09 15:59:49 -04:00
|
|
|
["n", "<table-name>"]
|
|
|
|
["u", "<database-name>"]
|
|
|
|
["<column-name>", "<column-row-value>"]
|
|
|
|
// other public columns
|
|
|
|
],
|
|
|
|
"content": nip44Encrypt(JSON.stringify((
|
|
|
|
[
|
|
|
|
["<column-name>", "<column-row-value>"]
|
|
|
|
// other private columns
|
|
|
|
]
|
|
|
|
)),
|
|
|
|
// .. other fields
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Inserts and updates are supported via Nostr's regular signing operations and deletions via [NIP-09](09.md).
|
|
|
|
|
|
|
|
The pubkey MAY be own by the system and represent several users from that system.
|