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
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:
@@ -48,30 +43,34 @@ graph TD
```
[Unit8(ABCDEFG),
[Unit8(ABCD),
[Unit(AB),
Unit(A),
Unit(B)
[Unit8(AB),
Unit8(A),
Unit8(B)
],
[Unit(CD),
Unit(C),
Unit(D)
[Unit8(CD),
Unit8(C),
Unit8(D)
]
],
[Unit(EFG),
[Unit(EF),
Unit(E),
Unit(F)
[Unit8(EFG),
[Unit8(EF),
Unit8(E),
Unit8(F)
],
[Unit(G),
Unit(G)
[Unit8(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:
- `name` Filename