prepare stubbed proof of block ownership

pull/1/head
ansuz 4 years ago
parent 8896391536
commit 0124e2c3f4

@ -416,7 +416,7 @@ define([
});
};
common.writeLoginBlock = function (data, cb) { // XXX restricted-registration
common.writeLoginBlock = function (data, cb) {
postMessage('WRITE_LOGIN_BLOCK', data, function (obj) {
cb(obj);
});
@ -1746,7 +1746,7 @@ define([
});
});
};
common.changeUserPassword = function (Crypt, edPublic, data, cb) { // XXX restricted-registration
common.changeUserPassword = function (Crypt, edPublic, data, cb) {
if (!edPublic) {
return void cb({
error: 'E_NOT_LOGGED_IN'
@ -1855,6 +1855,9 @@ define([
};
var content = Block.serialize(JSON.stringify(temp), blockKeys);
console.error("OLD AND NEW BLOCK KEYS", oldBlockKeys, blockKeys);
// XXX ignored unless restricted registration is active?
// content.registrationProof = Block.proveAncestor();
console.log("writing new login block");
common.writeLoginBlock(content, waitFor(function (obj) {

@ -86,6 +86,30 @@ define([
};
};
Block.proveAncestor = function (O /* oldBlockKeys */, N /* newBlockKeys */) {
N = N;
/*
var registrationProof;
var registrationSig;
if (keys.previous) {
// XXX restricted-registration
// sign the publicKey of the new key with the old key
// your existing block's publicKey
// the new block's publicKey
// some proof of recency to prevent replays?
// a signature of the whole thing
// registrationProof = [oldPublicKey, newPublicKey];
// registrationSig = sign(registrationProof, oldPrivateKey);
}
*/
// needed for password change with restricted registration
//registrationProof: registrationProof? Nacl.util.encodeBase64(registrationProof): undefined,
//registrationSig: registrationSig? Nacl.util.encode
};
Block.remove = function (keys) {
// sign the hash of the text 'DELETE_BLOCK'
var sig = Nacl.sign.detached(Nacl.hash(

Loading…
Cancel
Save