Commit 9d95a96980b0f866c90f8c49d5cd48bebdc355c0
add example
Dominic Tarr committed on 3/6/2015, 9:48:07 AMParent: 255aa84c011080723da25d6b83d454648e972fb3
Files changed
example.js | added |
example.js | |||
---|---|---|---|
@@ -1,0 +1,20 @@ | |||
1 … | + | ||
2 … | +var Client = require('./') | ||
3 … | + | ||
4 … | +var config = require('ssb-config') | ||
5 … | +var ssbKeys = require('ssb-keys') | ||
6 … | +var keys = ssbKeys.loadOrCreateSync(config) | ||
7 … | + | ||
8 … | +function abortIf (err) { | ||
9 … | + if(err) throw err | ||
10 … | +} | ||
11 … | + | ||
12 … | +var client = Client(keys, config) | ||
13 … | + .connect(abortIf) | ||
14 … | + .auth(abortIf) | ||
15 … | + | ||
16 … | +client.whoami(function (err, whoami) { | ||
17 … | + abortIf(err) | ||
18 … | + console.log(whoami) | ||
19 … | + client.close() | ||
20 … | +}) |
Built with git-ssb-web