refactor secret-stack plugin shape
This commit is contained in:
parent
1c29eb22a2
commit
c8f8e11c0b
|
@ -28,23 +28,11 @@ const HUBS_SUBDOMAIN = 'hubs'
|
||||||
* @typedef {(...args: [Error] | [null, T]) => void } CB
|
* @typedef {(...args: [Error] | [null, T]) => void } CB
|
||||||
*/
|
*/
|
||||||
|
|
||||||
module.exports = {
|
/**
|
||||||
name: 'hubClient',
|
|
||||||
needs: ['shse', 'net', 'set'],
|
|
||||||
manifest: {
|
|
||||||
connect: 'duplex',
|
|
||||||
},
|
|
||||||
permissions: {
|
|
||||||
anonymous: {
|
|
||||||
allow: ['connect'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {Peer} peer
|
* @param {Peer} peer
|
||||||
* @param {any} config
|
* @param {any} config
|
||||||
*/
|
*/
|
||||||
init(peer, config) {
|
function initHubClient(peer, config) {
|
||||||
const hubs = new Map()
|
const hubs = new Map()
|
||||||
|
|
||||||
peer.multiserver.transport({
|
peer.multiserver.transport({
|
||||||
|
@ -135,5 +123,16 @@ module.exports = {
|
||||||
// underscore so other modules IN THIS LIBRARY can use it
|
// underscore so other modules IN THIS LIBRARY can use it
|
||||||
_notifyDiscoveredAttendant,
|
_notifyDiscoveredAttendant,
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.name = 'hubClient'
|
||||||
|
exports.init = initHubClient
|
||||||
|
exports.needs = ['shse', 'net', 'set']
|
||||||
|
exports.manifest = {
|
||||||
|
connect: 'duplex',
|
||||||
|
}
|
||||||
|
exports.permissions = {
|
||||||
|
anonymous: {
|
||||||
|
allow: ['connect'],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,9 @@
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"require": "./lib/index.js"
|
"require": "./lib/index.js"
|
||||||
|
},
|
||||||
|
"./plugin": {
|
||||||
|
"require": "./lib/plugin-hub-client.js"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"type": "commonjs",
|
"type": "commonjs",
|
||||||
|
|
Loading…
Reference in New Issue