fix: reverting signing of nostr auth token

This commit is contained in:
Davinci 2024-05-16 10:56:08 +02:00 committed by Yury
parent f80df772f8
commit 7db7e5de9e

View File

@ -45,6 +45,20 @@ export class AuthController {
console.error('Error occurred while finding metadata', err)
})
// Nostr uses unix timestamps
const timestamp = Math.floor(Date.now() / 1000)
const { hostname } = window.location
const authEvent: EventTemplate = {
kind: 1,
tags: [],
content: `${hostname}-${timestamp}`,
created_at: timestamp
}
const signedAuthEvent = await this.nostrController.signEvent(authEvent)
this.createAndSaveAuthToken(signedAuthEvent)
store.dispatch(
setAuthState({
loggedIn: true,