0.0.002
ddat interop with dat js cable interop with cabal js ddat's frontend = dat-thang cable fe = cable-thang dillo support based on cel's dillo-dat bootstrap node xplatform support Signed-off-by: divo <418@cryspace.space>
This commit is contained in:
1 parent
f0f91540be
commit
b735900f2e
323 files changed
+134347
-343
No files matched your search
+27
-4
@@ -11,7 +11,7 @@ content.key
|
||||
content.signatures
|
||||
content.bitfield
|
||||
content.tree*/
|
||||
#include "key.h"
|
||||
#include "keys.h"
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
// test
|
||||
@@ -21,8 +21,14 @@ content.tree*/
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int sleep_init(const char *root);
|
||||
|
||||
#define SLEEP_HEADER_SIZE 32u
|
||||
|
||||
#define SLEEP_MAGIC_BITFIELD 0x05025700u
|
||||
#define SLEEP_MAGIC_SIGNATURE 0x05025701u
|
||||
#define SLEEP_MAGIC_TREE 0x05025702u
|
||||
|
||||
// TODO MAGIC_BITFIELD, MAGIC_SIG, MAGIC_TREE
|
||||
|
||||
#define SLEEP_ALGO_BLAKE2B "BLAKE2b"
|
||||
@@ -30,7 +36,7 @@ extern "C" {
|
||||
|
||||
#define SLEEP_TREE_ENTRY_SIZE 40u
|
||||
#define SLEEP_SIG_ENTRY_SIZE 64u
|
||||
#define SLEEP_BITFIELD_ENTRY_SIZE 3328u
|
||||
#define SLEEP_BITFIELD_ENTRY_SIZE 3584u
|
||||
|
||||
enum sleep_hash_type {
|
||||
SLEEP_HASH_LEAF = 0,
|
||||
@@ -69,11 +75,12 @@ typedef struct SLEEP_PACKED sleep_sig_entry {
|
||||
} sleep_sig_entry_t;
|
||||
// TODO assert
|
||||
|
||||
// 3328 bytes: tree[2048] + data[1024] + index[256]
|
||||
// 3584-byte historical record. The final 256 bytes are opaque for now.
|
||||
typedef struct SLEEP_PACKED sleep_bitfield_entry {
|
||||
uint8_t tree[2048];
|
||||
uint8_t data[1024];
|
||||
uint8_t tree[2048];
|
||||
uint8_t index[256];
|
||||
uint8_t reserved[256];
|
||||
} sleep_bitfield_entry_t;
|
||||
// TODO DOTO ODOT assert it
|
||||
|
||||
@@ -97,6 +104,22 @@ int sleep_compute_discovery_key(const uint8_t pubkey[32], uint8_t out32[32]);
|
||||
#endif /* SLEEP_SALT */
|
||||
|
||||
// function decs
|
||||
uint64_t sleep_tree_index(uint64_t depth, uint64_t offset);
|
||||
uint64_t sleep_tree_depth(uint64_t index);
|
||||
uint64_t sleep_tree_offset(uint64_t index, uint64_t depth);
|
||||
uint64_t sleep_tree_parent(uint64_t index);
|
||||
int sleep_tree_left_child(uint64_t index, uint64_t *out);
|
||||
int sleep_tree_right_child(uint64_t index, uint64_t *out);
|
||||
int sleep_tree_sibling(uint64_t index, uint64_t *out);
|
||||
uint64_t sleep_tree_left_span(uint64_t index);
|
||||
uint64_t sleep_tree_right_span(uint64_t index);
|
||||
void sleep_tree_spans(uint64_t index, uint64_t *left, uint64_t *right);
|
||||
size_t sleep_tree_count(uint64_t index);
|
||||
size_t sleep_tree_count_leaves(uint64_t index);
|
||||
size_t sleep_tree_full_roots(uint64_t index, uint64_t *out, size_t capacity);
|
||||
int sleep_tree_hash_block(const uint8_t *data, size_t len, uint8_t out_hash[32]);
|
||||
int sleep_tree_hash_parent(const uint8_t left[32], const uint8_t right[32],
|
||||
uint64_t length, uint8_t out_hash[32]);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user