Generate and submit registrationId, fixes #25

If we're expecting to get registrationIds from others, it's only fair
that we also supply our own.
This commit is contained in:
lilia 2014-05-13 20:07:31 -07:00
parent 5752a772d1
commit e3b00e08f3
2 changed files with 7 additions and 4 deletions

View file

@ -41,6 +41,8 @@ var single_device = false;
var signaling_key = window.crypto.getRandomBytes(32 + 20);
var password = btoa(getString(window.crypto.getRandomBytes(16)));
password = password.substring(0, password.length - 2);
var registrationId = new Uint16Array(window.crypto.getRandomBytes(2))[0];
registrationId = registrationId & 0x3fff;
$('#init-go-single-client').click(function() {
if (numberMatches()) {
@ -73,7 +75,7 @@ $('#init-go').click(function() {
$('#verify4done').html('');
$('#verify').show();
API.confirmCode($('#code').val(), number, password, signaling_key, single_device,
API.confirmCode($('#code').val(), number, password, signaling_key, registrationId, single_device,
function(response) {
if (single_device)
response = 1;