Nostr_Login_Lite =========== ## API Configure for login/logout: ```javascript await window.NOSTR_LOGIN_LITE.init({ theme: 'default', methods: { extension: true, local: true, seedphrase: true, // ✅ Must be explicitly enabled readonly: true, connect: true, otp: false }, floatingTab: { enabled: true, hPosition: 0.95, // Near right edge vPosition: 0.1, // Near top appearance: { style: 'pill', icon: '[LOGIN]', text: 'Sign In', iconOnly: false }, behavior: { hideWhenAuthenticated: false, // Keep visible after login showUserInfo: true, autoSlide: true }, getUserInfo: true, // ✅ Fetch user profiles getUserRelay: ['wss://relay.laantungir.net'] // Custom relays for profiles } }); // After initialization, you can switch themes dynamically: NOSTR_LOGIN_LITE.switchTheme('dark'); NOSTR_LOGIN_LITE.switchTheme('default'); // Or customize individual theme variables: NOSTR_LOGIN_LITE.setThemeVariable('--nl-accent-color', '#00ff00'); ``` Control methods: ```javascript NOSTR_LOGIN_LITE.showFloatingTab(); NOSTR_LOGIN_LITE.hideFloatingTab(); NOSTR_LOGIN_LITE.updateFloatingTab(options); NOSTR_LOGIN_LITE.destroyFloatingTab(); ``` ## Embedded Modal API Embed login interface directly into page element: ```javascript // Initialize library first await NOSTR_LOGIN_LITE.init({ methods: { extension: true, local: true, readonly: true } }); // Embed into container const modal = NOSTR_LOGIN_LITE.embed('#login-container', { title: 'Login', showHeader: true, seamless: false // true = no borders/shadows, blends into page }); ``` Container can be CSS selector or DOM element. Modal renders inline without backdrop overlay. ## Logout API To log out users and clear authentication state: ```javascript // Unified logout method - works for all authentication methods window.NOSTR_LOGIN_LITE.logout(); ``` This will: - Clear persistent authentication data from localStorage - Dispatch `nlLogout` event for custom cleanup - Reset the authentication state across all components ### Event Handling Listen for logout events in your application: ```javascript window.addEventListener('nlLogout', () => { console.log('User logged out'); // Clear your application's UI state // Redirect to login page, etc. }); ``` The logout system works consistently across all authentication methods (extension, local keys, NIP-46, etc.) and all UI components (floating tab, modal, embedded).