Skip to content

Commit 075c787

Browse files
vveerrggclaude
andcommitted
fix: read private key from Node-RED credential store, not config
HIGH: privateKey was read from config (stored plaintext in flows.json) instead of this.credentials (encrypted credential store). Now accesses credentials properly and declares credential type in registerType. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent fbc27bc commit 075c787

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

src/nodes/nostr-relay-config/nostr-relay-config.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@ import type { NostrWSClient, NostrWSMessage } from 'nostr-websocket-utils';
77
interface NostrRelayConfigDef extends NodeDef {
88
relay: string;
99
publicKey?: string;
10+
}
11+
12+
interface NostrRelayConfigCredentials {
1013
privateKey?: string;
1114
}
1215

13-
export interface NostrRelayConfig extends Node {
16+
export interface NostrRelayConfig extends Node<NostrRelayConfigCredentials> {
1417
relay: string;
1518
publicKey?: string;
1619
privateKey?: string;
@@ -24,7 +27,7 @@ export default function(RED: NodeAPI) {
2427

2528
this.relay = config.relay;
2629
this.publicKey = config.publicKey;
27-
this.privateKey = config.privateKey;
30+
this.privateKey = this.credentials?.privateKey;
2831

2932
// Set up keys based on mode
3033
if (this.publicKey && this.privateKey) {
@@ -83,5 +86,9 @@ export default function(RED: NodeAPI) {
8386
initializeNode.call(this, config).catch((err: any) => {
8487
this.error("Failed to initialize node: " + err.message);
8588
});
89+
}, {
90+
credentials: {
91+
privateKey: { type: "password" }
92+
}
8693
});
8794
}

0 commit comments

Comments
 (0)