2 Commits

Author SHA1 Message Date
Your Name
cb4f4b2a3c Remove more logs 2025-11-14 14:31:40 -04:00
Your Name
05a5306f86 Reorganize directories 2025-11-14 13:59:08 -04:00
9 changed files with 57 additions and 57 deletions

View File

@@ -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:45:29.274Z
* 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.9';
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);
}

View File

@@ -1,3 +1,3 @@
#!/bin/bash
rsync -avz --chmod=644 --progress lite/{nostr-lite.js,nostr.bundle.js} ubuntu@laantungir.net:html/nostr-login-lite/
rsync -avz --chmod=644 --progress build/{nostr-lite.js,nostr.bundle.js} ubuntu@laantungir.net:html/nostr-login-lite/

View File

@@ -55,14 +55,14 @@ new_tag="v$new_version"
echo -e "${GREEN}📈 Incrementing version: $current_version$new_version${NC}"
# Step 2.5: Save version to lite/VERSION file
echo -e "${YELLOW}💾 Saving version to lite/VERSION...${NC}"
echo "$new_version" > lite/VERSION
# Step 2.5: Save version to src/VERSION file
echo -e "${YELLOW}💾 Saving version to src/VERSION...${NC}"
echo "$new_version" > src/VERSION
echo -e "Version saved: ${GREEN}$new_version${NC}"
# Step 2.5: Run build.js
echo -e "${YELLOW}🔧 Running build process...${NC}"
cd lite
cd src
node build.js
cd ..
echo -e "${GREEN}✅ Build completed${NC}"
@@ -100,8 +100,8 @@ git push --tags
echo -e "${GREEN}🎉 Successfully completed:${NC}"
echo -e " • Version incremented to: ${GREEN}$new_version${NC}"
echo -e " • VERSION file updated: ${GREEN}lite/VERSION${NC}"
echo -e " • Build completed: ${GREEN}lite/nostr-lite.js${NC}"
echo -e " • VERSION file updated: ${GREEN}src/VERSION${NC}"
echo -e " • Build completed: ${GREEN}build/nostr-lite.js${NC}"
echo -e " • Git tag created: ${GREEN}$new_tag${NC}"
echo -e " • Changes pushed to remote${NC}"
echo -e "\n${GREEN}✨ Process complete!${NC}"

View File

@@ -1 +0,0 @@
0.1.9

1
src/VERSION Normal file
View File

@@ -0,0 +1 @@
0.1.11

View File

@@ -24,7 +24,7 @@ const path = require('path');
function createNostrLoginLiteBundle() {
// console.log('🔧 Creating NOSTR_LOGIN_LITE bundle for two-file architecture...');
const outputPath = path.join(__dirname, 'nostr-lite.js');
const outputPath = path.join(__dirname, '../build/nostr-lite.js');
// Remove old bundle
try {
@@ -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);
}