2022-01-22 17:54:22 +00:00
|
|
|
//
|
2022-05-31 07:55:13 +01:00
|
|
|
// SimpleX.h
|
|
|
|
|
// SimpleX
|
2022-01-22 17:54:22 +00:00
|
|
|
//
|
2022-05-31 07:55:13 +01:00
|
|
|
// Created by Evgeny on 30/05/2022.
|
|
|
|
|
// Copyright © 2022 SimpleX Chat. All rights reserved.
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
#ifndef SimpleX_h
|
|
|
|
|
#define SimpleX_h
|
|
|
|
|
|
2023-11-22 22:12:42 +00:00
|
|
|
#include "hs_init.h"
|
2022-01-22 17:54:22 +00:00
|
|
|
|
2022-01-29 11:10:04 +00:00
|
|
|
extern void hs_init(int argc, char **argv[]);
|
2022-01-22 17:54:22 +00:00
|
|
|
|
2022-01-29 11:10:04 +00:00
|
|
|
typedef void* chat_ctrl;
|
2022-01-22 17:54:22 +00:00
|
|
|
|
2022-09-24 09:28:22 +01:00
|
|
|
// the last parameter is used to return the pointer to chat controller
|
2023-12-23 13:06:59 +00:00
|
|
|
extern char *chat_migrate_init_key(char *path, char *key, int keepKey, char *confirm, int backgroundMode, chat_ctrl *ctrl);
|
2023-10-09 18:03:03 +01:00
|
|
|
extern char *chat_close_store(chat_ctrl ctl);
|
2023-12-09 21:59:40 +00:00
|
|
|
extern char *chat_reopen_store(chat_ctrl ctl);
|
2022-01-29 11:10:04 +00:00
|
|
|
extern char *chat_send_cmd(chat_ctrl ctl, char *cmd);
|
2022-06-24 13:52:20 +01:00
|
|
|
extern char *chat_recv_msg_wait(chat_ctrl ctl, int wait);
|
|
|
|
|
extern char *chat_parse_markdown(char *str);
|
2022-11-21 08:37:13 +00:00
|
|
|
extern char *chat_parse_server(char *str);
|
2023-03-22 15:58:01 +00:00
|
|
|
extern char *chat_password_hash(char *pwd, char *salt);
|
2023-10-04 17:45:39 +01:00
|
|
|
extern char *chat_valid_name(char *name);
|
2024-01-26 13:37:49 +04:00
|
|
|
extern int chat_json_length(char *str);
|
2023-12-21 00:42:40 +00:00
|
|
|
extern char *chat_encrypt_media(chat_ctrl ctl, char *key, char *frame, int len);
|
2023-02-24 20:55:59 +00:00
|
|
|
extern char *chat_decrypt_media(char *key, char *frame, int len);
|
2023-09-07 11:28:37 +01:00
|
|
|
|
2023-09-07 22:43:51 +01:00
|
|
|
// chat_write_file returns null-terminated string with JSON of WriteFileResult
|
2023-12-21 00:42:40 +00:00
|
|
|
extern char *chat_write_file(chat_ctrl ctl, char *path, char *data, int len);
|
2023-09-07 11:28:37 +01:00
|
|
|
|
|
|
|
|
// chat_read_file returns a buffer with:
|
2023-09-07 22:43:51 +01:00
|
|
|
// result status (1 byte), then if
|
|
|
|
|
// status == 0 (success): buffer length (uint32, 4 bytes), buffer of specified length.
|
|
|
|
|
// status == 1 (error): null-terminated error message string.
|
2023-09-07 11:28:37 +01:00
|
|
|
extern char *chat_read_file(char *path, char *key, char *nonce);
|
|
|
|
|
|
2023-09-07 22:43:51 +01:00
|
|
|
// chat_encrypt_file returns null-terminated string with JSON of WriteFileResult
|
2023-12-21 00:42:40 +00:00
|
|
|
extern char *chat_encrypt_file(chat_ctrl ctl, char *fromPath, char *toPath);
|
2023-09-07 11:28:37 +01:00
|
|
|
|
2023-09-07 22:43:51 +01:00
|
|
|
// chat_decrypt_file returns null-terminated string with the error message
|
2023-09-07 11:28:37 +01:00
|
|
|
extern char *chat_decrypt_file(char *fromPath, char *key, char *nonce, char *toPath);
|
2023-11-22 22:12:42 +00:00
|
|
|
|
|
|
|
|
#endif /* SimpleX_h */
|