Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 0 additions & 32 deletions src/crypto.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,35 +161,3 @@ export function isValidPublicKey (publicKey) {
if (publicKey.length !== 64) return false;
return /^[0-9a-fA-F]{64}$/.test(publicKey);
}

/**
* Convert private key to nsec format (Bech32)
* @param {string} privateKeyHex - 64-char hex private key
* @returns {string} nsec1... format
*/
export function privateKeyToNsec (privateKeyHex) {
// TODO: Implement bech32 encoding
// For now, return hex with nsec prefix as placeholder
return `nsec_${privateKeyHex}`;
}

/**
* Convert nsec to private key hex
* @param {string} nsec - nsec1... format
* @returns {string} 64-char hex private key
*/
export function nsecToPrivateKey (nsec) {
// TODO: Implement bech32 decoding
// For now, strip nsec_ prefix as placeholder
return nsec.replace(/^nsec_/, '');
}

/**
* Convert public key to npub format (Bech32)
* @param {string} publicKeyHex - 64-char hex public key
* @returns {string} npub1... format
*/
export function publicKeyToNpub (publicKeyHex) {
// TODO: Implement bech32 encoding
return `npub_${publicKeyHex}`;
}