Display the public key using a href in the settings page

pull/1/head
yflory 8 years ago
parent 50d9f72b3a
commit 57979f6314

@ -34,6 +34,9 @@ define([
var getFileHashFromKeys = Hash.getFileHashFromKeys = function (fileKey, cryptKey) {
return '/1/' + hexToBase64(fileKey) + '/' + Crypto.b64RemoveSlashes(cryptKey) + '/';
};
var getUserHrefFromKeys = Hash.getUserHrefFromKeys = function (username, pubkey) {
return window.location.origin + '/user/#/1/' + username + '/' + pubkey.replace(/\//g, '-');
};
var fixDuplicateSlashes = function (s) {
return s.replace(/\/+/g, '/');
@ -188,6 +191,9 @@ Version 1
// version 2 hashes are to be used for encrypted blobs
secret.channel = parsed.channel;
secret.keys = { fileKeyStr: parsed.key };
} else if (parsed.type === "user") {
// version 2 hashes are to be used for encrypted blobs
throw new Error("User hashes can't be opened (yet)");
}
}
}

@ -85,6 +85,7 @@ define([
common.getEditHashFromKeys = Hash.getEditHashFromKeys;
common.getViewHashFromKeys = Hash.getViewHashFromKeys;
common.getFileHashFromKeys = Hash.getFileHashFromKeys;
common.getUserHrefFromKeys = Hash.getUserHrefFromKeys;
common.getSecrets = Hash.getSecrets;
common.getHashes = Hash.getHashes;
common.createChannelId = Hash.createChannelId;

@ -49,13 +49,14 @@ define([
var publicKey = obj.edPublic;
if (publicKey) {
var userHref = Cryptpad.getUserHrefFromKeys(accountName, publicKey);
var $pubLabel = $('<span>', {'class': 'label'})
.text(Messages.settings_publicSigningKey + ':');
var $pubKey = $('<input>', {type: 'text', readonly: true})
.css({
width: '28em'
})
.val(publicKey);
.val(userHref);
$div.append('<br>').append($pubLabel).append($pubKey);
}

Loading…
Cancel
Save