Release v1.1.5 - Remove debug and signing logs

- Disable debug() logging function in background scripts
- Remove backgroundLogNip07Action calls for NIP-07 operations
- Remove backgroundLogPermissionStored calls for permission events
- Clean up unused imports and result variables
- Simplify switch statement returns in processNip07Request

Files modified:
- package.json (version bump)
- projects/chrome/src/background-common.ts
- projects/chrome/src/background.ts
- projects/firefox/src/background-common.ts
- projects/firefox/src/background.ts

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
woikos
2025-12-31 17:07:56 +01:00
parent a2e47d8612
commit 4a2bc4fe72
9 changed files with 31 additions and 101 deletions

View File

@@ -1,12 +1,12 @@
{ {
"name": "plebeian-signer", "name": "plebeian-signer",
"version": "v1.1.4", "version": "v1.1.5",
"custom": { "custom": {
"chrome": { "chrome": {
"version": "v1.1.4" "version": "v1.1.5"
}, },
"firefox": { "firefox": {
"version": "v1.1.4" "version": "v1.1.5"
} }
}, },
"scripts": { "scripts": {

View File

@@ -2,7 +2,7 @@
"manifest_version": 3, "manifest_version": 3,
"name": "Plebeian Signer - Nostr Identity Manager & Signer", "name": "Plebeian Signer - Nostr Identity Manager & Signer",
"description": "Manage and switch between multiple identities while interacting with Nostr apps", "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", "homepage_url": "https://github.com/PlebeianApp/plebeian-signer",
"options_page": "options.html", "options_page": "options.html",
"permissions": [ "permissions": [

View File

@@ -40,10 +40,13 @@ export interface UnlockResponseMessage {
error?: string; error?: string;
} }
export const debug = function (message: any) { // Debug logging disabled - uncomment for development
const dateString = new Date().toISOString(); // export const debug = function (message: any) {
console.log(`[Plebeian Signer - ${dateString}]: ${JSON.stringify(message)}`); // 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 = export type PromptResponse =
| 'reject' | 'reject'

View File

@@ -1,7 +1,5 @@
/* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-explicit-any */
import { import {
backgroundLogNip07Action,
backgroundLogPermissionStored,
NostrHelper, NostrHelper,
NwcClient, NwcClient,
NwcConnection_DECRYPTED, NwcConnection_DECRYPTED,
@@ -441,7 +439,6 @@ async function processNip07Request(req: BackgroundRequestMessage): Promise<any>
policy, policy,
req.params?.kind req.params?.kind
); );
await backgroundLogPermissionStored(req.host, req.method, policy, req.params?.kind);
} else if (response === 'approve-all') { } else if (response === 'approve-all') {
// P2: Store permission for ALL kinds/uses of this method from this host // P2: Store permission for ALL kinds/uses of this method from this host
await storePermission( await storePermission(
@@ -452,8 +449,6 @@ async function processNip07Request(req: BackgroundRequestMessage): Promise<any>
'allow', 'allow',
undefined // undefined kind = allow all kinds for signEvent 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') { } else if (response === 'reject-all') {
// P2: Store deny permission for ALL uses of this method from this host // P2: Store deny permission for ALL uses of this method from this host
await storePermission( await storePermission(
@@ -464,15 +459,9 @@ async function processNip07Request(req: BackgroundRequestMessage): Promise<any>
'deny', 'deny',
undefined 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)) { 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'); throw new Error('Permission denied');
} }
} else { } else {
@@ -481,71 +470,47 @@ async function processNip07Request(req: BackgroundRequestMessage): Promise<any>
} }
const relays: Relays = {}; const relays: Relays = {};
let result: any;
switch (req.method) { switch (req.method) {
case 'getPublicKey': case 'getPublicKey':
result = NostrHelper.pubkeyFromPrivkey(currentIdentity.privkey); return NostrHelper.pubkeyFromPrivkey(currentIdentity.privkey);
await backgroundLogNip07Action(req.method, req.host, true, recklessApprove);
return result;
case 'signEvent': case 'signEvent':
result = signEvent(req.params, currentIdentity.privkey); return signEvent(req.params, currentIdentity.privkey);
await backgroundLogNip07Action(req.method, req.host, true, recklessApprove, {
kind: req.params?.kind,
});
return result;
case 'getRelays': case 'getRelays':
browserSessionData.relays.forEach((x) => { browserSessionData.relays.forEach((x) => {
relays[x.url] = { read: x.read, write: x.write }; relays[x.url] = { read: x.read, write: x.write };
}); });
await backgroundLogNip07Action(req.method, req.host, true, recklessApprove);
return relays; return relays;
case 'nip04.encrypt': case 'nip04.encrypt':
result = await nip04Encrypt( return await nip04Encrypt(
currentIdentity.privkey, currentIdentity.privkey,
req.params.peerPubkey, req.params.peerPubkey,
req.params.plaintext req.params.plaintext
); );
await backgroundLogNip07Action(req.method, req.host, true, recklessApprove, {
peerPubkey: req.params.peerPubkey,
});
return result;
case 'nip44.encrypt': case 'nip44.encrypt':
result = await nip44Encrypt( return await nip44Encrypt(
currentIdentity.privkey, currentIdentity.privkey,
req.params.peerPubkey, req.params.peerPubkey,
req.params.plaintext req.params.plaintext
); );
await backgroundLogNip07Action(req.method, req.host, true, recklessApprove, {
peerPubkey: req.params.peerPubkey,
});
return result;
case 'nip04.decrypt': case 'nip04.decrypt':
result = await nip04Decrypt( return await nip04Decrypt(
currentIdentity.privkey, currentIdentity.privkey,
req.params.peerPubkey, req.params.peerPubkey,
req.params.ciphertext req.params.ciphertext
); );
await backgroundLogNip07Action(req.method, req.host, true, recklessApprove, {
peerPubkey: req.params.peerPubkey,
});
return result;
case 'nip44.decrypt': case 'nip44.decrypt':
result = await nip44Decrypt( return await nip44Decrypt(
currentIdentity.privkey, currentIdentity.privkey,
req.params.peerPubkey, req.params.peerPubkey,
req.params.ciphertext req.params.ciphertext
); );
await backgroundLogNip07Action(req.method, req.host, true, recklessApprove, {
peerPubkey: req.params.peerPubkey,
});
return result;
default: default:
throw new Error(`Not supported request method '${req.method}'.`); throw new Error(`Not supported request method '${req.method}'.`);
@@ -625,7 +590,6 @@ async function processWeblnRequest(req: BackgroundRequestMessage): Promise<any>
method, method,
policy policy
); );
await backgroundLogPermissionStored(req.host, method, policy);
} else if (response === 'approve-all' && method !== 'webln.sendPayment' && method !== 'webln.keysend') { } else if (response === 'approve-all' && method !== 'webln.sendPayment' && method !== 'webln.keysend') {
// P2: Store permission for all uses of this WebLN method // P2: Store permission for all uses of this WebLN method
await storePermission( await storePermission(
@@ -635,8 +599,6 @@ async function processWeblnRequest(req: BackgroundRequestMessage): Promise<any>
method, method,
'allow' '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)) { if (['reject', 'reject-once', 'reject-all'].includes(response)) {

View File

@@ -2,7 +2,7 @@
"manifest_version": 3, "manifest_version": 3,
"name": "Plebeian Signer", "name": "Plebeian Signer",
"description": "Nostr Identity Manager & Signer", "description": "Nostr Identity Manager & Signer",
"version": "1.1.4", "version": "1.1.5",
"homepage_url": "https://github.com/PlebeianApp/plebeian-signer", "homepage_url": "https://github.com/PlebeianApp/plebeian-signer",
"options_page": "options.html", "options_page": "options.html",
"permissions": [ "permissions": [

View File

@@ -41,10 +41,13 @@ export interface UnlockResponseMessage {
error?: string; error?: string;
} }
export const debug = function (message: any) { // Debug logging disabled - uncomment for development
const dateString = new Date().toISOString(); // export const debug = function (message: any) {
console.log(`[Plebeian Signer - ${dateString}]: ${JSON.stringify(message)}`); // 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 = export type PromptResponse =
| 'reject' | 'reject'

View File

@@ -1,7 +1,5 @@
/* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-explicit-any */
import { import {
backgroundLogNip07Action,
backgroundLogPermissionStored,
NostrHelper, NostrHelper,
NwcClient, NwcClient,
NwcConnection_DECRYPTED, NwcConnection_DECRYPTED,
@@ -441,7 +439,6 @@ async function processNip07Request(req: BackgroundRequestMessage): Promise<any>
policy, policy,
req.params?.kind req.params?.kind
); );
await backgroundLogPermissionStored(req.host, req.method, policy, req.params?.kind);
} else if (response === 'approve-all') { } else if (response === 'approve-all') {
// P2: Store permission for ALL kinds/uses of this method from this host // P2: Store permission for ALL kinds/uses of this method from this host
await storePermission( await storePermission(
@@ -452,8 +449,6 @@ async function processNip07Request(req: BackgroundRequestMessage): Promise<any>
'allow', 'allow',
undefined // undefined kind = allow all kinds for signEvent 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') { } else if (response === 'reject-all') {
// P2: Store deny permission for ALL uses of this method from this host // P2: Store deny permission for ALL uses of this method from this host
await storePermission( await storePermission(
@@ -464,15 +459,9 @@ async function processNip07Request(req: BackgroundRequestMessage): Promise<any>
'deny', 'deny',
undefined 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)) { 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'); throw new Error('Permission denied');
} }
} else { } else {
@@ -481,71 +470,47 @@ async function processNip07Request(req: BackgroundRequestMessage): Promise<any>
} }
const relays: Relays = {}; const relays: Relays = {};
let result: any;
switch (req.method) { switch (req.method) {
case 'getPublicKey': case 'getPublicKey':
result = NostrHelper.pubkeyFromPrivkey(currentIdentity.privkey); return NostrHelper.pubkeyFromPrivkey(currentIdentity.privkey);
await backgroundLogNip07Action(req.method, req.host, true, recklessApprove);
return result;
case 'signEvent': case 'signEvent':
result = signEvent(req.params, currentIdentity.privkey); return signEvent(req.params, currentIdentity.privkey);
await backgroundLogNip07Action(req.method, req.host, true, recklessApprove, {
kind: req.params?.kind,
});
return result;
case 'getRelays': case 'getRelays':
browserSessionData.relays.forEach((x) => { browserSessionData.relays.forEach((x) => {
relays[x.url] = { read: x.read, write: x.write }; relays[x.url] = { read: x.read, write: x.write };
}); });
await backgroundLogNip07Action(req.method, req.host, true, recklessApprove);
return relays; return relays;
case 'nip04.encrypt': case 'nip04.encrypt':
result = await nip04Encrypt( return await nip04Encrypt(
currentIdentity.privkey, currentIdentity.privkey,
req.params.peerPubkey, req.params.peerPubkey,
req.params.plaintext req.params.plaintext
); );
await backgroundLogNip07Action(req.method, req.host, true, recklessApprove, {
peerPubkey: req.params.peerPubkey,
});
return result;
case 'nip44.encrypt': case 'nip44.encrypt':
result = await nip44Encrypt( return await nip44Encrypt(
currentIdentity.privkey, currentIdentity.privkey,
req.params.peerPubkey, req.params.peerPubkey,
req.params.plaintext req.params.plaintext
); );
await backgroundLogNip07Action(req.method, req.host, true, recklessApprove, {
peerPubkey: req.params.peerPubkey,
});
return result;
case 'nip04.decrypt': case 'nip04.decrypt':
result = await nip04Decrypt( return await nip04Decrypt(
currentIdentity.privkey, currentIdentity.privkey,
req.params.peerPubkey, req.params.peerPubkey,
req.params.ciphertext req.params.ciphertext
); );
await backgroundLogNip07Action(req.method, req.host, true, recklessApprove, {
peerPubkey: req.params.peerPubkey,
});
return result;
case 'nip44.decrypt': case 'nip44.decrypt':
result = await nip44Decrypt( return await nip44Decrypt(
currentIdentity.privkey, currentIdentity.privkey,
req.params.peerPubkey, req.params.peerPubkey,
req.params.ciphertext req.params.ciphertext
); );
await backgroundLogNip07Action(req.method, req.host, true, recklessApprove, {
peerPubkey: req.params.peerPubkey,
});
return result;
default: default:
throw new Error(`Not supported request method '${req.method}'.`); throw new Error(`Not supported request method '${req.method}'.`);
@@ -625,7 +590,6 @@ async function processWeblnRequest(req: BackgroundRequestMessage): Promise<any>
method, method,
policy policy
); );
await backgroundLogPermissionStored(req.host, method, policy);
} else if (response === 'approve-all' && method !== 'webln.sendPayment' && method !== 'webln.keysend') { } else if (response === 'approve-all' && method !== 'webln.sendPayment' && method !== 'webln.keysend') {
// P2: Store permission for all uses of this WebLN method // P2: Store permission for all uses of this WebLN method
await storePermission( await storePermission(
@@ -635,8 +599,6 @@ async function processWeblnRequest(req: BackgroundRequestMessage): Promise<any>
method, method,
'allow' '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)) { if (['reject', 'reject-once', 'reject-all'].includes(response)) {

Binary file not shown.

Binary file not shown.