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

This commit is contained in:
sachaaaaa 2019-09-02 16:33:19 +10:00
parent 831ae09576
commit e50a29ffa5
3 changed files with 15 additions and 5 deletions

View file

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

View file

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

View file

@ -208,8 +208,13 @@
countDownCallBack();
this.pairingInterval = setInterval(countDownCallBack, 1000);
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(
`Here is your pubkey:\n${pubkey}`
`Here is your secret:\n${words}`
);
} catch (e) {
onError(e);