lint fix wip
This commit is contained in:
parent
07b9d9d7bb
commit
9e364d0313
@ -124,8 +124,8 @@ export async function parsePresentationEvent(event: Event): Promise<import('@/ty
|
||||
if (tags.json) {
|
||||
try {
|
||||
profileData = JSON.parse(tags.json)
|
||||
} catch (e) {
|
||||
console.error('Error parsing JSON from tag:', e)
|
||||
} catch (jsonError) {
|
||||
console.error('Error parsing JSON from tag:', jsonError)
|
||||
}
|
||||
}
|
||||
|
||||
@ -138,8 +138,8 @@ export async function parsePresentationEvent(event: Event): Promise<import('@/ty
|
||||
// Remove zero-width characters from JSON
|
||||
const cleanedJson = invisibleJsonMatch[1].replace(/[\u200B\u200C\u200D\u200E\u200F]/g, '').trim()
|
||||
profileData = JSON.parse(cleanedJson)
|
||||
} catch (e) {
|
||||
console.error('Error parsing profile JSON from invisible content:', e)
|
||||
} catch (invisibleJsonError) {
|
||||
console.error('Error parsing profile JSON from invisible content:', invisibleJsonError)
|
||||
}
|
||||
}
|
||||
|
||||
@ -149,8 +149,8 @@ export async function parsePresentationEvent(event: Event): Promise<import('@/ty
|
||||
if (jsonMatch?.[1]) {
|
||||
try {
|
||||
profileData = JSON.parse(jsonMatch[1].trim())
|
||||
} catch (e) {
|
||||
console.error('Error parsing profile JSON from content:', e)
|
||||
} catch (contentJsonError) {
|
||||
console.error('Error parsing profile JSON from content:', contentJsonError)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -24,7 +24,6 @@ async function getOrCreateMasterKey(): Promise<string> {
|
||||
if (typeof window === 'undefined') {
|
||||
throw new Error('Storage encryption requires browser environment')
|
||||
}
|
||||
const { storageService } = await import('./storage/indexedDB')
|
||||
const existing = await storageService.get<string>(MASTER_KEY_STORAGE_KEY, 'article_storage')
|
||||
if (existing) {
|
||||
return existing
|
||||
|
||||
@ -379,8 +379,8 @@ export async function unlockAccountTwoLevel(
|
||||
recoveryPhrase.fill('')
|
||||
|
||||
// Step 4: Get encrypted private key from IndexedDB
|
||||
const { storageService } = await import('./storage/indexedDB')
|
||||
const encryptedPrivateKey = await storageService.get<EncryptedPayload>('nostr_encrypted_key', 'nostr_key_storage')
|
||||
const { storageService: indexedDBStorage } = await import('./storage/indexedDB')
|
||||
const encryptedPrivateKey = await indexedDBStorage.get<EncryptedPayload>('nostr_encrypted_key', 'nostr_key_storage')
|
||||
if (!encryptedPrivateKey) {
|
||||
throw new Error('No encrypted private key found in IndexedDB')
|
||||
}
|
||||
@ -409,8 +409,8 @@ export async function unlockAccountTwoLevel(
|
||||
*/
|
||||
export async function accountExistsTwoLevel(): Promise<boolean> {
|
||||
try {
|
||||
const { storageService } = await import('./storage/indexedDB')
|
||||
const exists = await storageService.get<boolean>('nostr_account_exists', 'nostr_key_storage')
|
||||
const { storageService: indexedDBStorage } = await import('./storage/indexedDB')
|
||||
const exists = await indexedDBStorage.get<boolean>('nostr_account_exists', 'nostr_key_storage')
|
||||
return exists === true
|
||||
} catch {
|
||||
return false
|
||||
@ -422,8 +422,8 @@ export async function accountExistsTwoLevel(): Promise<boolean> {
|
||||
*/
|
||||
export async function getPublicKeysTwoLevel(): Promise<{ publicKey: string; npub: string } | null> {
|
||||
try {
|
||||
const { storageService } = await import('./storage/indexedDB')
|
||||
return storageService.get<{ publicKey: string; npub: string }>('nostr_public_key', 'nostr_key_storage')
|
||||
const { storageService: indexedDBStorage } = await import('./storage/indexedDB')
|
||||
return indexedDBStorage.get<{ publicKey: string; npub: string }>('nostr_public_key', 'nostr_key_storage')
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
@ -433,10 +433,10 @@ export async function getPublicKeysTwoLevel(): Promise<{ publicKey: string; npub
|
||||
* Delete account (remove all stored data)
|
||||
*/
|
||||
export async function deleteAccountTwoLevel(): Promise<void> {
|
||||
const { storageService } = await import('./storage/indexedDB')
|
||||
await storageService.delete('nostr_encrypted_key')
|
||||
await storageService.delete('nostr_public_key')
|
||||
await storageService.delete('nostr_account_exists')
|
||||
const { storageService: indexedDBStorage } = await import('./storage/indexedDB')
|
||||
await indexedDBStorage.delete('nostr_encrypted_key')
|
||||
await indexedDBStorage.delete('nostr_public_key')
|
||||
await indexedDBStorage.delete('nostr_account_exists')
|
||||
|
||||
// Try to remove credential (may not be possible via API)
|
||||
if (navigator.credentials && navigator.credentials.preventSilentAccess) {
|
||||
|
||||
@ -168,13 +168,13 @@ export function getPurchasesByPayer(payerPubkey: string, timeoutMs: number = 500
|
||||
}
|
||||
|
||||
sub.on('event', async (event: Event): Promise<void> => {
|
||||
const parsed = await parsePurchaseFromEvent(event)
|
||||
if (parsed) {
|
||||
const purchaseParsed = await parsePurchaseFromEvent(event)
|
||||
if (purchaseParsed) {
|
||||
// Cache the parsed purchase
|
||||
if (parsed.hash) {
|
||||
await objectCache.set('purchase', parsed.hash, event, parsed, 0, false, parsed.index)
|
||||
if (purchaseParsed.hash) {
|
||||
await objectCache.set('purchase', purchaseParsed.hash, event, purchaseParsed, 0, false, purchaseParsed.index ?? 0)
|
||||
}
|
||||
results.push(parsed)
|
||||
results.push(purchaseParsed)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@ -135,13 +135,13 @@ export function getReviewTipsForArticle(articleId: string, timeoutMs: number = 5
|
||||
}
|
||||
|
||||
sub.on('event', async (event: Event): Promise<void> => {
|
||||
const parsed = await parseReviewTipFromEvent(event)
|
||||
if (parsed?.articleId === articleId) {
|
||||
const reviewTipParsed = await parseReviewTipFromEvent(event)
|
||||
if (reviewTipParsed?.articleId === articleId) {
|
||||
// Cache the parsed review tip
|
||||
if (parsed.hash) {
|
||||
await objectCache.set('review_tip', parsed.hash, event, parsed, 0, false, parsed.index)
|
||||
if (reviewTipParsed.hash) {
|
||||
await objectCache.set('review_tip', reviewTipParsed.hash, event, reviewTipParsed, 0, false, reviewTipParsed.index ?? 0)
|
||||
}
|
||||
results.push(parsed)
|
||||
results.push(reviewTipParsed)
|
||||
}
|
||||
})
|
||||
|
||||
@ -177,13 +177,13 @@ export function getReviewTipsForReview(reviewId: string, timeoutMs: number = 500
|
||||
}
|
||||
|
||||
sub.on('event', async (event: Event): Promise<void> => {
|
||||
const parsed = await parseReviewTipFromEvent(event)
|
||||
if (parsed?.reviewId === reviewId) {
|
||||
const reviewTipParsed = await parseReviewTipFromEvent(event)
|
||||
if (reviewTipParsed?.reviewId === reviewId) {
|
||||
// Cache the parsed review tip
|
||||
if (parsed.hash) {
|
||||
await objectCache.set('review_tip', parsed.hash, event, parsed, 0, false, parsed.index)
|
||||
if (reviewTipParsed.hash) {
|
||||
await objectCache.set('review_tip', reviewTipParsed.hash, event, reviewTipParsed, 0, false, reviewTipParsed.index ?? 0)
|
||||
}
|
||||
results.push(parsed)
|
||||
results.push(reviewTipParsed)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user