Files
simplex-chat/packages/simplex-chat-nodejs/cpp/simplex.h
Evgeny 43aa3e7e8a nodejs: simplex-chat npm package (#5556)
* nodejs: addon

* rename

* changes

* change lib name

* package

* lib path

* simplex-chat-nodejs: fix library paths

* simplex-chat-nodejs: change addon name

* simplex-chat-nodejs: install libs, adjust package and installation

* simplex-chat-nodejs: add npmignore

* gitignore: add additional nodejs path

* simplex-chat-nodejs: fix shim name

* gitignore: ignore nodejs package lock

* simplex-chat-nodejs: rename shim to underscore

* simplex-chat-nodejs: fix library loading on Mac

* simplex-chat-nodejs: expose low-level functions, move tests

* simplex-chat-nodejs: expose shim fucntions

* simplex-chat-nodejs: fixed libs version

* simplex-chat-nodejs: switch to official repository

* simpelx-chat-nodejs: adjust release tag

* async addon, tests

* refactor, fixes

* high level chat api

* simplify cpp add-on - move logic to JS, fix API

* api for events, api test

* update @simplex-chat/types

* Revert "update @simplex-chat/types"

This reverts commit da3f89866f.

* change @simplex-chat/types version

* receiver for any events, wait with timeout

* low-level bot example

* typedoc

* network connection events

* declarative bot api

* readme, docs

* update docs

* update readme

* add liveMessage support

* allow passing welcome message as string

* @simplex-chat/webrtc-client 6.5.0-beta.3

* bot test

* concurrent connection in tests

* nodejs/download-libs: cleanup on version mismatch

* nodejs/download-libs: bump libs version

* do not handle signals in Haskell

* update bot examples

* flatten docs and use local links to code

* update readme

* 6.5.0-beta.4

* include more files in npm package, 6.5.0-beta.4.2

* .gitignore

---------

Co-authored-by: Avently <7953703+avently@users.noreply.github.com>
Co-authored-by: shum <github.shum@liber.li>
2026-01-14 21:42:21 +00:00

46 lines
2.0 KiB
C

//
// simplex.h
// SimpleX
//
// Created by Evgeny on 30/05/2022.
// Copyright © 2022 SimpleX Chat. All rights reserved.
//
#ifndef SimpleX_h
#define SimpleX_h
extern "C" void hs_init(int argc, char **argv[]);
extern "C" void hs_init_with_rtsopts(int * argc, char **argv[]);
typedef long* chat_ctrl;
// the last parameter is used to return the pointer to chat controller
extern "C" char *chat_migrate_init(const char *path, const char *key, const char *confirm, chat_ctrl *ctrl);
extern "C" char *chat_close_store(chat_ctrl ctrl);
extern "C" char *chat_reopen_store(chat_ctrl ctrl);
extern "C" char *chat_send_cmd(chat_ctrl ctrl, const char *cmd);
extern "C" char *chat_recv_msg_wait(chat_ctrl ctrl, const int wait);
extern "C" char *chat_parse_markdown(const char *str);
extern "C" char *chat_parse_server(const char *str);
extern "C" char *chat_password_hash(const char *pwd, const char *salt);
extern "C" char *chat_valid_name(const char *name);
extern "C" int chat_json_length(const char *str);
extern "C" char *chat_encrypt_media(chat_ctrl ctrl, const char *key, const char *frame, const int len);
extern "C" char *chat_decrypt_media(const char *key, const char *frame, const int len);
// chat_write_file returns null-terminated string with JSON of WriteFileResult
extern "C" char *chat_write_file(chat_ctrl ctrl, const char *path, const char *data, const int len);
// chat_read_file returns a buffer with:
// 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.
extern "C" char *chat_read_file(const char *path, const char *key, const char *nonce);
// chat_encrypt_file returns null-terminated string with JSON of WriteFileResult
extern "C" char *chat_encrypt_file(chat_ctrl ctrl, const char *fromPath, const char *toPath);
// chat_decrypt_file returns null-terminated string with the error message
extern "C" char *chat_decrypt_file(const char *fromPath, const char *key, const char *nonce, const char *toPath);
#endif /* simplex_h */