diff --git a/package.json b/package.json index e0c692b..d0fcd27 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,12 @@ { "name": "plebeian-signer", - "version": "v1.1.4", + "version": "v1.1.5", "custom": { "chrome": { - "version": "v1.1.4" + "version": "v1.1.5" }, "firefox": { - "version": "v1.1.4" + "version": "v1.1.5" } }, "scripts": { diff --git a/projects/chrome/public/manifest.json b/projects/chrome/public/manifest.json index dabaa96..83004b5 100644 --- a/projects/chrome/public/manifest.json +++ b/projects/chrome/public/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 3, "name": "Plebeian Signer - Nostr Identity Manager & Signer", "description": "Manage and switch between multiple identities while interacting with Nostr apps", - "version": "1.1.4", + "version": "1.1.5", "homepage_url": "https://github.com/PlebeianApp/plebeian-signer", "options_page": "options.html", "permissions": [ diff --git a/projects/chrome/src/background-common.ts b/projects/chrome/src/background-common.ts index 104197c..f852a44 100644 --- a/projects/chrome/src/background-common.ts +++ b/projects/chrome/src/background-common.ts @@ -40,10 +40,13 @@ export interface UnlockResponseMessage { error?: string; } -export const debug = function (message: any) { - const dateString = new Date().toISOString(); - console.log(`[Plebeian Signer - ${dateString}]: ${JSON.stringify(message)}`); -}; +// Debug logging disabled - uncomment for development +// export const debug = function (message: any) { +// const dateString = new Date().toISOString(); +// console.log(`[Plebeian Signer - ${dateString}]: ${JSON.stringify(message)}`); +// }; +// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function +export const debug = function (_message: any) {}; export type PromptResponse = | 'reject' diff --git a/projects/chrome/src/background.ts b/projects/chrome/src/background.ts index 2fbaba4..cd0431c 100644 --- a/projects/chrome/src/background.ts +++ b/projects/chrome/src/background.ts @@ -1,7 +1,5 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import { - backgroundLogNip07Action, - backgroundLogPermissionStored, NostrHelper, NwcClient, NwcConnection_DECRYPTED, @@ -441,7 +439,6 @@ async function processNip07Request(req: BackgroundRequestMessage): Promise policy, req.params?.kind ); - await backgroundLogPermissionStored(req.host, req.method, policy, req.params?.kind); } else if (response === 'approve-all') { // P2: Store permission for ALL kinds/uses of this method from this host await storePermission( @@ -452,8 +449,6 @@ async function processNip07Request(req: BackgroundRequestMessage): Promise 'allow', undefined // undefined kind = allow all kinds for signEvent ); - await backgroundLogPermissionStored(req.host, req.method, 'allow', undefined); - debug(`Stored approve-all permission for ${req.method} from ${req.host}`); } else if (response === 'reject-all') { // P2: Store deny permission for ALL uses of this method from this host await storePermission( @@ -464,15 +459,9 @@ async function processNip07Request(req: BackgroundRequestMessage): Promise 'deny', undefined ); - await backgroundLogPermissionStored(req.host, req.method, 'deny', undefined); - debug(`Stored reject-all permission for ${req.method} from ${req.host}`); } if (['reject', 'reject-once', 'reject-all'].includes(response)) { - await backgroundLogNip07Action(req.method, req.host, false, false, { - kind: req.params?.kind, - peerPubkey: req.params?.peerPubkey, - }); throw new Error('Permission denied'); } } else { @@ -481,71 +470,47 @@ async function processNip07Request(req: BackgroundRequestMessage): Promise } const relays: Relays = {}; - let result: any; switch (req.method) { case 'getPublicKey': - result = NostrHelper.pubkeyFromPrivkey(currentIdentity.privkey); - await backgroundLogNip07Action(req.method, req.host, true, recklessApprove); - return result; + return NostrHelper.pubkeyFromPrivkey(currentIdentity.privkey); case 'signEvent': - result = signEvent(req.params, currentIdentity.privkey); - await backgroundLogNip07Action(req.method, req.host, true, recklessApprove, { - kind: req.params?.kind, - }); - return result; + return signEvent(req.params, currentIdentity.privkey); case 'getRelays': browserSessionData.relays.forEach((x) => { relays[x.url] = { read: x.read, write: x.write }; }); - await backgroundLogNip07Action(req.method, req.host, true, recklessApprove); return relays; case 'nip04.encrypt': - result = await nip04Encrypt( + return await nip04Encrypt( currentIdentity.privkey, req.params.peerPubkey, req.params.plaintext ); - await backgroundLogNip07Action(req.method, req.host, true, recklessApprove, { - peerPubkey: req.params.peerPubkey, - }); - return result; case 'nip44.encrypt': - result = await nip44Encrypt( + return await nip44Encrypt( currentIdentity.privkey, req.params.peerPubkey, req.params.plaintext ); - await backgroundLogNip07Action(req.method, req.host, true, recklessApprove, { - peerPubkey: req.params.peerPubkey, - }); - return result; case 'nip04.decrypt': - result = await nip04Decrypt( + return await nip04Decrypt( currentIdentity.privkey, req.params.peerPubkey, req.params.ciphertext ); - await backgroundLogNip07Action(req.method, req.host, true, recklessApprove, { - peerPubkey: req.params.peerPubkey, - }); - return result; case 'nip44.decrypt': - result = await nip44Decrypt( + return await nip44Decrypt( currentIdentity.privkey, req.params.peerPubkey, req.params.ciphertext ); - await backgroundLogNip07Action(req.method, req.host, true, recklessApprove, { - peerPubkey: req.params.peerPubkey, - }); - return result; default: throw new Error(`Not supported request method '${req.method}'.`); @@ -625,7 +590,6 @@ async function processWeblnRequest(req: BackgroundRequestMessage): Promise method, policy ); - await backgroundLogPermissionStored(req.host, method, policy); } else if (response === 'approve-all' && method !== 'webln.sendPayment' && method !== 'webln.keysend') { // P2: Store permission for all uses of this WebLN method await storePermission( @@ -635,8 +599,6 @@ async function processWeblnRequest(req: BackgroundRequestMessage): Promise method, 'allow' ); - await backgroundLogPermissionStored(req.host, method, 'allow'); - debug(`Stored approve-all permission for ${method} from ${req.host}`); } if (['reject', 'reject-once', 'reject-all'].includes(response)) { diff --git a/projects/firefox/public/manifest.json b/projects/firefox/public/manifest.json index d9956e6..41a55f2 100644 --- a/projects/firefox/public/manifest.json +++ b/projects/firefox/public/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 3, "name": "Plebeian Signer", "description": "Nostr Identity Manager & Signer", - "version": "1.1.4", + "version": "1.1.5", "homepage_url": "https://github.com/PlebeianApp/plebeian-signer", "options_page": "options.html", "permissions": [ diff --git a/projects/firefox/src/background-common.ts b/projects/firefox/src/background-common.ts index 68d89a2..a4b1ca3 100644 --- a/projects/firefox/src/background-common.ts +++ b/projects/firefox/src/background-common.ts @@ -41,10 +41,13 @@ export interface UnlockResponseMessage { error?: string; } -export const debug = function (message: any) { - const dateString = new Date().toISOString(); - console.log(`[Plebeian Signer - ${dateString}]: ${JSON.stringify(message)}`); -}; +// Debug logging disabled - uncomment for development +// export const debug = function (message: any) { +// const dateString = new Date().toISOString(); +// console.log(`[Plebeian Signer - ${dateString}]: ${JSON.stringify(message)}`); +// }; +// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function +export const debug = function (_message: any) {}; export type PromptResponse = | 'reject' diff --git a/projects/firefox/src/background.ts b/projects/firefox/src/background.ts index 2fbaba4..cd0431c 100644 --- a/projects/firefox/src/background.ts +++ b/projects/firefox/src/background.ts @@ -1,7 +1,5 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import { - backgroundLogNip07Action, - backgroundLogPermissionStored, NostrHelper, NwcClient, NwcConnection_DECRYPTED, @@ -441,7 +439,6 @@ async function processNip07Request(req: BackgroundRequestMessage): Promise policy, req.params?.kind ); - await backgroundLogPermissionStored(req.host, req.method, policy, req.params?.kind); } else if (response === 'approve-all') { // P2: Store permission for ALL kinds/uses of this method from this host await storePermission( @@ -452,8 +449,6 @@ async function processNip07Request(req: BackgroundRequestMessage): Promise 'allow', undefined // undefined kind = allow all kinds for signEvent ); - await backgroundLogPermissionStored(req.host, req.method, 'allow', undefined); - debug(`Stored approve-all permission for ${req.method} from ${req.host}`); } else if (response === 'reject-all') { // P2: Store deny permission for ALL uses of this method from this host await storePermission( @@ -464,15 +459,9 @@ async function processNip07Request(req: BackgroundRequestMessage): Promise 'deny', undefined ); - await backgroundLogPermissionStored(req.host, req.method, 'deny', undefined); - debug(`Stored reject-all permission for ${req.method} from ${req.host}`); } if (['reject', 'reject-once', 'reject-all'].includes(response)) { - await backgroundLogNip07Action(req.method, req.host, false, false, { - kind: req.params?.kind, - peerPubkey: req.params?.peerPubkey, - }); throw new Error('Permission denied'); } } else { @@ -481,71 +470,47 @@ async function processNip07Request(req: BackgroundRequestMessage): Promise } const relays: Relays = {}; - let result: any; switch (req.method) { case 'getPublicKey': - result = NostrHelper.pubkeyFromPrivkey(currentIdentity.privkey); - await backgroundLogNip07Action(req.method, req.host, true, recklessApprove); - return result; + return NostrHelper.pubkeyFromPrivkey(currentIdentity.privkey); case 'signEvent': - result = signEvent(req.params, currentIdentity.privkey); - await backgroundLogNip07Action(req.method, req.host, true, recklessApprove, { - kind: req.params?.kind, - }); - return result; + return signEvent(req.params, currentIdentity.privkey); case 'getRelays': browserSessionData.relays.forEach((x) => { relays[x.url] = { read: x.read, write: x.write }; }); - await backgroundLogNip07Action(req.method, req.host, true, recklessApprove); return relays; case 'nip04.encrypt': - result = await nip04Encrypt( + return await nip04Encrypt( currentIdentity.privkey, req.params.peerPubkey, req.params.plaintext ); - await backgroundLogNip07Action(req.method, req.host, true, recklessApprove, { - peerPubkey: req.params.peerPubkey, - }); - return result; case 'nip44.encrypt': - result = await nip44Encrypt( + return await nip44Encrypt( currentIdentity.privkey, req.params.peerPubkey, req.params.plaintext ); - await backgroundLogNip07Action(req.method, req.host, true, recklessApprove, { - peerPubkey: req.params.peerPubkey, - }); - return result; case 'nip04.decrypt': - result = await nip04Decrypt( + return await nip04Decrypt( currentIdentity.privkey, req.params.peerPubkey, req.params.ciphertext ); - await backgroundLogNip07Action(req.method, req.host, true, recklessApprove, { - peerPubkey: req.params.peerPubkey, - }); - return result; case 'nip44.decrypt': - result = await nip44Decrypt( + return await nip44Decrypt( currentIdentity.privkey, req.params.peerPubkey, req.params.ciphertext ); - await backgroundLogNip07Action(req.method, req.host, true, recklessApprove, { - peerPubkey: req.params.peerPubkey, - }); - return result; default: throw new Error(`Not supported request method '${req.method}'.`); @@ -625,7 +590,6 @@ async function processWeblnRequest(req: BackgroundRequestMessage): Promise method, policy ); - await backgroundLogPermissionStored(req.host, method, policy); } else if (response === 'approve-all' && method !== 'webln.sendPayment' && method !== 'webln.keysend') { // P2: Store permission for all uses of this WebLN method await storePermission( @@ -635,8 +599,6 @@ async function processWeblnRequest(req: BackgroundRequestMessage): Promise method, 'allow' ); - await backgroundLogPermissionStored(req.host, method, 'allow'); - debug(`Stored approve-all permission for ${method} from ${req.host}`); } if (['reject', 'reject-once', 'reject-all'].includes(response)) { diff --git a/releases/plebeian-signer-chrome-v1.1.5.zip b/releases/plebeian-signer-chrome-v1.1.5.zip new file mode 100644 index 0000000..bd0c386 Binary files /dev/null and b/releases/plebeian-signer-chrome-v1.1.5.zip differ diff --git a/releases/plebeian-signer-firefox-v1.1.5.zip b/releases/plebeian-signer-firefox-v1.1.5.zip new file mode 100644 index 0000000..8e248af Binary files /dev/null and b/releases/plebeian-signer-firefox-v1.1.5.zip differ