Added seatest to package.json

This commit is contained in:
mhelander 2017-10-16 20:37:15 +03:00
parent 4fb5b64596
commit 4e46e5e4c4
3 changed files with 24 additions and 3 deletions

View File

@ -68,8 +68,28 @@
</div>
<script src="/jquery.js"></script>
<script src="/gun.js"></script>
<!--
<script src="/gun/lib/cryptomodules.js" type="text/javascript"></script>
<script src="/gun/sea.js"></script>
-->
<script>
var gun = Gun(location.origin+'/gun');
var user = gun.user && gun.user();
if(user){
// 1st: call create. 2nd call auth. After that, call recall
// user.create('dude', 'my secret').then(function(ack) { console.log('created ack:', ack) });
// user.recall().then(function(ack){
// if (!ack || !ack.sea){
// console.log('user.recall not bootstrapping...');
// user.auth('dude', 'my secret', {pin: 'PIN'}).then(function(user) { console.log('authenticated user:', user) });
// // user.auth('dude', 'my secret', {pin: 'PIN', newpass: 'my new secret'}).then(function(user) { console.log('authenticated user:', user) });
// } else {
// // gun.get('pub/' + ack.pub).put({ hello: 'world' });
// gun.get('pub/' + ack.pub).get('hello').val((val, key) => console.log('READ:', val, key));
// console.log('user.recall authenticated user:', ack.alias);
// }
// });
}
var chat = gun.get('converse');
chat.map().val(function(msg, field){
var ul = $('ul'), last = sort(field, ul.children('li').last()), li;

View File

@ -8,6 +8,7 @@
"start": "node examples/http.js 8080",
"prepublish": "npm run unbuild",
"test": "mocha",
"testsea": "mocha test/sea.js",
"e2e": "mocha e2e/distributed.js",
"docker": "hooks/build",
"unbuild": "node lib/unbuild.js && uglifyjs gun.js -o gun.min.js -c -m"

6
sea.js
View File

@ -811,13 +811,13 @@
};
each.pubs = function(val, key, node, soul){
if(!val){ return on.to('end', {err: "Alias must exist!"}) } // data MUST exist
if(key === Gun.val.rel.is(val)){ return check['pubs'+soul+key] = 0 } // and the ID must be EXACTLY equal to its property
if(key === Gun.val.rel.is(val)){ return (check['pubs'+soul+key] = 0) } // and the ID must be EXACTLY equal to its property
return on.to('end', {err: "Alias must match!"}); // that way nobody can tamper with the list of public keys.
};
each.pub = function(val, key, node, soul, pub){
//console.log("WE ARE HERE", key, val, soul, node, pub);
if('pub' === key){
if(val === pub){ return check['pub'+soul+key] = 0 } // the account MUST have a `pub` property that equals the ID of the public key.
if(val === pub){ return (check['pub'+soul+key] = 0) } // the account MUST have a `pub` property that equals the ID of the public key.
return on.to('end', {err: "Account must match!"});
}
/*
@ -859,7 +859,7 @@
console.log('NO!', each.err);
return;
}
if(Gun.obj.map(check, function(no){
if(Gun.obj.map(check, function(no, key){
if(no){ return true }
})){ return }
to.next(msg);