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