Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ This module:
var SecretStack = require('secret-stack')
var databasePlugin = require('./some-database')
var bluetoothPlugin = require('./bluetooth')
var config = require('./some-config')
const ssbKeys = require('ssb-keys')
var keys = ssbKeys.loadOrCreateSync(path.join(__dirname, 'secret'))

// keys are necessary for multiserver address
var config = { keys }

var App = SecretStack({ appKey: '1KHLiKZvAvjbY1ziZEHMXawbCEIM6qwjCDm3VYRan/s=' })
.use(databasePlugin)
Expand Down
45 changes: 45 additions & 0 deletions example.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
const SecretStack = require('./lib')
const ssbKeys = require('ssb-keys')
const S = require('pull-stream')
const path = require('path')
var keys = ssbKeys.loadOrCreateSync(path.join(__dirname, 'secret'))

var myPlugin = {
name: 'myPlugin',
version: '0.0.0',
manifest: {
foo: 'async',
bar: 'source'
},

init: (api, opts) => {
// .. do things

// console.log('api', api)
// console.log('opts', opts)

// return things promised by the manifest:
return {
foo: function (cb) { // an async function (takes a callback)
process.nextTick(() => {
cb(null, 'foo')
})
},

bar: function () { // a function which returns a pull-stream source
return S.values([1,2,3])
}
}
}
}

var App = SecretStack({
appKey: '1KHLiKZvAvjbY1ziZEHMXawbCEIM6qwjCDm3VYRan/s=',
permissions: {}
})
.use(myPlugin)

var app = App({ keys })
// var app = App({})

console.log('address', app.getAddress())
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"muxrpc": "^6.5.2",
"pull-inactivity": "~2.1.1",
"pull-rate": "^1.0.2",
"pull-stream": "^3.4.5",
"pull-stream": "^3.6.14",
"to-camel-case": "^1.0.0"
},
"engines": {
Expand All @@ -29,9 +29,9 @@
"@types/node": "^12.12.2",
"@typescript-eslint/eslint-plugin": "^5.13.0",
"@typescript-eslint/parser": "^5.13.0",
"mkdirp": "~1.0.4",
"pull-pushable": "^2.0.1",
"ssb-keys": "^8.2.0",
"mkdirp": "~1.0.4",
"standardx": "^7.0.0",
"tape": "^5.5.2",
"typescript": "~4.5.0"
Expand Down
20 changes: 20 additions & 0 deletions secret
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# WARNING: Never show this to anyone.
# WARNING: Never edit it or use it on multiple devices at once.
#
# This is your SECRET, it gives you magical powers. With your secret you can
# sign your messages so that your friends can verify that the messages came
# from you. If anyone learns your secret, they can use it to impersonate you.
#
# If you use this secret on more than one device you will create a fork and
# your friends will stop replicating your content.
#
{
"curve": "ed25519",
"public": "QoTBm8zpeGFuwHC6M1urxgvjSprK+g2trWt6/hahMUY=.ed25519",
"private": "1UIxX/PBATjEw1D8OEoO6W+Y5jfH5aFmX7NhncwrDABChMGbzOl4YW7AcLozW6vGC+NKmsr6Da2ta3r+FqExRg==.ed25519",
"id": "@QoTBm8zpeGFuwHC6M1urxgvjSprK+g2trWt6/hahMUY=.ed25519"
}
#
# The only part of this file that's safe to share is your public name:
#
# @QoTBm8zpeGFuwHC6M1urxgvjSprK+g2trWt6/hahMUY=.ed25519
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@
"esModuleInterop": false
},
"exclude": ["node_modules", "test", "lib"]
}
}