Move the 'signing key' code for BAR into common-hash
parent
0f81f96259
commit
476d968660
|
@ -28,6 +28,13 @@ var factory = function (Util, Crypto, Keys, Nacl) {
|
|||
};
|
||||
};
|
||||
|
||||
Hash.getSignPublicFromPrivate = function (edPrivateSafeStr) {
|
||||
var edPrivateStr = Crypto.b64AddSlashes(edPrivateSafeStr);
|
||||
var privateKey = Nacl.util.decodeBase64(edPrivateStr);
|
||||
var keyPair = Nacl.sign.keyPair.fromSecretKey(privateKey);
|
||||
return Nacl.util.encodeBase64(keyPair.publicKey);
|
||||
};
|
||||
|
||||
var getEditHashFromKeys = Hash.getEditHashFromKeys = function (secret) {
|
||||
var version = secret.version;
|
||||
var data = secret.keys;
|
||||
|
|
|
@ -384,10 +384,7 @@ define([
|
|||
|
||||
// This is a burn after reading URL: make sure our owner key is still valid
|
||||
try {
|
||||
var nacl = window.nacl;
|
||||
var key = nacl.util.decodeBase64(Crypto.b64AddSlashes(burnAfterReading));
|
||||
var kp = nacl.sign.keyPair.fromSecretKey(key);
|
||||
var publicKey = nacl.util.encodeBase64(kp.publicKey);
|
||||
var publicKey = Utils.Hash.getSignPublicFromPrivate(burnAfterReading);
|
||||
Cryptpad.getPadMetadata({
|
||||
channel: secret.channel
|
||||
}, waitFor(function (md) {
|
||||
|
|
Loading…
Reference in New Issue