diff --git a/build/nostr-lite.js b/build/nostr-lite.js index 8d986bd..ff4057b 100644 --- a/build/nostr-lite.js +++ b/build/nostr-lite.js @@ -8,7 +8,7 @@ * Two-file architecture: * 1. Load nostr.bundle.js (official nostr-tools bundle) * 2. Load nostr-lite.js (this file - NOSTR_LOGIN_LITE library with CSS-only themes) - * Generated on: 2025-11-14T17:59:08.754Z + * Generated on: 2025-11-14T18:31:40.699Z */ // Verify dependencies are loaded @@ -436,7 +436,7 @@ class Modal { modalContent.appendChild(modalHeader); // Add version element in bottom-right corner aligned with modal body const versionElement = document.createElement('div'); - versionElement.textContent = 'v0.1.10'; + versionElement.textContent = 'v0.1.11'; versionElement.style.cssText = ` position: absolute; bottom: 8px; @@ -3404,10 +3404,10 @@ class AuthManager { // Configure storage type based on isolateSession option if (options.isolateSession) { this.storage = sessionStorage; - console.log('🔐 AuthManager: Using sessionStorage for per-window isolation'); + // console.log('🔐 AuthManager: Using sessionStorage for per-window isolation'); } else { this.storage = localStorage; - console.log('🔐 AuthManager: Using localStorage for cross-window persistence'); + // console.log('🔐 AuthManager: Using localStorage for cross-window persistence'); } console.warn('🔐 SECURITY: Private keys stored unencrypted in browser storage'); @@ -3417,7 +3417,7 @@ class AuthManager { // Save authentication state using unified plaintext approach async saveAuthState(authData) { try { - console.log('🔐 AuthManager: Saving auth state with plaintext storage'); + // console.log('🔐 AuthManager: Saving auth state with plaintext storage'); console.warn('🔐 SECURITY: Private key will be stored unencrypted for maximum usability'); const authState = { @@ -3434,14 +3434,14 @@ class AuthManager { hasGetPublicKey: typeof authData.extension?.getPublicKey === 'function', hasSignEvent: typeof authData.extension?.signEvent === 'function' }; - console.log('🔐 AuthManager: Extension method - storing verification data only'); + // console.log('🔐 AuthManager: Extension method - storing verification data only'); break; case 'local': // UNIFIED PLAINTEXT: Store secret key directly for maximum compatibility if (authData.secret) { authState.secret = authData.secret; - console.log('🔐 AuthManager: Local method - storing secret key in plaintext'); + // console.log('🔐 AuthManager: Local method - storing secret key in plaintext'); console.warn('🔐 SECURITY: Secret key stored unencrypted for developer convenience'); } break; @@ -3454,13 +3454,13 @@ class AuthManager { relays: authData.signer.relays, // Don't store secret - user will need to reconnect }; - console.log('🔐 AuthManager: NIP-46 method - storing connection parameters'); + // console.log('🔐 AuthManager: NIP-46 method - storing connection parameters'); } break; case 'readonly': // Read-only mode has no secrets to store - console.log('🔐 AuthManager: Read-only method - storing basic auth state'); + // console.log('🔐 AuthManager: Read-only method - storing basic auth state'); break; default: @@ -3469,7 +3469,7 @@ class AuthManager { this.storage.setItem(this.storageKey, JSON.stringify(authState)); this.currentAuthState = authState; - console.log('🔐 AuthManager: Auth state saved successfully for method:', authData.method); + // console.log('🔐 AuthManager: Auth state saved successfully for method:', authData.method); } catch (error) { console.error('🔐 AuthManager: Failed to save auth state:', error); @@ -3707,17 +3707,17 @@ class AuthManager { } async _restoreLocalAuth(authState) { - console.log('🔐 AuthManager: === _restoreLocalAuth (Unified Plaintext) ==='); + // console.log('🔐 AuthManager: === _restoreLocalAuth (Unified Plaintext) ==='); // Check for legacy encrypted format first if (authState.encrypted) { - console.log('🔐 AuthManager: Detected LEGACY encrypted format - migrating to plaintext'); + // console.log('🔐 AuthManager: Detected LEGACY encrypted format - migrating to plaintext'); console.warn('🔐 SECURITY: Converting from encrypted to plaintext storage for compatibility'); // Try to decrypt legacy format const sessionPassword = sessionStorage.getItem('nostr_session_key'); if (!sessionPassword) { - console.log('🔐 AuthManager: Legacy session password not found - user must re-login'); + // console.log('🔐 AuthManager: Legacy session password not found - user must re-login'); return null; } @@ -3734,11 +3734,11 @@ class AuthManager { // NEW UNIFIED PLAINTEXT FORMAT if (!authState.secret) { - console.log('🔐 AuthManager: No secret found in plaintext format'); + // console.log('🔐 AuthManager: No secret found in plaintext format'); return null; } - console.log('🔐 AuthManager: ✅ Local auth restored from plaintext storage'); + // console.log('🔐 AuthManager: ✅ Local auth restored from plaintext storage'); console.warn('🔐 SECURITY: Secret key was stored unencrypted'); return { @@ -3750,14 +3750,14 @@ class AuthManager { async _restoreNip46Auth(authState) { if (!authState.nip46) { - console.log('🔐 AuthManager: No NIP-46 data found'); + // console.log('🔐 AuthManager: No NIP-46 data found'); return null; } // For NIP-46, we can't automatically restore the connection // because it requires the user to re-authenticate with the remote signer // Instead, we return the connection parameters so the UI can prompt for reconnection - console.log('🔐 AuthManager: NIP-46 connection data found, requires user reconnection'); + // console.log('🔐 AuthManager: NIP-46 connection data found, requires user reconnection'); return { method: 'nip46', pubkey: authState.pubkey, @@ -3767,7 +3767,7 @@ class AuthManager { } async _restoreReadonlyAuth(authState) { - console.log('🔐 AuthManager: Read-only auth restored successfully'); + // console.log('🔐 AuthManager: Read-only auth restored successfully'); return { method: 'readonly', pubkey: authState.pubkey @@ -3779,7 +3779,7 @@ class AuthManager { this.storage.removeItem(this.storageKey); sessionStorage.removeItem('nostr_session_key'); // Clear legacy session key this.currentAuthState = null; - console.log('🔐 AuthManager: Auth state cleared from unified storage'); + // console.log('🔐 AuthManager: Auth state cleared from unified storage'); } // Check if we have valid stored auth @@ -3822,7 +3822,7 @@ function getGlobalAuthManager() { // **UNIFIED GLOBAL FUNCTION**: Set authentication state (works for all methods) function setAuthState(authData, options = {}) { try { - console.log('🌐 setAuthState: Setting global auth state for method:', authData.method); + // console.log('🌐 setAuthState: Setting global auth state for method:', authData.method); console.warn('🔐 SECURITY: Using unified plaintext storage for maximum compatibility'); // Store in memory @@ -3832,7 +3832,7 @@ function setAuthState(authData, options = {}) { const authManager = new AuthManager(options); authManager.saveAuthState(authData); - console.log('🌐 setAuthState: Auth state saved successfully'); + // console.log('🌐 setAuthState: Auth state saved successfully'); } catch (error) { console.error('🌐 setAuthState: Failed to save auth state:', error); throw error; @@ -3855,13 +3855,13 @@ function getAuthState() { } if (!stored) { - console.log('🌐 getAuthState: No auth state found in storage'); + // console.log('🌐 getAuthState: No auth state found in storage'); globalAuthState = null; return null; } const authState = JSON.parse(stored); - console.log('🌐 getAuthState: Retrieved auth state:', authState.method); + // console.log('🌐 getAuthState: Retrieved auth state:', authState.method); // Update in-memory cache globalAuthState = authState; @@ -3877,7 +3877,7 @@ function getAuthState() { // **UNIFIED GLOBAL FUNCTION**: Clear authentication state (works for all methods) function clearAuthState() { try { - console.log('🌐 clearAuthState: Clearing global auth state'); + // console.log('🌐 clearAuthState: Clearing global auth state'); // Clear in-memory state globalAuthState = null; @@ -3888,7 +3888,7 @@ function clearAuthState() { sessionStorage.removeItem(storageKey); sessionStorage.removeItem('nostr_session_key'); // Clear legacy session key - console.log('🌐 clearAuthState: Auth state cleared from all storage locations'); + // console.log('🌐 clearAuthState: Auth state cleared from all storage locations'); } catch (error) { console.error('🌐 clearAuthState: Failed to clear auth state:', error); } diff --git a/src/VERSION b/src/VERSION index 9767cc9..20f4951 100644 --- a/src/VERSION +++ b/src/VERSION @@ -1 +1 @@ -0.1.10 +0.1.11 diff --git a/src/build.js b/src/build.js index 4210974..927cb44 100644 --- a/src/build.js +++ b/src/build.js @@ -1393,10 +1393,10 @@ class AuthManager { // Configure storage type based on isolateSession option if (options.isolateSession) { this.storage = sessionStorage; - console.log('🔐 AuthManager: Using sessionStorage for per-window isolation'); + // console.log('🔐 AuthManager: Using sessionStorage for per-window isolation'); } else { this.storage = localStorage; - console.log('🔐 AuthManager: Using localStorage for cross-window persistence'); + // console.log('🔐 AuthManager: Using localStorage for cross-window persistence'); } console.warn('🔐 SECURITY: Private keys stored unencrypted in browser storage'); @@ -1406,7 +1406,7 @@ class AuthManager { // Save authentication state using unified plaintext approach async saveAuthState(authData) { try { - console.log('🔐 AuthManager: Saving auth state with plaintext storage'); + // console.log('🔐 AuthManager: Saving auth state with plaintext storage'); console.warn('🔐 SECURITY: Private key will be stored unencrypted for maximum usability'); const authState = { @@ -1423,14 +1423,14 @@ class AuthManager { hasGetPublicKey: typeof authData.extension?.getPublicKey === 'function', hasSignEvent: typeof authData.extension?.signEvent === 'function' }; - console.log('🔐 AuthManager: Extension method - storing verification data only'); + // console.log('🔐 AuthManager: Extension method - storing verification data only'); break; case 'local': // UNIFIED PLAINTEXT: Store secret key directly for maximum compatibility if (authData.secret) { authState.secret = authData.secret; - console.log('🔐 AuthManager: Local method - storing secret key in plaintext'); + // console.log('🔐 AuthManager: Local method - storing secret key in plaintext'); console.warn('🔐 SECURITY: Secret key stored unencrypted for developer convenience'); } break; @@ -1443,13 +1443,13 @@ class AuthManager { relays: authData.signer.relays, // Don't store secret - user will need to reconnect }; - console.log('🔐 AuthManager: NIP-46 method - storing connection parameters'); + // console.log('🔐 AuthManager: NIP-46 method - storing connection parameters'); } break; case 'readonly': // Read-only mode has no secrets to store - console.log('🔐 AuthManager: Read-only method - storing basic auth state'); + // console.log('🔐 AuthManager: Read-only method - storing basic auth state'); break; default: @@ -1458,7 +1458,7 @@ class AuthManager { this.storage.setItem(this.storageKey, JSON.stringify(authState)); this.currentAuthState = authState; - console.log('🔐 AuthManager: Auth state saved successfully for method:', authData.method); + // console.log('🔐 AuthManager: Auth state saved successfully for method:', authData.method); } catch (error) { console.error('🔐 AuthManager: Failed to save auth state:', error); @@ -1696,17 +1696,17 @@ class AuthManager { } async _restoreLocalAuth(authState) { - console.log('🔐 AuthManager: === _restoreLocalAuth (Unified Plaintext) ==='); + // console.log('🔐 AuthManager: === _restoreLocalAuth (Unified Plaintext) ==='); // Check for legacy encrypted format first if (authState.encrypted) { - console.log('🔐 AuthManager: Detected LEGACY encrypted format - migrating to plaintext'); + // console.log('🔐 AuthManager: Detected LEGACY encrypted format - migrating to plaintext'); console.warn('🔐 SECURITY: Converting from encrypted to plaintext storage for compatibility'); // Try to decrypt legacy format const sessionPassword = sessionStorage.getItem('nostr_session_key'); if (!sessionPassword) { - console.log('🔐 AuthManager: Legacy session password not found - user must re-login'); + // console.log('🔐 AuthManager: Legacy session password not found - user must re-login'); return null; } @@ -1723,11 +1723,11 @@ class AuthManager { // NEW UNIFIED PLAINTEXT FORMAT if (!authState.secret) { - console.log('🔐 AuthManager: No secret found in plaintext format'); + // console.log('🔐 AuthManager: No secret found in plaintext format'); return null; } - console.log('🔐 AuthManager: ✅ Local auth restored from plaintext storage'); + // console.log('🔐 AuthManager: ✅ Local auth restored from plaintext storage'); console.warn('🔐 SECURITY: Secret key was stored unencrypted'); return { @@ -1739,14 +1739,14 @@ class AuthManager { async _restoreNip46Auth(authState) { if (!authState.nip46) { - console.log('🔐 AuthManager: No NIP-46 data found'); + // console.log('🔐 AuthManager: No NIP-46 data found'); return null; } // For NIP-46, we can't automatically restore the connection // because it requires the user to re-authenticate with the remote signer // Instead, we return the connection parameters so the UI can prompt for reconnection - console.log('🔐 AuthManager: NIP-46 connection data found, requires user reconnection'); + // console.log('🔐 AuthManager: NIP-46 connection data found, requires user reconnection'); return { method: 'nip46', pubkey: authState.pubkey, @@ -1756,7 +1756,7 @@ class AuthManager { } async _restoreReadonlyAuth(authState) { - console.log('🔐 AuthManager: Read-only auth restored successfully'); + // console.log('🔐 AuthManager: Read-only auth restored successfully'); return { method: 'readonly', pubkey: authState.pubkey @@ -1768,7 +1768,7 @@ class AuthManager { this.storage.removeItem(this.storageKey); sessionStorage.removeItem('nostr_session_key'); // Clear legacy session key this.currentAuthState = null; - console.log('🔐 AuthManager: Auth state cleared from unified storage'); + // console.log('🔐 AuthManager: Auth state cleared from unified storage'); } // Check if we have valid stored auth @@ -1811,7 +1811,7 @@ function getGlobalAuthManager() { // **UNIFIED GLOBAL FUNCTION**: Set authentication state (works for all methods) function setAuthState(authData, options = {}) { try { - console.log('🌐 setAuthState: Setting global auth state for method:', authData.method); + // console.log('🌐 setAuthState: Setting global auth state for method:', authData.method); console.warn('🔐 SECURITY: Using unified plaintext storage for maximum compatibility'); // Store in memory @@ -1821,7 +1821,7 @@ function setAuthState(authData, options = {}) { const authManager = new AuthManager(options); authManager.saveAuthState(authData); - console.log('🌐 setAuthState: Auth state saved successfully'); + // console.log('🌐 setAuthState: Auth state saved successfully'); } catch (error) { console.error('🌐 setAuthState: Failed to save auth state:', error); throw error; @@ -1844,13 +1844,13 @@ function getAuthState() { } if (!stored) { - console.log('🌐 getAuthState: No auth state found in storage'); + // console.log('🌐 getAuthState: No auth state found in storage'); globalAuthState = null; return null; } const authState = JSON.parse(stored); - console.log('🌐 getAuthState: Retrieved auth state:', authState.method); + // console.log('🌐 getAuthState: Retrieved auth state:', authState.method); // Update in-memory cache globalAuthState = authState; @@ -1866,7 +1866,7 @@ function getAuthState() { // **UNIFIED GLOBAL FUNCTION**: Clear authentication state (works for all methods) function clearAuthState() { try { - console.log('🌐 clearAuthState: Clearing global auth state'); + // console.log('🌐 clearAuthState: Clearing global auth state'); // Clear in-memory state globalAuthState = null; @@ -1877,7 +1877,7 @@ function clearAuthState() { sessionStorage.removeItem(storageKey); sessionStorage.removeItem('nostr_session_key'); // Clear legacy session key - console.log('🌐 clearAuthState: Auth state cleared from all storage locations'); + // console.log('🌐 clearAuthState: Auth state cleared from all storage locations'); } catch (error) { console.error('🌐 clearAuthState: Failed to clear auth state:', error); }