Merge pull request #598 from sachaaaaa/secret_words_on_primary_device

[multi-device]show pairing words on paired device list
pull/600/head
sachaaaaa 6 years ago committed by GitHub
commit d350e4adfb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -99,7 +99,8 @@
if (pubKeys && pubKeys.length > 0) {
this.$('#pairedPubKeys').empty();
pubKeys.forEach(x => {
this.$('#pairedPubKeys').append(`<li>${x}</li>`);
const secretWords = window.mnemonic.pubkey_to_secret_words(x);
this.$('#pairedPubKeys').append(`<li>(${secretWords})</li>`);
});
}
} else if (this.accepted) {
@ -108,11 +109,7 @@
waitingForRequestView.hide();
requestAcceptedView.show();
} else if (this.pubKey) {
const secretWords = window.mnemonic
.mn_encode(this.pubKey.slice(2), 'english')
.split(' ')
.slice(-3)
.join(' ');
const secretWords = window.mnemonic.pubkey_to_secret_words(this.pubKey);
this.$('.secretWords').text(secretWords);
requestReceivedView.show();
waitingForRequestView.hide();

@ -268,11 +268,7 @@
);
await this.accountManager.requestPairing(primaryPubKey);
const pubkey = textsecure.storage.user.getNumber();
const words = window.mnemonic
.mn_encode(pubkey.slice(2), 'english')
.split(' ')
.slice(-3)
.join(' ');
const words = window.mnemonic.pubkey_to_secret_words(pubkey);
this.$('.standalone-secondary-device #pubkey').text(
`Here is your secret:\n${words}`

@ -6,6 +6,7 @@ module.exports = {
mn_decode,
sc_reduce32,
get_languages,
pubkey_to_secret_words,
};
class MnemonicError extends Error {}
@ -190,3 +191,10 @@ for (var i in mn_words) {
}
}
}
function pubkey_to_secret_words(pubKey) {
return mn_encode(pubKey.slice(2), 'english')
.split(' ')
.slice(-3)
.join(' ');
}

Loading…
Cancel
Save