logo
pub trait CwtchLib {
Show 45 methods fn start_cwtch(&self, app_dir: &str, tor_path: &str) -> i32; fn started(&self) -> i32; fn send_app_event(&self, event_json: &str); fn send_profile_event(&self, profile: &str, event_json: &str); fn get_appbus_event(&self) -> String; fn create_profile(&self, nick: &str, pass: &str); fn load_profiles(&self, pass: &str); fn accept_conversation(&self, profile: &str, conversation_id: i32); fn block_contact(&self, profile: &str, conversation_id: i32); fn unblock_contact(&self, profile: &str, conversation_id: i32); fn get_message(
        &self,
        profile: &str,
        conversation_id: i32,
        message_index: i32
    ) -> String; fn get_message_by_id(
        &self,
        profile: &str,
        conversation_id: i32,
        message_id: i32
    ) -> String; fn get_message_by_content_hash(
        &self,
        profile: &str,
        conversation_id: i32,
        hash: &str
    ) -> String; fn get_messages(
        &self,
        profile: &str,
        conversation_id: i32,
        message_index: i32,
        count: i32
    ) -> String; fn send_message(
        &self,
        profile: &str,
        conversation_id: i32,
        msg: &str
    ) -> String; fn send_invitation(
        &self,
        profile: &str,
        conversation_id: i32,
        target_id: i32
    ) -> String; fn share_file(
        &self,
        profile: &str,
        conversation_id: i32,
        file_path: &str
    ) -> String; fn download_file(
        &self,
        profile: &str,
        conversation_id: i32,
        file_path: &str,
        manifest_path: &str,
        file_key: &str
    ); fn check_download_status(&self, profile: &str, file_key: &str); fn verify_or_resume_download(
        &self,
        profile: &str,
        conversation_id: i32,
        file_key: &str
    ); fn reset_tor(&self); fn create_group(&self, profile: &str, server: &str, name: &str); fn delete_profile(&self, profile: &str, pass: &str); fn archive_conversation(&self, profile: &str, conversation_id: i32); fn delete_contact(&self, profile: &str, conversation_id: i32); fn import_bundle(&self, profile: &str, bundle: &str); fn set_profile_attribute(&self, profile: &str, key: &str, val: &str); fn get_profile_attribute(
        &self,
        profile: &str,
        key: &str
    ) -> Result<Option<String>, CwtchError>; fn set_conversation_attribute(
        &self,
        profile: &str,
        conversation_id: i32,
        key: &str,
        val: &str
    ); fn set_message_attribute(
        &self,
        profile: &str,
        conversation_id: i32,
        channel_id: i32,
        message_id: i32,
        attribute_key: &str,
        attribute_value: &str
    ); fn get_conversation_attribute(
        &self,
        profile: &str,
        conversation_id: i32,
        key: &str
    ) -> Result<Option<String>, CwtchError>; fn change_password(
        &self,
        profile: &str,
        old_pass: &str,
        new_pass: &str,
        new_pass_again: &str
    ); fn export_profile(&self, profile: &str, filename: &str); fn import_profile(&self, filename: &str, password: &str) -> String; fn shutdown_cwtch(&self); fn load_servers(&self, password: &str); fn create_server(&self, password: &str, description: &str, autostart: i8); fn delete_server(&self, onion: &str, current_password: &str); fn launch_servers(&self); fn launch_server(&self, onion: &str); fn stop_server(&self, onion: &str); fn stop_servers(&self); fn destroy_servers(&self); fn set_server_attribute(&self, onion: &str, key: &str, val: &str); fn get_debug_info(&self) -> String;
}
Expand description

Interface to a Cwtch app with API matching libcwtch

Required Methods

Start a cwtch application using app_dir to store all user profile data and looking to tor_path to find tor to run

Return 1 if cwtch has been started and 0 if not

Send json of a structs::CwtchEvent to the cwtch app bus

Send json of a structs::CwtchEvent to a cwtch profile

Pull json of a structs::CwtchEvent off the appbus for responding to

Create a new profile encrypted with pass

Load any profiles encrypted by pass

Cause profile to accept conversation

Cause profile to block conversation

Cause profile to unblock contact

Get a specific message for conversation of profile by index

Get a specific message for a conversation by its id

Get a specific message for conversation of profile by hash

Bulk get messages starting at message index and of count amoung

Send json of a structs::Message from profile to contact. Returns computed sent message (including index and hash values)

Send profile’s contact an invite for/to target. Returns computed sent message (including index and hash values)

share a file file_path with a conersation. Returns computed sent message (including index and hash values)

download a file from a conversation to the file_path

Query the status of a download

Verufy a download is done, and if not, resume it

Ask the ACN inside the Cwtch app to restart the tor connection

Cause profile to create a group on server with name

Delete profile with encryption/password check of pass

Cause profile to archive conversation with contact

Cause profile to delete contact/group identified by handle

Cuase profile to attempt to import a contact/group/keybundle identified by bundle

Set a profile attribute key to val

Get a profile attribute

Set a profile’s contact’s attribute of key to val

Set an attribute on a message in a conversation

Get an attribute for a conversation

Change a profile’s password to new_pass if old_pass is correct

Export a profile to filename

Import a profile from a file with supplied password. Json of a profile struct returned on success

Shutdown the cwtch app and associated ACN

Server functions require server experiment to be enabled Load all servers encrypted by password

Create a new server, encrypted with password, autostart i8 used as bool

Delete the specified server (if password is correct)

Launch all loaded servers

Launch the specified server

Stop the specified server

Stop all running servers

Destroy all servers leaving htem un-re-runnable. call only on shutdown

Set the specified server’s attribute of key to val

Get debug info (mem, goroutine stats) from lcg in json

Implementors