Update to real server provisioning API
This commit is contained in:
parent
c112c59ce6
commit
29b2ffc769
5 changed files with 18 additions and 26 deletions
|
@ -5674,6 +5674,7 @@ CryptoJS.lib.Cipher || (function (undefined) {
|
|||
PushMessageContent : pushMessages.PushMessageContent,
|
||||
WhisperMessage : protocolMessages.WhisperMessage,
|
||||
PreKeyWhisperMessage : protocolMessages.PreKeyWhisperMessage,
|
||||
ProvisioningUuid : deviceMessages.ProvisioningUuid,
|
||||
DeviceInit : deviceMessages.DeviceInit,
|
||||
IdentityKey : deviceMessages.IdentityKey,
|
||||
DeviceControl : deviceMessages.DeviceControl,
|
||||
|
@ -6739,7 +6740,7 @@ window.textsecure.api = function () {
|
|||
URL_CALLS.devices = "/v1/devices";
|
||||
URL_CALLS.keys = "/v2/keys";
|
||||
URL_CALLS.push = "/v1/websocket";
|
||||
URL_CALLS.temp_push = "/v1/temp_websocket";
|
||||
URL_CALLS.temp_push = "/v1/provisioning";
|
||||
URL_CALLS.messages = "/v1/messages";
|
||||
URL_CALLS.attachment = "/v1/attachments";
|
||||
|
||||
|
@ -7023,13 +7024,7 @@ window.textsecure.api = function () {
|
|||
}
|
||||
|
||||
self.getTempWebsocket = function() {
|
||||
//XXX
|
||||
var socketWrapper = { onmessage: function() {}, ondisconnect: function() {}, onconnect: function() {} };
|
||||
setTimeout(function() {
|
||||
socketWrapper.onmessage({uuid: "404-42-magic"});
|
||||
}, 1000);
|
||||
return socketWrapper;
|
||||
//return getWebsocket(URL_CALLS['temp_push'], false, 5000);
|
||||
return getWebsocket(URL_CALLS['temp_push'], false, 1000);
|
||||
}
|
||||
|
||||
return self;
|
||||
|
|
|
@ -137,16 +137,18 @@
|
|||
$('#setup-qr').html('');
|
||||
textsecure.protocol.prepareTempWebsocket().then(function(cryptoInfo) {
|
||||
var qrCode = new QRCode(document.getElementById('setup-qr'));
|
||||
var socket = textsecure.api.getTempWebsocket();
|
||||
|
||||
socket.onmessage = function(message) {
|
||||
if (message.uuid) {
|
||||
var socket = textsecure.api.getTempWebsocket();
|
||||
new WebSocketResource(socket, function(request) {
|
||||
if (request.path == "/v1/address" && request.verb == "PUT") {
|
||||
var proto = textsecure.protobuf.ProvisioningUuid.decode(request.body);
|
||||
qrCode.makeCode('textsecure-device-init:/' +
|
||||
'?channel_uuid=' + message.uuid +
|
||||
'?channel_uuid=' + proto.uuid +
|
||||
'&channel_server=' + textsecure.api.relay +
|
||||
'&publicKey=' + btoa(getString(cryptoInfo.publicKey)));
|
||||
$('img').removeAttr('style');
|
||||
$('#multi-device .status').text("Use your phone to scan the QR code.")
|
||||
request.respond(200, 'OK');
|
||||
} else {
|
||||
$('#init-setup').hide();
|
||||
$('#verify1done').text('');
|
||||
|
@ -157,7 +159,7 @@
|
|||
$('#verify').show().addClass('in');
|
||||
|
||||
|
||||
textsecure.registerSecondDevice(cryptoInfo, message.message, function(step) {
|
||||
textsecure.registerSecondDevice(message.body, cryptoInfo, function(step) {
|
||||
switch(step) {
|
||||
case 1:
|
||||
$('#verify1done').text('done');
|
||||
|
@ -179,11 +181,7 @@
|
|||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
socket.ondisconnect = function() {
|
||||
$('#multi-device .status').text("The push server disconnected, please wait while we reconnect...");
|
||||
};
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ window.textsecure.api = function () {
|
|||
URL_CALLS.devices = "/v1/devices";
|
||||
URL_CALLS.keys = "/v2/keys";
|
||||
URL_CALLS.push = "/v1/websocket";
|
||||
URL_CALLS.temp_push = "/v1/temp_websocket";
|
||||
URL_CALLS.temp_push = "/v1/provisioning";
|
||||
URL_CALLS.messages = "/v1/messages";
|
||||
URL_CALLS.attachment = "/v1/attachments";
|
||||
|
||||
|
@ -321,13 +321,7 @@ window.textsecure.api = function () {
|
|||
}
|
||||
|
||||
self.getTempWebsocket = function() {
|
||||
//XXX
|
||||
var socketWrapper = { onmessage: function() {}, ondisconnect: function() {}, onconnect: function() {} };
|
||||
setTimeout(function() {
|
||||
socketWrapper.onmessage({uuid: "404-42-magic"});
|
||||
}, 1000);
|
||||
return socketWrapper;
|
||||
//return getWebsocket(URL_CALLS['temp_push'], false, 5000);
|
||||
return getWebsocket(URL_CALLS['temp_push'], false, 1000);
|
||||
}
|
||||
|
||||
return self;
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
PushMessageContent : pushMessages.PushMessageContent,
|
||||
WhisperMessage : protocolMessages.WhisperMessage,
|
||||
PreKeyWhisperMessage : protocolMessages.PreKeyWhisperMessage,
|
||||
ProvisioningUuid : deviceMessages.ProvisioningUuid,
|
||||
DeviceInit : deviceMessages.DeviceInit,
|
||||
IdentityKey : deviceMessages.IdentityKey,
|
||||
DeviceControl : deviceMessages.DeviceControl,
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
package textsecure;
|
||||
|
||||
message ProvisioningUuid {
|
||||
optional string uuid = 1;
|
||||
}
|
||||
|
||||
message DeviceInit {
|
||||
required bytes masterEphemeralPubKey = 1;
|
||||
required bytes identityKeyMessage = 2; // contains an IdentityKey
|
||||
|
|
Loading…
Reference in a new issue