Signal

class Signal : SignaldClient
class Signal : SignaldClient

An asynchronous signald client, for use with V1 of the signald protocol. Use the create function to create an instance.

class Signal constructor(accountId: String, socketPath: String?) : SignaldClient

A synchronous signald client, for use with V1 of the signald protocol. Note that the functions and the constructor can block the thread that called the function / constructor due to reads and writes responses from a UNIX socket via blocking method calls.

Parameters

accountId
socketPath

An optional path to the signald socket.

accountId
socketPath

An optional path to the signald socket.

Throws

SignaldException

if unable to get list of accounts to cache current account data if already registered.

org.inthewaves.kotlinsignald.clientprotocol.SignaldException

if unable to get list of accounts to cache current account data if already registered.

Constructors

Signal
Link copied to clipboard
synchronousClient
fun Signal(accountId: String, socketPath: String? = null)
Creates a Signal instance for a particular account.

Types

Companion
Link copied to clipboard
js
object Companion

Functions

acceptInvitation
Link copied to clipboard
js
suspend fun acceptInvitation(groupID: String): <ERROR CLASS>
Accept a group V2 invitation.
synchronousClient
fun acceptInvitation(groupID: String): JsonGroupV2Info
Accept a group V2 invitation.
addDevice
Link copied to clipboard
js
suspend fun addDevice(uri: String)
Adds a linked device to the current account.
synchronousClient
fun addDevice(uri: String)
Adds a linked device to the current account.
addServer
Link copied to clipboard
js
suspend fun addServer(server: <ERROR CLASS>): String
Adds a new server to connect to and returns the new server's UUID.
synchronousClient
fun addServer(server: Server): String
Adds a new server to connect to and returns the new server's UUID.
approveMembership
Link copied to clipboard
js
suspend fun approveMembership(groupID: String, members: Iterable<<ERROR CLASS>>): <ERROR CLASS>
Approves the members requests to join a V2 group with the given groupID.
synchronousClient
fun approveMembership(groupID: String, members: Iterable<JsonAddress>): JsonGroupV2Info
Approves the members requests to join a V2 group with the given groupID.
createGroup
Link copied to clipboard
js
suspend fun createGroup(members: Iterable<<ERROR CLASS>>, title: String, avatar: String? = null, timer: Int? = null, memberRole: String? = null): <ERROR CLASS>
Creates a new group and returns the information of the newly created group.
synchronousClient
fun createGroup(members: Iterable<JsonAddress>, title: String, avatar: String? = null, timer: Int? = null, memberRole: String? = null): JsonGroupV2Info
Creates a new group and returns the information of the newly created group.
deleteAccount
Link copied to clipboard
js
suspend fun deleteAccount(alsoDeleteAccountOnServer: Boolean)
Deletes all account data signald has on disk, and optionally delete the account from the server as well.
synchronousClient
fun deleteAccount(alsoDeleteAccountOnServer: Boolean)
Deletes all account data signald has on disk, and optionally delete the account from the server as well.
deleteServer
Link copied to clipboard
js
suspend fun deleteServer(serverUuid: String)
Deletes a previously added server from addServer.
synchronousClient
fun deleteServer(serverUuid: String)
Deletes a previously added server from addServer.
finishLink
Link copied to clipboard
js
suspend fun finishLink(deviceName: String, sessionId: String): <ERROR CLASS>
After a linking URI has been requested, finish_link must be called with the session_id provided with the URI.
synchronousClient
fun finishLink(deviceName: String, sessionId: String): Account
After a linking URI has been requested, finish_link must be called with the session_id provided with the URI.
generateLinkingUri
Link copied to clipboard
js
suspend fun generateLinkingUri(serverUuid: String? = null): <ERROR CLASS>
Generate a linking URI.
synchronousClient
fun generateLinkingUri(serverUuid: String? = null): LinkingURI
Generate a linking URI.
getAccountInfo
Link copied to clipboard
js
suspend fun getAccountInfo(forceUpdate: Boolean = false): <ERROR CLASS>?
getAllIdentities
Link copied to clipboard
js
suspend fun getAllIdentities(): <ERROR CLASS>
Returns all known identity keys for the current account
synchronousClient
fun getAllIdentities(): AllIdentityKeyList
Returns all known identity keys for the current account
getGroup
Link copied to clipboard
js
suspend fun getGroup(groupID: String, revision: Int? = null): <ERROR CLASS>
Query the server for the latest state of a known group.
synchronousClient
fun getGroup(groupID: String, revision: Int? = null): JsonGroupV2Info
Query the server for the latest state of a known group.
getGroupLinkInfo
Link copied to clipboard
js
suspend fun getGroupLinkInfo(groupLink: String): <ERROR CLASS>
Get information about a group from a signal.groupgroupLink.
synchronousClient
fun getGroupLinkInfo(groupLink: String): JsonGroupJoinInfo
Get information about a group from a signal.groupgroupLink.
getIdentities
Link copied to clipboard
js
suspend fun getIdentities(address: <ERROR CLASS>): <ERROR CLASS>
Get information about known identity keys for a particular address.
synchronousClient
fun getIdentities(address: JsonAddress): IdentityKeyList
Get information about known identity keys for a particular address.
getLinkedDevices
Link copied to clipboard
js
suspend fun getLinkedDevices(): <ERROR CLASS>
Gets a list of all linked devices for this account.
synchronousClient
fun getLinkedDevices(): LinkedDevices
Gets a list of all linked devices for this account.
getProfile
Link copied to clipboard
js
suspend fun getProfile(address: <ERROR CLASS>, async: Boolean = false): <ERROR CLASS>
Gets all information available about a user
synchronousClient
fun getProfile(address: JsonAddress, async: Boolean = false): Profile
Gets all information available about a user
getServers
Link copied to clipboard
js
suspend fun getServers(): <ERROR CLASS>
Gets a list of all signald servers
synchronousClient
fun getServers(): ServerList
Gets a list of all signald servers
isRegisteredWithSignald
Link copied to clipboard
js
suspend fun isRegisteredWithSignald(): Boolean
Whether the accountId of this Signal instance is registered with signald.
joinGroup
Link copied to clipboard
js
suspend fun joinGroup(groupLink: String): <ERROR CLASS>
Joins a group using the given signal.groupgroupLink.
synchronousClient
fun joinGroup(groupLink: String): JsonGroupJoinInfo
Joins a group using the given signal.groupgroupLink.
leaveGroup
Link copied to clipboard
js
suspend fun leaveGroup(groupID: String): <ERROR CLASS>
Leaves a group with the specified groupID
synchronousClient
fun leaveGroup(groupID: String): GroupInfo
Leaves a group with the specified groupID
listAccounts
Link copied to clipboard
js
suspend fun listAccounts(): <ERROR CLASS>
Returns a list of Accounts logged-in to signald.
synchronousClient
fun listAccounts(): AccountList
Returns a list of Accounts logged-in to signald.
listContacts
Link copied to clipboard
js
suspend fun listContacts(async: Boolean? = null): <ERROR CLASS>
Returns a list of contacts for this account.
synchronousClient
fun listContacts(async: Boolean? = null): ProfileList
Returns a list of contacts for this account.
listGroups
Link copied to clipboard
js
suspend fun listGroups(): <ERROR CLASS>
Returns a list of groups for this account.
synchronousClient
fun listGroups(): GroupList
Returns a list of groups for this account.
markRead
Link copied to clipboard
js
suspend fun markRead(to: <ERROR CLASS>, timestamps: Iterable<Long>, when: Long = Clock.System.now().toEpochMilliseconds())
Marks the given messages (represented as timestamps) as read.
synchronousClient
fun markRead(to: JsonAddress, timestamps: Iterable<Long>, when: Long = Clock.System.now().toEpochMilliseconds())
Marks the given messages (represented as timestamps) as read.
react
Link copied to clipboard
js
suspend fun react(recipient: Recipient, reaction: <ERROR CLASS>, timestamp: Long = Clock.System.now().toEpochMilliseconds()): <ERROR CLASS>
Reacts to a previous message.
synchronousClient
fun react(recipient: Recipient, reaction: JsonReaction, timestamp: Long = Clock.System.now().toEpochMilliseconds()): SendResponse
Reacts to a previous message.
register
Link copied to clipboard
js
suspend fun register(voice: Boolean = false, captcha: String? = null)
Begin the account registration process by requesting a phone number verification code.
synchronousClient
fun register(voice: Boolean = false, captcha: String? = null)
Begin the account registration process by requesting a phone number verification code.
remoteConfig
Link copied to clipboard
js
suspend fun remoteConfig(): <ERROR CLASS>
Gets the remote config (feature flags) from the server.
synchronousClient
fun remoteConfig(): RemoteConfigList
Gets the remote config (feature flags) from the server
remoteDelete
Link copied to clipboard
js
suspend fun remoteDelete(recipient: Recipient, timestampOfTarget: Long): <ERROR CLASS>
Sends a remote delete message to delete a message that was previously sent to the given recipient (group or individual address).
synchronousClient
fun remoteDelete(recipient: Recipient, timestampOfTarget: Long): SendResponse
Sends a remote delete message to delete a message that was previously sent to the given recipient (group or individual address).
removeLinkedDevice
Link copied to clipboard
js
suspend fun removeLinkedDevice(deviceId: Long)
Remove a linked device from the Signal account.
synchronousClient
fun removeLinkedDevice(deviceId: Long)
Remove a linked device from the Signal account.
requestSync
Link copied to clipboard
js
suspend fun requestSync(groups: Boolean = true, configuration: Boolean = true, contacts: Boolean = true, blocked: Boolean = true)
Request other devices on the account send us their group list, syncable config, contact list, and block list.
synchronousClient
fun requestSync(groups: Boolean = true, configuration: Boolean = true, contacts: Boolean = true, blocked: Boolean = true)
Request other devices on the account send us their group list, syncable config, contact list, and block list.
resetSession
Link copied to clipboard
js
suspend fun resetSession(address: <ERROR CLASS>, timestamp: Long = Clock.System.now().toEpochMilliseconds()): <ERROR CLASS>
Resets a secure session with a particular user identified by the given address.
synchronousClient
fun resetSession(address: JsonAddress, timestamp: Long = Clock.System.now().toEpochMilliseconds()): SendResponse
Resets a secure session with a particular user identified by the given address.
resolveAddress
Link copied to clipboard
js
suspend fun resolveAddress(partial: <ERROR CLASS>): <ERROR CLASS>
Resolve a partial JsonAddress with only a number or UUID to one with both.
synchronousClient
fun resolveAddress(partial: JsonAddress): JsonAddress
Resolve a partial JsonAddress with only a number or UUID to one with both.
send
Link copied to clipboard
js
suspend fun send(recipient: Recipient, messageBody: String, attachments: Iterable<<ERROR CLASS>> = emptyList(), quote: <ERROR CLASS>? = null, mentions: Iterable<<ERROR CLASS>> = emptyList(), timestamp: Long = Clock.System.now().toEpochMilliseconds()): <ERROR CLASS>
Sends a message to either a single user (Recipient.Individual) or a group (Recipient.Group).
synchronousClient
fun send(recipient: Recipient, messageBody: String, attachments: Iterable<JsonAttachment> = emptyList(), quote: JsonQuote? = null, mentions: Iterable<JsonMention> = emptyList(), timestamp: Long = Clock.System.now().toEpochMilliseconds()): SendResponse
Sends a message to either a single user (Recipient.Individual) or a group (Recipient.Group).
sendPayment
Link copied to clipboard
js
suspend fun sendPayment(recipientAddress: <ERROR CLASS>, payment: <ERROR CLASS>, when: Long = Clock.System.now().toEpochMilliseconds()): <ERROR CLASS>
Sends a MobileCoin payment to the user identified by the recipientAddress.
synchronousClient
fun sendPayment(recipientAddress: JsonAddress, payment: Payment, when: Long = Clock.System.now().toEpochMilliseconds()): SendResponse
Sends a MobileCoin payment to the user identified by the recipientAddress.
setDeviceName
Link copied to clipboard
js
suspend fun setDeviceName(deviceName: String)
Set this device's name.
synchronousClient
fun setDeviceName(deviceName: String)
Set this device's name.
setExpiration
Link copied to clipboard
js
suspend fun setExpiration(recipient: Recipient, expiration: Int): <ERROR CLASS>
Set the message expiration timer for a thread.
synchronousClient
fun setExpiration(recipient: Recipient, expiration: Int): SendResponse
Set the message expiration timer for a thread.
setProfile
Link copied to clipboard
js
suspend fun setProfile(name: String, avatarFile: String?, about: String?, emoji: String?, mobileCoinAddress: String?)
Sets the profile of the current account.
synchronousClient
fun setProfile(name: String, avatarFile: String?, about: String?, emoji: String?, mobileCoinAddress: String?)
Sets the profile of the current account.
subscribe
Link copied to clipboard
open override fun subscribe(): IncomingMessageSubscription
abstract fun subscribe(): IncomingMessageSubscription
synchronousClient
open override fun subscribe(): Subscription
Receive incoming messages by creating a new, dedicated socket connection.
subscribeAndConsumeBlocking
Link copied to clipboard
synchronousClient
fun subscribeAndConsumeBlocking(messageConsumer: (ClientMessageWrapper) -> Unit)
Subscribes to incoming messages and consumes them on the thread that called this function.
subscribeSuspend
Link copied to clipboard
js
open suspend override fun subscribeSuspend(): Subscription
Receive incoming messages by creating a new, dedicated socket connection.
open suspend override fun subscribeSuspend(): IncomingMessageSubscription
abstract suspend fun subscribeSuspend(): IncomingMessageSubscription
trust
Link copied to clipboard
js
suspend fun trust(address: <ERROR CLASS>, fingerprint: Fingerprint, trustLevel: TrustLevel = TrustLevel.TRUSTED_VERIFIED)
Trust another user's safety number using either the QR code data or the safety number text
synchronousClient
fun trust(address: JsonAddress, fingerprint: Fingerprint, trustLevel: TrustLevel = TrustLevel.TRUSTED_VERIFIED)
Trust another user's safety number using either the QR code data or the safety number text
typing
Link copied to clipboard
js
suspend fun typing(recipient: Recipient, isTyping: Boolean, when: Long = Clock.System.now().toEpochMilliseconds())
Send a typing started or stopped message
synchronousClient
fun typing(recipient: Recipient, isTyping: Boolean, when: Long = Clock.System.now().toEpochMilliseconds())
Send a typing started or stopped message
updateContact
Link copied to clipboard
js
suspend fun updateContact(address: <ERROR CLASS>, name: String? = null, color: String? = null, inboxPosition: Int? = null)
Update information about a local contact.
synchronousClient
fun updateContact(address: JsonAddress, name: String? = null, color: String? = null, inboxPosition: Int? = null)
Update information about a local contact.
updateGroup
Link copied to clipboard
js
suspend fun updateGroup(groupID: String, groupUpdate: GroupUpdate): <ERROR CLASS>
Update information about a group
synchronousClient
fun updateGroup(groupID: String, groupUpdate: GroupUpdate): GroupInfo
Update information about a group
verify
Link copied to clipboard
js
suspend fun verify(code: String)
Verify an account's phone number with a code after registering, completing the account creation process.
synchronousClient
fun verify(code: String)
Verify an account's phone number with a code after registering, completing the account creation process.
version
Link copied to clipboard
js
suspend fun version(): <ERROR CLASS>
Gets the version of signald
synchronousClient
fun version(): JsonVersionMessage
Gets the version of signald

Properties

accountId
Link copied to clipboard
val accountId: String
val accountId: String
The ID of account corresponding to the signald account to use.
val accountId: String
The ID of account corresponding to the signald account to use.
accountInfo
Link copied to clipboard
synchronousClient
var accountInfo: Account?
The account info for the specified accountId.
isRegisteredWithSignald
Link copied to clipboard
synchronousClient
val isRegisteredWithSignald: Boolean
Whether the accountId of this Signal instance is registered with signald.