feat: implement three-phase Amber login flow in AuthModal
- Updated Amber login button to reflect new three-phase process. - Added handling for reading public key and signature from clipboard. - Introduced new state management for Amber login phases. - Enhanced user feedback during each phase with appropriate messaging. - Refactored related functions for clarity and maintainability.
This commit is contained in:
@@ -243,9 +243,19 @@ export const useAuthStore = defineStore('auth', () => {
|
||||
}
|
||||
|
||||
/**
|
||||
* Login with Nostr signature
|
||||
* Login with Nostr signature.
|
||||
*
|
||||
* @param preSignedAuthHeader Optional pre-built `Nostr <base64>` header.
|
||||
* When provided the active signer is NOT called for NIP-98 signing.
|
||||
* This is required for Amber / clipboard-based signers that cannot
|
||||
* sign events inline.
|
||||
*/
|
||||
async function loginWithNostr(pubkey: string, signature: string, event: any) {
|
||||
async function loginWithNostr(
|
||||
pubkey: string,
|
||||
signature: string,
|
||||
event: any,
|
||||
preSignedAuthHeader?: string,
|
||||
) {
|
||||
isLoading.value = true
|
||||
|
||||
// Mock Nostr login helper
|
||||
@@ -271,12 +281,12 @@ export const useAuthStore = defineStore('auth', () => {
|
||||
}
|
||||
|
||||
// Real API call — creates NIP-98 signed session via the active
|
||||
// Nostr account in accountManager (set by useAccounts before this call)
|
||||
const response = await authService.createNostrSession({
|
||||
pubkey,
|
||||
signature,
|
||||
event,
|
||||
})
|
||||
// Nostr account in accountManager (set by useAccounts before this call).
|
||||
// When preSignedAuthHeader is provided the signer is bypassed.
|
||||
const response = await authService.createNostrSession(
|
||||
{ pubkey, signature, event },
|
||||
preSignedAuthHeader,
|
||||
)
|
||||
|
||||
nostrPubkey.value = pubkey
|
||||
authType.value = 'nostr'
|
||||
|
||||
Reference in New Issue
Block a user