refactor secret-stack plugin shape

This commit is contained in:
Andre Staltz 2024-01-16 12:58:00 +02:00
parent 1c29eb22a2
commit c8f8e11c0b
No known key found for this signature in database
GPG Key ID: 9EDE23EA7E8A4890
2 changed files with 97 additions and 95 deletions

View File

@ -28,23 +28,11 @@ const HUBS_SUBDOMAIN = 'hubs'
* @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 {any} config
*/
init(peer, config) {
function initHubClient(peer, config) {
const hubs = new Map()
peer.multiserver.transport({
@ -135,5 +123,16 @@ module.exports = {
// underscore so other modules IN THIS LIBRARY can use it
_notifyDiscoveredAttendant,
}
}
exports.name = 'hubClient'
exports.init = initHubClient
exports.needs = ['shse', 'net', 'set']
exports.manifest = {
connect: 'duplex',
}
exports.permissions = {
anonymous: {
allow: ['connect'],
},
}

View File

@ -19,6 +19,9 @@
"exports": {
".": {
"require": "./lib/index.js"
},
"./plugin": {
"require": "./lib/plugin-hub-client.js"
}
},
"type": "commonjs",