Remove legacy Nostr keypair authentication and fix auth service integration
- Remove obsolete LogoutDialog component that displayed private keys - Replace nostrStore.account references with authService.user in market module - Fix property access paths to use authService.user.value instead of currentUser - Update connection state checks to use relayHub instead of nostrStore - Clean up TODOs and remove unused nostrStore imports
This commit is contained in:
parent
30b9089829
commit
92c33aa0a3
3 changed files with 9 additions and 125 deletions
|
|
@ -1,5 +1,4 @@
|
|||
import { ref, computed, onMounted, onUnmounted, readonly } from 'vue'
|
||||
import { useNostrStore } from '@/stores/nostr'
|
||||
import { useMarketStore } from '../stores/market'
|
||||
import { injectService, SERVICE_TOKENS } from '@/core/di-container'
|
||||
import { config } from '@/lib/config'
|
||||
|
|
@ -16,7 +15,6 @@ const MARKET_EVENT_KINDS = {
|
|||
} as const
|
||||
|
||||
export function useMarket() {
|
||||
const nostrStore = useNostrStore()
|
||||
const marketStore = useMarketStore()
|
||||
const relayHub = injectService(SERVICE_TOKENS.RELAY_HUB) as any
|
||||
const authService = injectService(SERVICE_TOKENS.AUTH_SERVICE) as any
|
||||
|
|
@ -61,7 +59,7 @@ export function useMarket() {
|
|||
const connectionStatus = computed(() => {
|
||||
if (connectionOperation.isLoading.value) return 'connecting'
|
||||
if (isConnected.value) return 'connected'
|
||||
if (connectionOperation.error.value || nostrStore.error) return 'error'
|
||||
if (connectionOperation.error.value || authService.error) return 'error'
|
||||
return 'disconnected'
|
||||
})
|
||||
|
||||
|
|
@ -69,10 +67,9 @@ export function useMarket() {
|
|||
const loadMarket = async (naddr: string) => {
|
||||
return await marketOperation.execute(async () => {
|
||||
// Parse naddr to get market data
|
||||
// TODO: Confirm if this should use nostrStore.account?.pubkey or authService.user.value?.pubkey
|
||||
const marketData = {
|
||||
identifier: naddr.split(':')[2] || 'default',
|
||||
pubkey: naddr.split(':')[1] || nostrStore.account?.pubkey || ''
|
||||
pubkey: naddr.split(':')[1] || authService.user.value?.pubkey || ''
|
||||
}
|
||||
|
||||
if (!marketData.pubkey) {
|
||||
|
|
@ -349,11 +346,9 @@ export function useMarket() {
|
|||
// Subscribe to order-related DMs (payment requests, status updates)
|
||||
const subscribeToOrderUpdates = (): (() => void) | null => {
|
||||
try {
|
||||
// TODO: Confirm if this should use nostrStore.account?.pubkey or authService.user.value?.pubkey
|
||||
const userPubkey = nostrStore.account?.pubkey || authService.user.value?.pubkey
|
||||
const userPubkey = authService.user.value?.pubkey
|
||||
if (!userPubkey) {
|
||||
console.warn('Cannot subscribe to order updates: no user pubkey available', {
|
||||
nostrStorePubkey: nostrStore.account?.pubkey,
|
||||
authServicePubkey: authService.user.value?.pubkey,
|
||||
isAuthenticated: authService.isAuthenticated.value
|
||||
})
|
||||
|
|
@ -389,12 +384,10 @@ export function useMarket() {
|
|||
try {
|
||||
console.log('🔔 Received order-related DM:', event.id, 'from:', event.pubkey.slice(0, 8))
|
||||
|
||||
// TODO: Confirm if this should use nostrStore.account?.pubkey or authService.user.value?.pubkey
|
||||
const userPrivkey = nostrStore.account?.privkey || authService.user.value?.prvkey
|
||||
const userPrivkey = authService.user.value?.prvkey
|
||||
|
||||
if (!userPrivkey) {
|
||||
console.warn('Cannot decrypt DM: no user private key available', {
|
||||
nostrStorePrivkey: !!nostrStore.account?.privkey,
|
||||
authServicePrivkey: !!authService.user.value?.prvkey
|
||||
})
|
||||
return
|
||||
|
|
@ -575,10 +568,9 @@ export function useMarket() {
|
|||
|
||||
// Load market data
|
||||
console.log('🛒 Loading basic market data...')
|
||||
// TODO: Confirm if this should use nostrStore.account?.pubkey or authService.user.value?.pubkey
|
||||
await loadMarketData({
|
||||
identifier: 'default',
|
||||
pubkey: nostrStore.account?.pubkey || ''
|
||||
pubkey: authService.user.value?.pubkey || ''
|
||||
})
|
||||
|
||||
// Load stalls and products only if connected
|
||||
|
|
@ -614,7 +606,7 @@ export function useMarket() {
|
|||
|
||||
// Initialize market on mount
|
||||
onMounted(async () => {
|
||||
if (nostrStore.isConnected) {
|
||||
if (relayHub.isConnected.value) {
|
||||
await connectToMarket()
|
||||
}
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue