Skip to content

Commit

Permalink
stop the crackers!
Browse files Browse the repository at this point in the history
  • Loading branch information
amark committed Oct 23, 2017
1 parent 2879bb9 commit b859bfb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"devDependencies": {
"spark-md5": "^3.0.0",
"@std/esm": "^0.8.3",
"@trust/webcrypto": "^0.5.0",
"@trust/webcrypto": "^0.7.1",
"buffer": "^5.0.7",
"express": ">=4.15.2",
"fake-indexeddb": "^2.0.3",
Expand Down
3 changes: 2 additions & 1 deletion sea.js
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@
// next up, we want to associate the alias with the public key. So we add it to the alias list.
root.get('alias/'+alias).put(Gun.obj.put({}, tmp, Gun.val.rel.ify(tmp)));
// callback that the user has been created. (Note: ok = 0 because we didn't wait for disk to ack)
resolve({ok: 0, pub: pairs.pub});
setTimeout(function(){ resolve({ok: 0, pub: pairs.pub}) },10); // TODO: BUG! If `.auth` happens synchronously after `create` finishes, auth won't work. This setTimeout is a temporary hack until we can properly fix it.
}).catch(function(e){ Gun.log('SEA.en or SEA.write calls failed!'); reject(e) });
}).catch(function(e){ Gun.log('SEA.pair call failed!'); reject(e) });
});
Expand Down Expand Up @@ -637,6 +637,7 @@
delete user._[key];
});
user._.is = user.is = {};
root.user();
resolve({ok: 0});
}).catch(function(e){
Gun.log('User.delete failed! Error:', e);
Expand Down
8 changes: 6 additions & 2 deletions test/panic/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,9 @@ describe("End-to-End Encryption on User Accounts", function(){
gun.get('pub/' + window.PUB).val(function(data){
if(data.pub === window.PUB
&& data.hello === 'mars'
&& data.alias === 'bob'){
&& data.alias === 'bob'
&& data.crackers !== 'gonna crack'
&& undefined === data.crackers){
test.done();
}
});
Expand All @@ -234,7 +236,9 @@ describe("End-to-End Encryption on User Accounts", function(){
test.async();
user.val(function(data){
if(data.hello === 'mars'
&& data.alias === 'bob'){
&& data.alias === 'bob'
&& data.crackers !== 'gonna crack'
&& undefined === data.crackers){
test.done();
}
});
Expand Down

0 comments on commit b859bfb

Please sign in to comment.