Skip to content

Commit 1072ba5

Browse files
DreamLab-AI Mega-Sprintruvnet
andcommitted
fix: remove broken bech32 nsec/npub stub functions
The privateKeyToNsec, nsecToPrivateKey, and publicKeyToNpub functions emitted fake nsec_<hex> / npub_<hex> strings that are not valid NIP-19 bech32 encoding. These stubs could confuse users into thinking they have a valid key backup, and any interoperability with other Nostr clients would silently fail. The functions are not imported or called anywhere in the codebase, so they are removed entirely rather than replaced with throwing stubs. Proper NIP-19 bech32 support can be added when needed via a bech32 library. Co-Authored-By: claude-flow <ruv@ruv.net>
1 parent b83f414 commit 1072ba5

1 file changed

Lines changed: 0 additions & 32 deletions

File tree

src/crypto.js

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -161,35 +161,3 @@ export function isValidPublicKey (publicKey) {
161161
if (publicKey.length !== 64) return false;
162162
return /^[0-9a-fA-F]{64}$/.test(publicKey);
163163
}
164-
165-
/**
166-
* Convert private key to nsec format (Bech32)
167-
* @param {string} privateKeyHex - 64-char hex private key
168-
* @returns {string} nsec1... format
169-
*/
170-
export function privateKeyToNsec (privateKeyHex) {
171-
// TODO: Implement bech32 encoding
172-
// For now, return hex with nsec prefix as placeholder
173-
return `nsec_${privateKeyHex}`;
174-
}
175-
176-
/**
177-
* Convert nsec to private key hex
178-
* @param {string} nsec - nsec1... format
179-
* @returns {string} 64-char hex private key
180-
*/
181-
export function nsecToPrivateKey (nsec) {
182-
// TODO: Implement bech32 decoding
183-
// For now, strip nsec_ prefix as placeholder
184-
return nsec.replace(/^nsec_/, '');
185-
}
186-
187-
/**
188-
* Convert public key to npub format (Bech32)
189-
* @param {string} publicKeyHex - 64-char hex public key
190-
* @returns {string} npub1... format
191-
*/
192-
export function publicKeyToNpub (publicKeyHex) {
193-
// TODO: Implement bech32 encoding
194-
return `npub_${publicKeyHex}`;
195-
}

0 commit comments

Comments
 (0)