Document ProvisioningController and ProvisioningConnectListener

This commit is contained in:
Jon Chambers
2024-09-30 10:42:53 -04:00
committed by Jon Chambers
parent 7a6ce00fed
commit 0a1161048f
4 changed files with 80 additions and 8 deletions

View File

@@ -5,7 +5,9 @@
package org.whispersystems.textsecuregcm.websocket;
import org.whispersystems.textsecuregcm.auth.AuthenticatedDevice;
import org.whispersystems.textsecuregcm.entities.MessageProtos;
import org.whispersystems.textsecuregcm.entities.ProvisioningMessage;
import org.whispersystems.textsecuregcm.push.ProvisioningManager;
import org.whispersystems.textsecuregcm.storage.PubSubProtos;
import org.whispersystems.textsecuregcm.util.HeaderUtils;
@@ -14,6 +16,20 @@ import org.whispersystems.websocket.setup.WebSocketConnectListener;
import java.util.List;
import java.util.Optional;
/**
* A "provisioning WebSocket" provides a mechanism for sending a caller-defined provisioning message from the primary
* device associated with a Signal account to a new device that is not yet associated with a Signal account. Generally,
* the message contains key material and credentials the new device needs to associate itself with the primary device's
* Signal account.
* <p>
* New devices initiate the provisioning process by opening a provisioning WebSocket. The server assigns the new device
* a random, temporary "provisioning address," which it transmits via the newly-opened WebSocket. From there, the new
* device generally displays the provisioning address (and a public key) as a QR code. After that, the primary device
* will scan the QR code and send an encrypted provisioning message to the new device via
* {@link org.whispersystems.textsecuregcm.controllers.ProvisioningController#sendProvisioningMessage(AuthenticatedDevice, String, ProvisioningMessage, String)}.
* Once the server receives the message from the primary device, it sends the message to the new device via the open
* WebSocket, then closes the WebSocket connection.
*/
public class ProvisioningConnectListener implements WebSocketConnectListener {
private final ProvisioningManager provisioningManager;