Methods
findServicesWithFeature(accountId:String, feature:String):Promise<Array<{serviceId:String, node:Null<String>, name:Null<String>, caps:Caps}>>
Find known services that advertise a feature
Parameters:
accountId | the account to search services for |
|---|---|
feature | disco feature to search for |
Returns:
Promise resolving to matching services
getCaps(ver:String):Promise<Null<Caps>>
Load previously stored service discovery capabilities
Parameters:
ver | capability version hash |
|---|
Returns:
Promise resolving to the stored capability record or null
getChats(accountId:String):Promise<Array<SerializedChat>>
Load the stored Chats for an account
Parameters:
accountId | the account to load Chats for |
|---|
Returns:
Promise resolving to serialized chat records
getChatsUnreadDetails(accountId:String, chats:Array<Chat>):Promise<Array<{unreadCount:Int, message:ChatMessage, chatId:String}>>
Load unread counters and most recent unread message per Chat
Parameters:
accountId | the account to load unread details for |
|---|---|
chats | chats to inspect |
Returns:
Promise resolving to unread details for the requested chats
getLogin(accountId:String):Promise<{token:Null<String>, fastCount:Int, displayName:Null<String>, clientId:Null<String>}>
Load persisted login-related state for an account
Parameters:
accountId | the account to load login state for |
|---|
Returns:
Promise resolving to stored login data
getMessage(accountId:String, chatId:String, serverId:Null<String>, localId:Null<String>):Promise<Null<ChatMessage>>
Find a message by Chat ID and known IDs
Parameters:
accountId | the account that owns the message |
|---|---|
chatId | Chat containing the message |
serverId | authoritative server-assigned ID, if known |
localId | client-assigned ID, if known |
Returns:
Promise resolving to the matching message or null
getMessagesAfter(accountId:String, chatId:String, afterId:Null<ChatMessage>):Promise<Array<ChatMessage>>
Load messages newer than a reference message
Parameters:
accountId | the account to load messages for |
|---|---|
chatId | Chat to query |
afterId | return messages newer than this message, or start from the oldest when null |
Returns:
Promise resolving to newer messages
getMessagesAround(accountId:String, around:ChatMessage):Promise<Array<ChatMessage>>
Load messages surrounding a reference message
Parameters:
accountId | the account to load messages for |
|---|---|
around | message to center the result set around |
Returns:
Promise resolving to nearby messages
getMessagesBefore(accountId:String, chatId:String, before:Null<ChatMessage>):Promise<Array<ChatMessage>>
Load messages older than a reference message
Parameters:
accountId | the account to load messages for |
|---|---|
chatId | Chat to query |
before | return messages older than this message, or start from the newest when null |
Returns:
Promise resolving to older messages
getOmemoContactIdentityKey(account:String, address:String):Promise<IdentityPublicKey>
Load a stored identity key for a remote OMEMO contact
getOmemoDeviceList(identifier:String):Promise<Array<Int>>
Load the known OMEMO device list for a contact or account
getOmemoIdentityKey(login:String):Promise<IdentityKeyPair>
Load the local OMEMO identity key pair for an account
getOmemoMetadata(account:String, address:String):Promise<OMEMOSessionMetadata>
Load stored metadata associated with an OMEMO session
getOmemoSession(account:String, address:String):Promise<SignalSession>
Load a stored OMEMO session for a remote device
getStreamManagement(accountId:String):Promise<Null<BytesData>>
Load stream management resumption data for an account
Parameters:
accountId | the account to load resumption data for |
|---|
Returns:
Promise resolving to stored resumption data or null
hasMedia(hashAlgorithm:String, hash:BytesData):Promise<Bool>
Check whether a media blob is already stored
Parameters:
hashAlgorithm | hash algorithm for the content ID |
|---|---|
hash | raw hash bytes |
Returns:
Promise resolving to true when the media exists
listAccounts():Promise<Array<String>>
List all accounts present in storage
Returns:
Promise resolving to stored account IDs
removeAccount(accountId:String, completely:Bool):Void
Remove stored data for an account
Parameters:
accountId | the account to remove |
|---|---|
completely | true to delete all account data, false to keep recoverable state |
removeMedia(hashAlgorithm:String, hash:BytesData):Void
Delete previously stored media
Parameters:
hashAlgorithm | hash algorithm for the content ID |
|---|---|
hash | raw hash bytes |
removeOmemoSession(account:String, address:String):Void
Remove a stored OMEMO session for a remote device
storeCaps(caps:Caps):Void
Store service discovery capabilities for later reuse
Parameters:
caps | capabilities record to save |
|---|
storeChats(accountId:String, chats:Array<Chat>):Void
Persist the current metadata for a set of Chats
Parameters:
accountId | the account that owns the Chats |
|---|---|
chats | chats to write to storage |
storeLogin(accountId:String, clientId:String, displayName:String, token:Null<String>):Void
Store login-related state for an account
Parameters:
accountId | the account to store login state for |
|---|---|
clientId | negotiated client ID |
displayName | last known display name |
token | persisted token or null to clear it |
storeMedia(mime:String, bytes:BytesData):Promise<Bool>
Store media bytes and any metadata needed to retrieve them later
Parameters:
mime | MIME type of the media |
|---|---|
bytes | raw media bytes |
Returns:
Promise resolving to true when storage succeeded
storeMessages(accountId:String, message:Array<ChatMessage>):Promise<Array<ChatMessage>>
Persist one or more messages
Parameters:
accountId | the account that owns the messages |
|---|---|
message | messages to store |
Returns:
Promise resolving to the stored message values
storeOmemoContactIdentityKey(account:String, address:String, identityKey:IdentityPublicKey):Void
Store a trusted identity key for a remote OMEMO contact
storeOmemoDeviceList(identifier:String, deviceIds:Array<Int>):Void
Store the known OMEMO device list for a contact or account
storeOmemoIdentityKey(login:String, keypair:IdentityKeyPair):Void
Store the local OMEMO identity key pair for an account
storeOmemoMetadata(account:String, address:String, metadata:OMEMOSessionMetadata):Void
Store extra metadata associated with an OMEMO session
storeOmemoSession(account:String, address:String, session:SignalSession):Void
Store an OMEMO session for a remote device
storeReaction(accountId:String, update:ReactionUpdate):Promise<Null<ChatMessage>>
Apply a reaction update to the stored message state
Parameters:
accountId | the account that owns the message |
|---|---|
update | reaction update to apply |
Returns:
Promise resolving to the updated message or null if no message matched
storeService(accountId:String, serviceId:String, name:Null<String>, node:Null<String>, caps:Caps):Void
Store metadata about a discovered service
Parameters:
accountId | the account that discovered the service |
|---|---|
serviceId | ID of the service |
name | advertised display name, if any |
node | disco node, if any |
caps | service capabilities |
storeStreamManagement(accountId:String, data:Null<BytesData>):Void
Store stream management resumption data for an account
Parameters:
accountId | the account to store resumption data for |
|---|---|
data | stream management payload, or null to clear it |
syncPoint(accountId:String, chatId:Null<String>):Promise<Null<ChatMessage>>
Get the last message in an account or chat that is is safe to sync forward from
Parameters:
accountId | the account whose state should be queried |
|---|---|
chatId | chat to inspect, or null for the account-wide sync point |
Returns:
Promise resolving to the sync point or null
updateMessage(accountId:String, message:ChatMessage):Void
Replace the stored record for a message
Parameters:
accountId | the account that owns the message |
|---|---|
message | message to write |
updateMessageStatus(accountId:String, localId:String, status:MessageStatus, statusText:Null<String>):Promise<ChatMessage>
Update delivery state for a locally-created message
Parameters:
accountId | the account that owns the message |
|---|---|
localId | local message ID to update |
status | new delivery state |
statusText | optional human-readable status detail |
Returns:
Promise resolving to the updated message