Show 3 last mnemonic representation of public key instead of public key during pairing

pull/466/head
sachaaaaa 6 years ago
parent 831ae09576
commit e50a29ffa5

@ -258,8 +258,8 @@
<!-- Request Received --> <!-- Request Received -->
<div class="requestReceivedView" style="display: none;"> <div class="requestReceivedView" style="display: none;">
<h4>{{ requestReceivedTitle }}</h4> <h4>{{ requestReceivedTitle }}</h4>
Please verify that the pubkey shown here is your secondary device pubkey! Please verify that the secret words shown below matches the ones on your other device!
<p class="secondaryPubKey"></p> <p class="secretWords"></p>
<div class='buttons'> <div class='buttons'>
<button class="skip">{{ skipText }}</button> <button class="skip">{{ skipText }}</button>
<button id="allowPairing">{{ allowPairingText }}</button> <button id="allowPairing">{{ allowPairingText }}</button>
@ -270,7 +270,7 @@
<div class="requestAcceptedView" style="display: none;"> <div class="requestAcceptedView" style="display: none;">
<h4>{{ requestAcceptedTitle }}</h4> <h4>{{ requestAcceptedTitle }}</h4>
Sending pairing authorisation to: Sending pairing authorisation to:
<p class="secondaryPubKey"></p> <p class="secretWords"></p>
<p class="transmissionStatus">Please be patient...</p> <p class="transmissionStatus">Please be patient...</p>
<div class='buttons'> <div class='buttons'>
<button class="ok" style="display: none;">{{ okText }}</button> <button class="ok" style="display: none;">{{ okText }}</button>

@ -12,6 +12,7 @@
initialize() { initialize() {
this.pubKeyRequests = []; this.pubKeyRequests = [];
this.pubKey = null; this.pubKey = null;
this.secretWords = null;
this.accepted = false; this.accepted = false;
this.view = ''; this.view = '';
this.render(); this.render();
@ -64,6 +65,10 @@
nextPubKey() { nextPubKey() {
// FIFO: pop at the back of the array using pop() // FIFO: pop at the back of the array using pop()
this.pubKey = this.pubKeyRequests.pop(); this.pubKey = this.pubKeyRequests.pop();
this.secretWords = window.mnemonic.mn_encode(this.pubKey.slice(2), 'english')
.split(' ')
.slice(-3)
.join(' ');
}, },
showView() { showView() {
const waitingForRequestView = this.$('.waitingForRequestView'); const waitingForRequestView = this.$('.waitingForRequestView');
@ -74,7 +79,7 @@
waitingForRequestView.hide(); waitingForRequestView.hide();
requestAcceptedView.show(); requestAcceptedView.show();
} else if (this.pubKey) { } else if (this.pubKey) {
this.$('.secondaryPubKey').text(this.pubKey); this.$('.secretWords').text(this.secretWords);
requestReceivedView.show(); requestReceivedView.show();
waitingForRequestView.hide(); waitingForRequestView.hide();
requestAcceptedView.hide(); requestAcceptedView.hide();

@ -208,8 +208,13 @@
countDownCallBack(); countDownCallBack();
this.pairingInterval = setInterval(countDownCallBack, 1000); this.pairingInterval = setInterval(countDownCallBack, 1000);
const pubkey = textsecure.storage.user.getNumber(); const pubkey = textsecure.storage.user.getNumber();
const words = window.mnemonic.mn_encode(pubkey.slice(2), 'english')
.split(' ')
.slice(-3)
.join(' ');
this.$('.standalone-secondary-device #pubkey').text( this.$('.standalone-secondary-device #pubkey').text(
`Here is your pubkey:\n${pubkey}` `Here is your secret:\n${words}`
); );
} catch (e) { } catch (e) {
onError(e); onError(e);

Loading…
Cancel
Save