Compare commits

..

2 Commits

Author SHA1 Message Date
Derrick Hammer 038555ac62
*Update dist 2023-01-15 03:50:17 -05:00
Derrick Hammer b6469a6a45
*Add sourceExists 2023-01-15 03:49:26 -05:00
3 changed files with 8 additions and 0 deletions

1
dist/index.d.ts vendored
View File

@ -9,5 +9,6 @@ export declare class PeerDiscovery {
registerSource(name: string, source: PeerSource): boolean;
removeSource(name: string): boolean;
removeAllSources(): void;
sourceExists(name: string): boolean;
discover(pubkey: string | Buffer, options?: {}): Promise<Peer | boolean>;
}

3
dist/index.js vendored
View File

@ -24,6 +24,9 @@ class PeerDiscovery {
removeAllSources() {
this._sources.clear();
}
sourceExists(name) {
return this._sources.has(name);
}
async discover(pubkey, options = {}) {
if (!b4a_1.default.isBuffer(pubkey)) {
pubkey = b4a_1.default.from(pubkey, "hex");

View File

@ -36,6 +36,10 @@ export class PeerDiscovery {
this._sources.clear();
}
public sourceExists(name: string): boolean {
return this._sources.has(name);
}
public async discover(
pubkey: string | Buffer,
options = {}