*Update dist
This commit is contained in:
parent
79c2b167ae
commit
a8dd1d2c20
|
@ -1,8 +1,10 @@
|
||||||
import { Proxy } from "@lumeweb/libhyperproxy";
|
import { Proxy } from "@lumeweb/libhyperproxy";
|
||||||
export default class HandshakeProxy extends Proxy {
|
export default class HandshakeProxy extends Proxy {
|
||||||
constructor({ swarm, listen }: {
|
private _join;
|
||||||
|
constructor({ swarm, listen, join, }: {
|
||||||
swarm: any;
|
swarm: any;
|
||||||
listen?: boolean;
|
listen?: boolean;
|
||||||
|
join?: boolean;
|
||||||
});
|
});
|
||||||
private _node?;
|
private _node?;
|
||||||
get node(): any;
|
get node(): any;
|
||||||
|
|
|
@ -13,7 +13,7 @@ const b4a_1 = __importDefault(require("b4a"));
|
||||||
const PROTOCOL = "lumeweb.proxy.handshake";
|
const PROTOCOL = "lumeweb.proxy.handshake";
|
||||||
const libhyperproxy_1 = require("@lumeweb/libhyperproxy");
|
const libhyperproxy_1 = require("@lumeweb/libhyperproxy");
|
||||||
class HandshakeProxy extends libhyperproxy_1.Proxy {
|
class HandshakeProxy extends libhyperproxy_1.Proxy {
|
||||||
constructor({ swarm, listen = false }) {
|
constructor({ swarm, listen = false, join = false, }) {
|
||||||
super({
|
super({
|
||||||
swarm,
|
swarm,
|
||||||
listen,
|
listen,
|
||||||
|
@ -39,6 +39,7 @@ class HandshakeProxy extends libhyperproxy_1.Proxy {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const self = this;
|
const self = this;
|
||||||
|
this._join = join;
|
||||||
}
|
}
|
||||||
get node() {
|
get node() {
|
||||||
return this._node;
|
return this._node;
|
||||||
|
@ -64,10 +65,12 @@ class HandshakeProxy extends libhyperproxy_1.Proxy {
|
||||||
await this._node.open();
|
await this._node.open();
|
||||||
this._node.pool.connected = true;
|
this._node.pool.connected = true;
|
||||||
this._node.startSync();
|
this._node.startSync();
|
||||||
const topic = b4a_1.default.from(PROTOCOL);
|
if (this._join) {
|
||||||
const topicHash = b4a_1.default.allocUnsafe(32);
|
const topic = b4a_1.default.from(PROTOCOL);
|
||||||
sodium_universal_1.default.crypto_generichash(topicHash, topic);
|
const topicHash = b4a_1.default.allocUnsafe(32);
|
||||||
this.swarm.join(topicHash);
|
sodium_universal_1.default.crypto_generichash(topicHash, topic);
|
||||||
|
this.swarm.join(topicHash);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.default = HandshakeProxy;
|
exports.default = HandshakeProxy;
|
||||||
|
|
Loading…
Reference in New Issue