feat: port listen method

This commit is contained in:
Derrick Hammer 2023-09-01 08:02:05 -04:00
parent 174e5a0181
commit a75c57b1e8
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 9 additions and 0 deletions

View File

@ -209,6 +209,15 @@ export class RegistryService {
return null; return null;
} }
public listen(pk: Uint8Array): EventEmitter {
const key = new Multihash(pk).toString();
if (!this.streams[key]) {
this.streams[key] = new EventEmitter();
this.sendRegistryRequest(pk);
}
return this.streams[key];
}
public deserializeRegistryEntry(event: Uint8Array): SignedRegistryEntry { public deserializeRegistryEntry(event: Uint8Array): SignedRegistryEntry {
const dataLength = event[42]; const dataLength = event[42];
return { return {