SignalClient

SignalClient

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

Constructor

new SignalClient()

Source:

Methods

(async, static) factory()

Source:
Return a default instance.

(async) fetch(urn, optionsopt) → {*}

Source:
Authenticated fetch to the signal service.
Parameters:
Name Type Attributes Description
urn string
options Object <optional>
Returns:
- Data response from service.
Type
*

(async) getAttachment(id) → {Buffer}

Source:
Download an encrypted attachment.
Parameters:
Name Type Description
id string The remote ID to fetch.
Returns:
- The encrypted attachment.
Type
Buffer

(async) getDevices() → {Array}

Source:
Fetch the current list of known devices associated with your account.
Returns:
- Array of device info objects.
Type
Array

(async) getKeysForAddr(addr, deviceId) → {Object}

Source:
Get a public prekey and signed prekey for a peer.
Parameters:
Name Type Description
addr string
deviceId number
Returns:
- Key material object.
Type
Object

(async) linkDevice(uuid, pubKey, optionsopt)

Source:
Respond positively to a provision request from a new foreign device. WARNING: This will send your private identity key to the requesting device!
Parameters:
Name Type Attributes Description
uuid string UUID param provided by the foreign device.
pubKey string Ephemeral public key used for provisioning.
options Object <optional>
Properties
Name Type Attributes Description
userAgent string <optional>

(async) putAttachment(body) → {string}

Source:
Upload an encrypted attachment.
Parameters:
Name Type Description
body Buffer Encrypted attachment data.
Returns:
- The ID for this remote attachment.
Type
string

(async) refreshPreKeys(minLevelopt, fillopt)

Source:
Generate a new signed prekey and pool of prekeys if needed. If new keys are generated they are uploaded to the signal service so they can be used for new incoming messages.
Parameters:
Name Type Attributes Default Description
minLevel number <optional>
10 If less then this many keys are available then generate new keys.
fill number <optional>
100 The number of new keys to generate when needed.

(async) sendMessage(addr, deviceId, message)

Source:
Transmit a single encrytped message to the signal service. Use this when sending a message to just 1 peer device.
Parameters:
Name Type Description
addr string
deviceId number
message Object Encrypted message

(async) sendMessages(destination, messages, timestamp)

Source:
Transmit encrypted messages to the signal service.
Parameters:
Name Type Description
destination string Address of peer
messages Array Array of encrypted messages
timestamp number Official timestamp for these messages.

(async) updateGcmRegistrationId(gcmRegistrationId)

Source:
The GCM reg ID configures the data needed to wake us up using google cloud messaging service. No data other than a "wakeup" is sent through this service.
Parameters:
Name Type Description
gcmRegistrationId string