3 changed files with 46 additions and 2 deletions
@ -0,0 +1,30 @@ |
|||||||
|
/* Подписанная аватарка канала: SQLite, максимум 16 КиБ, router-блоки до 4 КиБ.
|
||||||
|
* Все API/callbacks — uasync; данные публикуются только после полной проверки подписи. */ |
||||||
|
#ifndef GROUP_AVATAR_H |
||||||
|
#define GROUP_AVATAR_H |
||||||
|
#include <stdint.h> |
||||||
|
#include <stddef.h> |
||||||
|
struct UTUN_INSTANCE; |
||||||
|
#define GROUP_AVATAR_MAX 16384 |
||||||
|
#define GROUP_AVATAR_BLOCK 4096 |
||||||
|
struct group_avatar_record { |
||||||
|
uint64_t version; |
||||||
|
uint16_t size; |
||||||
|
uint8_t hash[32], signature[64], data[GROUP_AVATAR_MAX]; |
||||||
|
}; |
||||||
|
int group_avatar_init(struct UTUN_INSTANCE* inst); |
||||||
|
void group_avatar_destroy(struct UTUN_INSTANCE* inst); |
||||||
|
void group_avatar_cancel_group(struct UTUN_INSTANCE* inst, uint64_t group); |
||||||
|
int group_avatar_get(struct UTUN_INSTANCE* inst, uint64_t group, struct group_avatar_record* record); |
||||||
|
/* 1=изменено, 0=прежняя/старая запись; <0 — ошибка. */ |
||||||
|
int group_avatar_apply(struct UTUN_INSTANCE* inst, uint64_t group, const struct group_avatar_record* record); |
||||||
|
/* Публикация своей картинки требует приватный Ed25519 ключ канала. size=0 — подписанное удаление. */ |
||||||
|
int group_avatar_set(struct UTUN_INSTANCE* inst, uint64_t group, const uint8_t* data, size_t size); |
||||||
|
struct group_avatar_gui_request { |
||||||
|
struct UTUN_INSTANCE* inst; |
||||||
|
uint64_t id, group; |
||||||
|
uint16_t size; |
||||||
|
uint8_t data[GROUP_AVATAR_MAX]; |
||||||
|
}; |
||||||
|
void group_avatar_gui_set(void* arg); |
||||||
|
#endif |
||||||
Loading…
Reference in new issue