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>
30 lines
1.4 KiB
C
30 lines
1.4 KiB
C
#ifndef SLEEP_CRYPTO_H
|
|
#define SLEEP_CRYPTO_H
|
|
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
#include "keys.h"
|
|
#define SLEEP_ROOT_RECORD_BYTES 48u
|
|
|
|
int sleep_crypto_init(void);
|
|
int sleep_stream_xsalsa20_xor(uint8_t *out, const uint8_t *in, size_t length,
|
|
const uint8_t nonce[24], const uint8_t key[32],
|
|
uint64_t stream_offset);
|
|
int sleep_gen_keypair(sleep_keypair_t *kp);
|
|
int sleep_save_pubkey(const char *path, const uint8_t pubkey[SLEEP_PUB_KEY_BYTES]);
|
|
int sleep_load_pubkey(const char *path, uint8_t pubkey[SLEEP_PUB_KEY_BYTES]);
|
|
int sleep_save_keypair(const char *path, const sleep_keypair_t *keypair);
|
|
int sleep_load_keypair(const char *path, sleep_keypair_t *keypair);
|
|
|
|
int sleep_blake2b(uint8_t out[SLEEP_BLAKE2B_BYTES], const uint8_t *in, size_t inlen);
|
|
|
|
int sleep_sign(uint8_t sig[SLEEP_SIGNATURE_BYTES], const uint8_t *msg, size_t msglen, const sleep_keypair_t *kp);
|
|
|
|
int sleep_verify(const uint8_t sig[SLEEP_SIGNATURE_BYTES], const uint8_t *msg, size_t msglen, const uint8_t pubkey[SLEEP_PUB_KEY_BYTES]);
|
|
|
|
int sleep_sign_roots(uint8_t sig[SLEEP_SIGNATURE_BYTES], const uint8_t *roots, size_t nroots, const uint64_t *indices, const uint64_t *lengths, const sleep_keypair_t *kp);
|
|
|
|
int sleep_verify_roots(const uint8_t sig[SLEEP_SIGNATURE_BYTES], const uint8_t *roots, size_t nroots, const uint64_t *indices, const uint64_t *lengths, const uint8_t pub[SLEEP_PUB_KEY_BYTES]);
|
|
|
|
#endif /* SLEEP_CRYPTO_H */
|