diff --git a/package.json b/package.json index f0f4a6a..d4b5a48 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@welshman", "private": true, - "version": "0.8.0-pre.1", + "version": "0.8.0", "workspaces": [ "packages/*" ], diff --git a/packages/app/package.json b/packages/app/package.json index 9e37f6e..aa1ecd6 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -1,6 +1,6 @@ { "name": "@welshman/app", - "version": "0.8.0-pre.1", + "version": "0.8.0", "author": "hodlbod", "license": "MIT", "description": "A collection of svelte stores for use in building nostr client applications.", @@ -24,7 +24,7 @@ "throttle-debounce": "^5.0.2" }, "peerDependencies": { - "@pomade/core": "^0.0.9", + "@pomade/core": "^0.0.12", "@welshman/feeds": "workspace:*", "@welshman/lib": "workspace:*", "@welshman/net": "workspace:*", diff --git a/packages/app/src/session.ts b/packages/app/src/session.ts index 663a643..38c91ea 100644 --- a/packages/app/src/session.ts +++ b/packages/app/src/session.ts @@ -113,16 +113,7 @@ export const updateSession = (pubkey: string, f: (session: Session) => Session) putSession(f(getSession(pubkey))) export const dropSession = (_pubkey: string) => { - const $signer = getSigner.pop(getSession(_pubkey)) - - if ($signer instanceof Nip46Signer) { - $signer.broker.cleanup() - } - - if ($signer instanceof PomadeSigner) { - $signer.client.rpc.stop() - } - + getSigner.pop(getSession(_pubkey))?.cleanup() pubkey.update($pubkey => ($pubkey === _pubkey ? undefined : $pubkey)) sessions.update($sessions => omit([_pubkey], $sessions)) } diff --git a/packages/content/package.json b/packages/content/package.json index a04d78b..30aee30 100644 --- a/packages/content/package.json +++ b/packages/content/package.json @@ -1,6 +1,6 @@ { "name": "@welshman/content", - "version": "0.8.0-pre.1", + "version": "0.8.0", "author": "hodlbod", "license": "MIT", "description": "A collection of utilities for parsing nostr note content.", diff --git a/packages/editor/package.json b/packages/editor/package.json index 8a4e43f..b3635c1 100644 --- a/packages/editor/package.json +++ b/packages/editor/package.json @@ -1,6 +1,6 @@ { "name": "@welshman/editor", - "version": "0.8.0-pre.1", + "version": "0.8.0", "author": "hodlbod", "license": "MIT", "description": "A batteries-included nostr editor.", diff --git a/packages/feeds/package.json b/packages/feeds/package.json index f317de5..7cf3822 100644 --- a/packages/feeds/package.json +++ b/packages/feeds/package.json @@ -1,6 +1,6 @@ { "name": "@welshman/feeds", - "version": "0.8.0-pre.1", + "version": "0.8.0", "author": "hodlbod", "license": "MIT", "description": "Utilities for building dynamic nostr feeds.", diff --git a/packages/lib/package.json b/packages/lib/package.json index c7a767d..e3e3512 100644 --- a/packages/lib/package.json +++ b/packages/lib/package.json @@ -1,6 +1,6 @@ { "name": "@welshman/lib", - "version": "0.8.0-pre.1", + "version": "0.8.0", "author": "hodlbod", "license": "MIT", "description": "A collection of utilities.", diff --git a/packages/net/package.json b/packages/net/package.json index b103431..64f0bd3 100644 --- a/packages/net/package.json +++ b/packages/net/package.json @@ -1,6 +1,6 @@ { "name": "@welshman/net", - "version": "0.8.0-pre.1", + "version": "0.8.0", "author": "hodlbod", "license": "MIT", "description": "Utilities for connecting with nostr relays.", diff --git a/packages/router/package.json b/packages/router/package.json index c60e985..24e064a 100644 --- a/packages/router/package.json +++ b/packages/router/package.json @@ -1,6 +1,6 @@ { "name": "@welshman/router", - "version": "0.8.0-pre.1", + "version": "0.8.0", "author": "hodlbod", "license": "MIT", "description": "A collection of utilities for nostr relay selection.", diff --git a/packages/signer/package.json b/packages/signer/package.json index d36a7c6..e80009f 100644 --- a/packages/signer/package.json +++ b/packages/signer/package.json @@ -1,6 +1,6 @@ { "name": "@welshman/signer", - "version": "0.8.0-pre.1", + "version": "0.8.0", "author": "hodlbod", "license": "MIT", "description": "A nostr signer implemenation supporting several login methods.", diff --git a/packages/signer/src/signers/nip46.ts b/packages/signer/src/signers/nip46.ts index 52c069f..871acb8 100644 --- a/packages/signer/src/signers/nip46.ts +++ b/packages/signer/src/signers/nip46.ts @@ -512,4 +512,6 @@ export class Nip46Signer implements ISigner { this.getPubkey().then(pubkey => this.broker.signEvent(prep(template, pubkey))), options, ) + + cleanup = async () => this.broker.cleanup() } diff --git a/packages/signer/src/util.ts b/packages/signer/src/util.ts index 4d97923..f1115e8 100644 --- a/packages/signer/src/util.ts +++ b/packages/signer/src/util.ts @@ -45,6 +45,7 @@ export interface ISigner { nip04: EncryptionImplementation nip44: EncryptionImplementation getPubkey: () => Promise + cleanup?: () => Promise } export const decrypt = async (signer: ISigner, pubkey: string, message: string) => @@ -83,6 +84,10 @@ export class WrappedSigner extends Emitter implements ISigner { decrypt: async (pubkey: string, message: string) => this.wrapMethod("nip44.decrypt", () => this.signer.nip44.decrypt(pubkey, message)), } + + async cleanup() { + await this.signer.cleanup?.() + } } export const signWithOptions = ( diff --git a/packages/store/package.json b/packages/store/package.json index 9e7f4ee..19bb914 100644 --- a/packages/store/package.json +++ b/packages/store/package.json @@ -1,6 +1,6 @@ { "name": "@welshman/store", - "version": "0.8.0-pre.1", + "version": "0.8.0", "author": "hodlbod", "license": "MIT", "description": "A collection of utilities based on svelte/store for use with welshman", diff --git a/packages/util/package.json b/packages/util/package.json index 4e69004..5f6d7b4 100644 --- a/packages/util/package.json +++ b/packages/util/package.json @@ -1,6 +1,6 @@ { "name": "@welshman/util", - "version": "0.8.0-pre.1", + "version": "0.8.0", "author": "hodlbod", "license": "MIT", "description": "A collection of nostr-related utilities.",