SignalClient

public class SignalClient

Interface for the Signal server. The signal server handles the exchange of encrypted messages and the brokering of public keys.

  • Create a new identity key and create or replace the Signal server account. Note that any existing devices asssociated with your account will be purged as a result of this action. This should only be used for new accounts or when you need to start over.

    Declaration

    Swift

    public func registerAccount(deviceLabel: String) -> Promise<Void>

    Parameters

    deviceLabel

    The public device name to store in the Signal server

    Return Value

    A Promise to indicate completion or an error condition

  • Register a new device with an existing Signal server account. This uses Forsta’s autoprovisioning procedure to safely transfer the private key information from a user’s existing device to this new one.

    Declaration

    Swift

    public func registerDevice(deviceLabel: String) -> AutoprovisionTask

    Parameters

    deviceLabel

    This device’s public name to store in the Signal server.

    Return Value

    An AutoprovisionTask that the caller can then wait to .complete (a Promise<Void>), or optionally .cancel().

  • Respond positively to a provision request from a new foreign device. WARNING: This will deliver your private identity key to the requesting device!

    Declaration

    Swift

    public func linkDevice(uuidString: String, ephemeralPublicKey: Data, userAgent: String = "LibRelaySwift") -> Promise<Bool>

    Parameters

    uuidString

    the UUID (string-encoded) provided for provisioning

    ephemeralPublicKey

    the ephemeral public key (33 bytes) provided by the new device

    userAgent

    our own user agent string

    Return Value

    A Promise<Bool> that resolves upon completion. (A resolution of true means our information was used; false means another device handled it first.)

  • Delete a device associated with the current Signal server account.

    Declaration

    Swift

    public func deleteDevice(deviceId: UInt32) -> Promise<Void>
  • Download an attachment (uses an AttachmentInfo .id for retrieval and .key for decryption)

    Declaration

    Swift

    public func downloadAttachment(_ attachmentInfo: AttachmentInfo) -> Promise<Data>
  • Upload an attachment (returns an AttachmentInfo with .id for later retrieval and .key for decryption)

    Declaration

    Swift

    public func uploadAttachment(data: Data, name: String, type: String, mtime: Date) -> Promise<AttachmentInfo>
  • Undocumented

    Declaration

    Swift

    public func registerForPushNotifications(pushToken: String, voipToken: String = "") -> Promise<Void>