Emit this event when init has complete.
Emit this event if there is an error in opening the database.
Closes the database. You must close any open connections so the sqlite database is available to be opened again.
Deletes a message. Remove it entirely.
Deletes a set of one time keys by index number.
Gets all encryption sessions.
Gets the group message history of a channel by its channelID, in descending temporal order.
Gets the direct message history of a user by their userID, in descending temporal order.
Gets a set of one time keys by index number.
Gets your set of main prekeys. You only have one at a time. Returns null if the prekeys have not been saved yet.
Gets an encryption session by its public key.
Gets the most recently used (active) session (by lastUsed key) by userID.
Any initializing you may need to do before the class is used. For example, you could initialize the database schema here.
Updates the "lastUsed" timestamp key of a session to the current time. This will be called each time the session is used to encrypt or decrypt a message.
Marks a session as "verified" which means the user has compared the mnemonic fingerprint with the other user and indicated it matches.
Set this to "true" when init has complete.
Saves a single message to a database.
Saves a main set of prekeys or a onetime set of prekeys, as indicated by the oneTime parameter.
Saves an encryption session.
This symbol shall be used to install a listener for only monitoring 'error'
events. Listeners installed using this symbol are called before the regular
'error'
listeners are called.
Installing a listener using this symbol does not change the behavior once an
'error'
event is emitted, therefore the process will still crash if no
regular 'error'
listener is installed.
Generated using TypeDoc
This is the class you must implement to store and retrieve important data for the key exchange and messaging processes if you want to replace the Database class, for example, if you wanted to port this library to mobile or browser or another platform that doesn't support knex.js