separate tree encoding from storage

This commit is contained in:
hzrd149
2024-11-11 12:00:47 +00:00
parent 8fc2e3dc31
commit 4d82f98b3c

View File

@@ -16,13 +16,8 @@ Clients MUST create a merkle tree using the chunk hashes as the leaf nodes
### Merkle tree encoding ### Merkle tree encoding
Clients MAY choose to store the merkle tree on nostr relays using the `2001` kind event The merkle tree MUST be in the format of `[<root hash (Uint8)>, <left>, <right>]` and be encoded using [`CBOR`](https://cbor.io/)
The merkle tree MUST be in the format of `[<root hash (Uint8)>, <left>, <right>]`
The merkle tree MUST be stored in the events `content` as a base64 encoded [`CBOR`](https://cbor.io/) object
Clients MUST add an `x` tag with the merkle root to the `2001` event
Example: Example:
@@ -48,30 +43,34 @@ graph TD
``` ```
[Unit8(ABCDEFG), [Unit8(ABCDEFG),
[Unit8(ABCD), [Unit8(ABCD),
[Unit(AB), [Unit8(AB),
Unit(A), Unit8(A),
Unit(B) Unit8(B)
], ],
[Unit(CD), [Unit8(CD),
Unit(C), Unit8(C),
Unit(D) Unit8(D)
] ]
], ],
[Unit(EFG), [Unit8(EFG),
[Unit(EF), [Unit8(EF),
Unit(E), Unit8(E),
Unit(F) Unit8(F)
], ],
[Unit(G), [Unit8(G),
Unit(G) Unit8(G)
] ]
] ]
]; ];
``` ```
### Metadata ### Merkle tree storage
Clients MAY include additional metadata tags in the `2001` event to help other clients know the filename or mime type Clients MAY choose to store the merkle tree on nostr relays using the `2001` kind event
The event MUST include an `x` tag with the merkle root to the `2001` event
The event MAY include additional metadata tags to help other clients know the filename, mime type or servers to download from
Metadata tags: Metadata tags:
- `name` Filename - `name` Filename