mirror of
https://github.com/logos-messaging/libchat.git
synced 2026-02-09 16:33:10 +00:00
* feat: ffi * feat: ffi interface and header generation * feat: nim ffi example * chore: doc * fix: encrypt state clean * chore: zeroize when drop
115 lines
2.7 KiB
C
115 lines
2.7 KiB
C
/*! \file */
|
|
/*******************************************
|
|
* *
|
|
* File auto-generated by `::safer_ffi`. *
|
|
* *
|
|
* Do not manually edit this file. *
|
|
* *
|
|
*******************************************/
|
|
|
|
#ifndef __RUST_DOUBLE_RATCHETS__
|
|
#define __RUST_DOUBLE_RATCHETS__
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/** <No documentation available> */
|
|
typedef struct FFIRatchetState FFIRatchetState_t;
|
|
|
|
/** <No documentation available> */
|
|
typedef struct FFIEncryptResult FFIEncryptResult_t;
|
|
|
|
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
/** \brief
|
|
* Same as [`Vec<T>`][`rust::Vec`], but with guaranteed `#[repr(C)]` layout
|
|
*/
|
|
typedef struct Vec_uint8 {
|
|
/** <No documentation available> */
|
|
uint8_t * ptr;
|
|
|
|
/** <No documentation available> */
|
|
size_t len;
|
|
|
|
/** <No documentation available> */
|
|
size_t cap;
|
|
} Vec_uint8_t;
|
|
|
|
/** <No documentation available> */
|
|
typedef struct CResult_Vec_uint8_Vec_uint8 {
|
|
/** <No documentation available> */
|
|
Vec_uint8_t ok;
|
|
|
|
/** <No documentation available> */
|
|
Vec_uint8_t err;
|
|
} CResult_Vec_uint8_Vec_uint8_t;
|
|
|
|
/** <No documentation available> */
|
|
CResult_Vec_uint8_Vec_uint8_t
|
|
double_ratchet_descrypt_message (
|
|
FFIRatchetState_t * state,
|
|
FFIEncryptResult_t const * encrypted);
|
|
|
|
/** <No documentation available> */
|
|
FFIEncryptResult_t *
|
|
double_ratchet_encrypt_message (
|
|
FFIRatchetState_t * state,
|
|
Vec_uint8_t const * plaintext);
|
|
|
|
typedef struct {
|
|
uint8_t idx[32];
|
|
} uint8_32_array_t;
|
|
|
|
/** <No documentation available> */
|
|
typedef struct FFIInstallationKeyPair FFIInstallationKeyPair_t;
|
|
|
|
/** <No documentation available> */
|
|
FFIRatchetState_t *
|
|
double_ratchet_init_receiver (
|
|
uint8_32_array_t shared_secret,
|
|
FFIInstallationKeyPair_t const * keypair);
|
|
|
|
/** <No documentation available> */
|
|
FFIRatchetState_t *
|
|
double_ratchet_init_sender (
|
|
uint8_32_array_t shared_secret,
|
|
uint8_32_array_t remote_pub);
|
|
|
|
/** <No documentation available> */
|
|
void
|
|
encrypt_result_destroy (
|
|
FFIEncryptResult_t * result);
|
|
|
|
/** <No documentation available> */
|
|
void
|
|
ffi_c_string_free (
|
|
Vec_uint8_t s);
|
|
|
|
/** <No documentation available> */
|
|
void
|
|
installation_key_pair_destroy (
|
|
FFIInstallationKeyPair_t * keypair);
|
|
|
|
/** <No documentation available> */
|
|
FFIInstallationKeyPair_t *
|
|
installation_key_pair_generate (void);
|
|
|
|
/** <No documentation available> */
|
|
uint8_32_array_t
|
|
installation_key_pair_public (
|
|
FFIInstallationKeyPair_t const * keypair);
|
|
|
|
/** <No documentation available> */
|
|
void
|
|
ratchet_state_destroy (
|
|
FFIRatchetState_t * state);
|
|
|
|
|
|
#ifdef __cplusplus
|
|
} /* extern \"C\" */
|
|
#endif
|
|
|
|
#endif /* __RUST_DOUBLE_RATCHETS__ */
|