better secret-stack plugin shape

This commit is contained in:
Andre Staltz 2023-12-13 15:14:36 +02:00
parent 0ae7704994
commit 782b435a98
No known key found for this signature in database
GPG Key ID: 9EDE23EA7E8A4890
3 changed files with 80 additions and 81 deletions

1
.gitignore vendored
View File

@ -4,6 +4,7 @@ pnpm-lock.yaml
package-lock.json
coverage
*~
lib/*.d.ts
# For misc scripts and experiments:
/gitignored

View File

@ -51,18 +51,6 @@ function assertSHSEExists(peer) {
if (!peer.shse) throw new Error('sync requires secret-handshake-ext')
}
module.exports = {
name: 'sync',
manifest: {
connect: 'duplex',
initiate: 'sync',
},
permissions: {
anonymous: {
allow: ['connect'],
},
},
/**
* @param {Emitter & {
* db: PPPPPDB | null,
@ -73,7 +61,7 @@ module.exports = {
* }} peer
* @param {unknown} config
*/
init(peer, config) {
function initSync(peer, config) {
assertDBExists(peer)
assertGoalsExists(peer)
assertSHSEExists(peer)
@ -140,5 +128,16 @@ module.exports = {
connect,
start,
}
}
exports.name = 'sync'
exports.manifest = {
connect: 'duplex',
initiate: 'sync',
}
exports.init = initSync
exports.permissions = {
anonymous: {
allow: ['connect'],
},
}

View File

@ -11,8 +11,7 @@
},
"main": "index.js",
"files": [
"*.js",
"lib/*.js"
"lib/**"
],
"exports": {
".": {