mirror of https://codeberg.org/pzp/pzp-sync.git
better secret-stack plugin shape
This commit is contained in:
parent
0ae7704994
commit
782b435a98
|
@ -4,6 +4,7 @@ pnpm-lock.yaml
|
||||||
package-lock.json
|
package-lock.json
|
||||||
coverage
|
coverage
|
||||||
*~
|
*~
|
||||||
|
lib/*.d.ts
|
||||||
|
|
||||||
# For misc scripts and experiments:
|
# For misc scripts and experiments:
|
||||||
/gitignored
|
/gitignored
|
||||||
|
|
25
lib/index.js
25
lib/index.js
|
@ -51,18 +51,6 @@ function assertSHSEExists(peer) {
|
||||||
if (!peer.shse) throw new Error('sync requires secret-handshake-ext')
|
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 & {
|
* @param {Emitter & {
|
||||||
* db: PPPPPDB | null,
|
* db: PPPPPDB | null,
|
||||||
|
@ -73,7 +61,7 @@ module.exports = {
|
||||||
* }} peer
|
* }} peer
|
||||||
* @param {unknown} config
|
* @param {unknown} config
|
||||||
*/
|
*/
|
||||||
init(peer, config) {
|
function initSync(peer, config) {
|
||||||
assertDBExists(peer)
|
assertDBExists(peer)
|
||||||
assertGoalsExists(peer)
|
assertGoalsExists(peer)
|
||||||
assertSHSEExists(peer)
|
assertSHSEExists(peer)
|
||||||
|
@ -140,5 +128,16 @@ module.exports = {
|
||||||
connect,
|
connect,
|
||||||
start,
|
start,
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.name = 'sync'
|
||||||
|
exports.manifest = {
|
||||||
|
connect: 'duplex',
|
||||||
|
initiate: 'sync',
|
||||||
|
}
|
||||||
|
exports.init = initSync
|
||||||
|
exports.permissions = {
|
||||||
|
anonymous: {
|
||||||
|
allow: ['connect'],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,7 @@
|
||||||
},
|
},
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"files": [
|
"files": [
|
||||||
"*.js",
|
"lib/**"
|
||||||
"lib/*.js"
|
|
||||||
],
|
],
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
|
|
Loading…
Reference in New Issue