oops ack critical fix!

This commit is contained in:
Mark Nadal 2018-04-13 16:50:54 -07:00
parent 9f0fbaf2eb
commit 44de63dc55
4 changed files with 20 additions and 12 deletions

View File

@ -167,7 +167,7 @@
if(!at.put || !at.put.users){ return }
var no;
Gun.node.is(at.put.users, function(val, key){
Gun.SEA.read(val, false, function(val){
Gun.SEA.verify(val, false, function(val){
//Gun.SEA.read(val, false, function(val){
if('alias/'+key === Gun.val.rel.is(val)){ return }
no = true;

2
gun.js
View File

@ -1281,7 +1281,7 @@
if(typeof cb === 'string'){
as.soul = cb;
} else {
as.ack = cb;
as.ack = as.ack || cb;
}
if(at.soul){
as.soul = at.soul;

18
sea.js
View File

@ -703,6 +703,13 @@
const { epub } = at.put
// TODO: 'salt' needed?
err = null
if(typeof window !== 'undefined'){
var tmp = window.sessionStorage;
if(tmp && gunRoot._.opt.remember){
window.sessionStorage.alias = alias;
window.sessionStorage.tmp = pass;
}
}
return Object.assign(props, { priv, salt, epub, epriv })
} catch (e) {
err = 'Failed to decrypt secret!'
@ -821,13 +828,6 @@
// persist authentication
//await authPersist(user._, key.proof, opts) // temporarily disabled
// emit an auth event, useful for page redirects and stuff.
if(typeof window !== 'undefined'){
var tmp = window.sessionStorage;
if(tmp && gunRoot._.opt.remember){
window.sessionStorage.alias = alias;
window.sessionStorage.tmp = key;
}
}
try {
gunRoot._.on('auth', user._)
} catch (e) {
@ -1141,8 +1141,8 @@
const salt = Gun.text.random(64);
const encSigAuth = await SEA.work(newpass, salt)
.then((key) =>
SEA.encrypt({ priv, epriv }, { pub, key, set: true })
.then((auth) => SEA.sign({ salt, auth }, keys))
SEA.encrypt({ priv, epriv }, key)
.then((auth) => SEA.sign({ek: auth, s: salt}, keys))
)
const signedEpub = await SEA.sign(epub, keys)
const signedAlias = await SEA.sign(alias, keys)

View File

@ -3784,10 +3784,18 @@ describe('Gun', function(){
//console.log("put", put);
//console.log("------", turns, "-------");
//3 === turns && (console.debug.i = 1);
console.debug(1, 'save', {history: put});
//console.debug(1, 'save', {history: put});
gun.put({history: put});
}, 1);
});
it('Check put callback', function(done){
var gun = Gun();
gun.get('c/p/c').get('a').put('lol', function(ack){
done();
});
});
return;
it('Nested listener should be called', function(done){