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
fn start_cwtch(&self, app_dir: &str, tor_path: &str) -> i32
fn start_cwtch(&self, app_dir: &str, tor_path: &str) -> i32
Start a cwtch application using app_dir to store all user profile data and looking to tor_path to find tor to run
fn send_app_event(&self, event_json: &str)
fn send_app_event(&self, event_json: &str)
Send json of a structs::CwtchEvent to the cwtch app bus
fn send_profile_event(&self, profile: &str, event_json: &str)
fn send_profile_event(&self, profile: &str, event_json: &str)
Send json of a structs::CwtchEvent to a cwtch profile
fn get_appbus_event(&self) -> String
fn get_appbus_event(&self) -> String
Pull json of a structs::CwtchEvent off the appbus for responding to
fn create_profile(&self, nick: &str, pass: &str)
fn create_profile(&self, nick: &str, pass: &str)
Create a new profile encrypted with pass
fn load_profiles(&self, pass: &str)
fn load_profiles(&self, pass: &str)
Load any profiles encrypted by pass
fn accept_conversation(&self, profile: &str, conversation_id: i32)
fn accept_conversation(&self, profile: &str, conversation_id: i32)
Cause profile to accept conversation
fn block_contact(&self, profile: &str, conversation_id: i32)
fn block_contact(&self, profile: &str, conversation_id: i32)
Cause profile to block conversation
fn unblock_contact(&self, profile: &str, conversation_id: i32)
fn unblock_contact(&self, profile: &str, conversation_id: i32)
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
fn check_download_status(&self, profile: &str, file_key: &str)
fn check_download_status(&self, profile: &str, file_key: &str)
Query the status of a download
fn verify_or_resume_download(
&self,
profile: &str,
conversation_id: i32,
file_key: &str
)
fn verify_or_resume_download(
&self,
profile: &str,
conversation_id: i32,
file_key: &str
)
Verufy a download is done, and if not, resume it
fn create_group(&self, profile: &str, server: &str, name: &str)
fn create_group(&self, profile: &str, server: &str, name: &str)
Cause profile to create a group on server with name
fn delete_profile(&self, profile: &str, pass: &str)
fn delete_profile(&self, profile: &str, pass: &str)
Delete profile with encryption/password check of pass
fn archive_conversation(&self, profile: &str, conversation_id: i32)
fn archive_conversation(&self, profile: &str, conversation_id: i32)
Cause profile to archive conversation with contact
fn delete_contact(&self, profile: &str, conversation_id: i32)
fn delete_contact(&self, profile: &str, conversation_id: i32)
Cause profile to delete contact/group identified by handle
fn import_bundle(&self, profile: &str, bundle: &str)
fn import_bundle(&self, profile: &str, bundle: &str)
Cuase profile to attempt to import a contact/group/keybundle identified by bundle
fn set_profile_attribute(&self, profile: &str, key: &str, val: &str)
fn set_profile_attribute(&self, profile: &str, key: &str, val: &str)
Set a profile attribute key to val
fn get_profile_attribute(
&self,
profile: &str,
key: &str
) -> Result<Option<String>, CwtchError>
fn get_profile_attribute(
&self,
profile: &str,
key: &str
) -> Result<Option<String>, CwtchError>
Get a profile attribute
Set a profile’s contact’s attribute of key to val
Set an attribute on a message in a conversation
fn get_conversation_attribute(
&self,
profile: &str,
conversation_id: i32,
key: &str
) -> Result<Option<String>, CwtchError>
fn get_conversation_attribute(
&self,
profile: &str,
conversation_id: i32,
key: &str
) -> Result<Option<String>, CwtchError>
Get an attribute for a conversation
Change a profile’s password to new_pass if old_pass is correct
fn export_profile(&self, profile: &str, filename: &str)
fn export_profile(&self, profile: &str, filename: &str)
Export a profile to filename
fn import_profile(&self, filename: &str, password: &str) -> String
fn import_profile(&self, filename: &str, password: &str) -> String
Import a profile from a file with supplied password. Json of a profile struct returned on success
fn shutdown_cwtch(&self)
fn shutdown_cwtch(&self)
Shutdown the cwtch app and associated ACN
fn load_servers(&self, password: &str)
fn load_servers(&self, password: &str)
Server functions require server experiment to be enabled Load all servers encrypted by password
fn create_server(&self, password: &str, description: &str, autostart: i8)
fn create_server(&self, password: &str, description: &str, autostart: i8)
Create a new server, encrypted with password, autostart i8 used as bool
fn delete_server(&self, onion: &str, current_password: &str)
fn delete_server(&self, onion: &str, current_password: &str)
Delete the specified server (if password is correct)
fn launch_servers(&self)
fn launch_servers(&self)
Launch all loaded servers
fn launch_server(&self, onion: &str)
fn launch_server(&self, onion: &str)
Launch the specified server
fn stop_server(&self, onion: &str)
fn stop_server(&self, onion: &str)
Stop the specified server
fn stop_servers(&self)
fn stop_servers(&self)
Stop all running servers
fn destroy_servers(&self)
fn destroy_servers(&self)
Destroy all servers leaving htem un-re-runnable. call only on shutdown
fn set_server_attribute(&self, onion: &str, key: &str, val: &str)
fn set_server_attribute(&self, onion: &str, key: &str, val: &str)
Set the specified server’s attribute of key to val
fn get_debug_info(&self) -> String
fn get_debug_info(&self) -> String
Get debug info (mem, goroutine stats) from lcg in json