mirror of
https://github.com/amark/gun.git
synced 2025-03-30 15:08:33 +00:00
This commit is contained in:
commit
6fd0e88dd5
43
README.md
43
README.md
@ -1,4 +1,4 @@
|
||||
<p><a href="https://gun.eco/"><img width="40%" src="https://cldup.com/TEy9yGh45l.svg"/></a><img width="50%" align="right" vspace="25" src="https://gun.eco/see/demo.gif"/></p>
|
||||
<p><a href="https://gun.eco/"><img width="40%" src="https://cldup.com/TEy9yGh45l.svg"/></a><img width="50%" align="right" vspace="25" src="https://gun.eco/see/demo.gif"/></p>
|
||||
|
||||
[](https://www.npmjs.com/package/gun)
|
||||
[](https://travis-ci.org/amark/gun)
|
||||
@ -100,16 +100,16 @@ On that note, let's get some official shout outs covered first:
|
||||
|
||||
<p align="center">
|
||||
Thanks to:<br/>
|
||||
<a href="https://github.com/robertheessels">Robert Heessels</a>,
|
||||
<a href="http://qxip.net/">Lorenzo Mangani</a>,
|
||||
<a href="https://nlnet.nl/">NLnet Foundation</a>,
|
||||
<a href="http://github.com/samliu">Sam Liu</a>,
|
||||
<a href="http://github.com/ddombrow">Daniel Dombrowsky</a>,
|
||||
<a href="http://github.com/vincentwoo">Vincent Woo</a>,
|
||||
<a href="http://github.com/coolaj86">AJ ONeal</a>,
|
||||
<a href="https://github.com/robertheessels">Robert Heessels</a>,
|
||||
<a href="http://qxip.net/">Lorenzo Mangani</a>,
|
||||
<a href="https://nlnet.nl/">NLnet Foundation</a>,
|
||||
<a href="http://github.com/samliu">Sam Liu</a>,
|
||||
<a href="http://github.com/ddombrow">Daniel Dombrowsky</a>,
|
||||
<a href="http://github.com/vincentwoo">Vincent Woo</a>,
|
||||
<a href="http://github.com/coolaj86">AJ ONeal</a>,
|
||||
<a href="http://github.com/ottman">Bill Ottman</a>,
|
||||
<a href="http://github.com/mikewlange">Mike Lange</a>,
|
||||
<a href="http://github.com/ctrlplusb">Sean Matheson</a>,
|
||||
<a href="http://github.com/mikewlange">Mike Lange</a>,
|
||||
<a href="http://github.com/ctrlplusb">Sean Matheson</a>,
|
||||
<a href="http://github.com/alanmimms">Alan Mimms</a>,
|
||||
<a href="https://github.com/dfreire">Dário Freire</a>,
|
||||
<a href="http://github.com/velua">John Williamson</a>
|
||||
@ -122,7 +122,7 @@ Thanks to:<br/>
|
||||
|
||||
### History
|
||||
|
||||
[GUN](https://gun.eco) was created by [Mark Nadal](https://twitter.com/marknadal) in 2014 after he had spent 4 years trying to get his collaborative web app to scale up with traditional databases.
|
||||
[GUN](https://gun.eco) was created by [Mark Nadal](https://twitter.com/marknadal) in 2014 after he had spent 4 years trying to get his collaborative web app to scale up with traditional databases.
|
||||
|
||||
<img width="250px" src="https://gun.eco/see/problem.png" align="left" title="pain point" style="margin: 0 1em 1em 0"> After he realized [Master-Slave database architecture causes one big bottleneck](https://gun.eco/distributed/matters.html), he (as a complete newbie outsider) naively decided **to question the status quo** and shake things up with controversial, heretical, and contrarian experiments:
|
||||
|
||||
@ -178,6 +178,27 @@ Tests may be run with `npm test`. Tests will trigger persistent writes to the DB
|
||||
rm -rf *data*
|
||||
```
|
||||
|
||||
### Additional Cryptography Libraries
|
||||
|
||||
To install with npm, first install `npm install gun -S`.
|
||||
For just the networking layer, import Gun:
|
||||
|
||||
```javascript
|
||||
var Gun = require('gun/gun');
|
||||
```
|
||||
|
||||
If you also need to install SEA for user auth and crypto, also install some of its dependencies like this:
|
||||
|
||||
`npm install @trust/crypto text-encoding node-webcrypto-ossl --save`
|
||||
|
||||
You will need to require it too (it will be automatically added to the Gun object):
|
||||
|
||||
```javascript
|
||||
var Gun = require('gun/gun');
|
||||
var Sea = require('gun/sea');
|
||||
```
|
||||
|
||||
|
||||
## Deploy
|
||||
|
||||
To quickly spin up a Gun test server for your development team, utilize either [Heroku](http://heroku.com) or [Docker](http://docker.com) or any variant thereof [Dokku](http://dokku.viewdocs.io/dokku/), [Flynn.io](http://flynn.io), [now.sh](https://zeit.co/now), etc. !
|
||||
|
@ -12,6 +12,7 @@
|
||||
require('./store');
|
||||
require('./rs3');
|
||||
require('./wire');
|
||||
try{require('../sea');}catch(e){}
|
||||
//try{require('../axe');}catch(e){}
|
||||
require('./file');
|
||||
require('./evict');
|
||||
|
@ -48,19 +48,19 @@
|
||||
"node": ">=0.8.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"@trust/webcrypto": "^0.9.2",
|
||||
"text-encoding": "^0.6.4",
|
||||
"node-webcrypto-ossl": "^1.0.38",
|
||||
"ws": "~>5.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@trust/webcrypto": "^0.9.2",
|
||||
"aws-sdk": ">=2.153.0",
|
||||
"concat-map": "^0.0.1",
|
||||
"express": ">=4.15.2",
|
||||
"ip": "^1.1.5",
|
||||
"mocha": ">=3.2.0",
|
||||
"node-webcrypto-ossl": "^1.0.38",
|
||||
"panic-manager": "^1.2.0",
|
||||
"panic-server": "^1.1.1",
|
||||
"text-encoding": "^0.6.4",
|
||||
"uglify-js": ">=2.8.22"
|
||||
}
|
||||
}
|
||||
|
9
sea.js
9
sea.js
@ -301,6 +301,7 @@
|
||||
return r;
|
||||
} catch(e) {
|
||||
SEA.err = e;
|
||||
if(SEA.throw){ throw e }
|
||||
if(cb){ cb() }
|
||||
return;
|
||||
}});
|
||||
@ -320,6 +321,7 @@
|
||||
} catch(e) {
|
||||
console.log(e);
|
||||
SEA.err = e;
|
||||
if(SEA.throw){ throw e }
|
||||
if(cb){ cb() }
|
||||
return;
|
||||
}});
|
||||
@ -374,6 +376,7 @@
|
||||
} catch(e) {
|
||||
console.log(e);
|
||||
SEA.err = e;
|
||||
if(SEA.throw){ throw e }
|
||||
if(cb){ cb() }
|
||||
return;
|
||||
}});
|
||||
@ -386,6 +389,7 @@
|
||||
var shim = USE('./shim');
|
||||
var S = USE('./settings');
|
||||
var sha256hash = USE('./sha256');
|
||||
var u;
|
||||
|
||||
SEA.sign = SEA.sign || (async (data, pair, cb, opt) => { try {
|
||||
if(data && data.slice
|
||||
@ -415,6 +419,7 @@
|
||||
} catch(e) {
|
||||
console.log(e);
|
||||
SEA.err = e;
|
||||
if(SEA.throw){ throw e }
|
||||
if(cb){ cb() }
|
||||
return;
|
||||
}});
|
||||
@ -456,6 +461,7 @@
|
||||
} catch(e) {
|
||||
console.log(e); // mismatched owner FOR MARTTI
|
||||
SEA.err = e;
|
||||
if(SEA.throw){ throw e }
|
||||
if(cb){ cb() }
|
||||
return;
|
||||
}});
|
||||
@ -506,6 +512,7 @@
|
||||
return r;
|
||||
} catch(e) {
|
||||
SEA.err = e;
|
||||
if(SEA.throw){ throw e }
|
||||
if(cb){ cb() }
|
||||
return;
|
||||
}});
|
||||
@ -537,6 +544,7 @@
|
||||
return r;
|
||||
} catch(e) {
|
||||
SEA.err = e;
|
||||
if(SEA.throw){ throw e }
|
||||
if(cb){ cb() }
|
||||
return;
|
||||
}});
|
||||
@ -575,6 +583,7 @@
|
||||
return r;
|
||||
} catch(e) {
|
||||
SEA.err = e;
|
||||
if(SEA.throw){ throw e }
|
||||
if(cb){ cb() }
|
||||
return;
|
||||
}});
|
||||
|
61
test/sea/sea2.js
Normal file
61
test/sea/sea2.js
Normal file
@ -0,0 +1,61 @@
|
||||
/* global Gun,describe,expect,it,beforeEach */
|
||||
/*eslint max-len: ["error", 95, { "ignoreComments": true }]*/
|
||||
/*eslint semi: ["error", "always", { "omitLastInOneLineBlock": true}]*/
|
||||
/*eslint object-curly-spacing: ["error", "never"]*/
|
||||
/*eslint node/no-deprecated-api: [error, {ignoreModuleItems: ["new buffer.Buffer()"]}] */
|
||||
|
||||
var root;
|
||||
var Gun;
|
||||
(function(env){
|
||||
root = env.window ? env.window : global;
|
||||
env.window && root.localStorage && root.localStorage.clear();
|
||||
try{ require('fs').unlinkSync('data.json') }catch(e){}
|
||||
//root.Gun = root.Gun || require('../gun');
|
||||
if(root.Gun){
|
||||
//Gun = root.Gun = root.Gun;
|
||||
} else {
|
||||
var expect = global.expect = require("../expect");
|
||||
root.Gun = require('../../gun');
|
||||
//Gun.serve = require('../../lib/serve');
|
||||
//require('./s3');
|
||||
//require('./uws');
|
||||
//require('./wsp/server');
|
||||
require('../../lib/file');
|
||||
require('../../sea.js');
|
||||
}
|
||||
}(this));
|
||||
|
||||
;(function(){
|
||||
Gun = root.Gun
|
||||
const SEA = Gun.SEA
|
||||
|
||||
if(!SEA){ return }
|
||||
|
||||
describe('SEA', function(){
|
||||
var user;
|
||||
var gun;
|
||||
it('is instantiable', done => {
|
||||
gun = Gun({ localStorage: true, radisk: false })
|
||||
user = gun.user()
|
||||
done()
|
||||
})
|
||||
|
||||
it('register users', async done => {
|
||||
user.create('bob', 'test123', ack => {
|
||||
expect(ack.err).to.not.be.ok();
|
||||
setTimeout(done, 30)
|
||||
})
|
||||
})
|
||||
|
||||
it('login users', async done => {
|
||||
console.log("------------------");
|
||||
user.auth('bob', 'test123', ack => {
|
||||
console.log("?????", ack, SEA.err);
|
||||
expect(ack.err).to.not.be.ok();
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
})()
|
Loading…
x
Reference in New Issue
Block a user