Compare commits

...

3 Commits

4 changed files with 18 additions and 5 deletions

View File

@ -1,3 +1,5 @@
# [0.1.0-develop.23](https://git.lumeweb.com/LumeWeb/libs5/compare/v0.1.0-develop.22...v0.1.0-develop.23) (2023-09-01)
# [0.1.0-develop.22](https://git.lumeweb.com/LumeWeb/libs5/compare/v0.1.0-develop.21...v0.1.0-develop.22) (2023-09-01)

4
npm-shrinkwrap.json generated
View File

@ -1,12 +1,12 @@
{
"name": "@lumeweb/libs5",
"version": "0.1.0-develop.22",
"version": "0.1.0-develop.23",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@lumeweb/libs5",
"version": "0.1.0-develop.22",
"version": "0.1.0-develop.23",
"dependencies": {
"@noble/curves": "^1.1.0",
"@noble/hashes": "^1.3.1",

View File

@ -1,6 +1,6 @@
{
"name": "@lumeweb/libs5",
"version": "0.1.0-develop.22",
"version": "0.1.0-develop.23",
"type": "module",
"main": "lib/index.js",
"repository": {

View File

@ -209,13 +209,24 @@ export class RegistryService {
return null;
}
public listen(pk: Uint8Array): EventEmitter {
public listen(
pk: Uint8Array,
cb: (sre: SignedRegistryEntry) => void,
): ((() => void) | EventEmitter)[] {
const key = new Multihash(pk).toString();
if (!this.streams[key]) {
this.streams[key] = new EventEmitter();
this.sendRegistryRequest(pk);
}
return this.streams[key];
const stream = this.streams[key] as EventEmitter;
const done = () => {
stream.off("event", cb);
};
stream.on("event", cb);
return [done, stream];
}
public deserializeRegistryEntry(event: Uint8Array): SignedRegistryEntry {