remove old stuff
This commit is contained in:
parent
1a7681a908
commit
9088e9f9c6
1 changed files with 0 additions and 31 deletions
|
|
@ -1,31 +0,0 @@
|
||||||
async function login() {
|
|
||||||
if (!window.nostr) {
|
|
||||||
console.log("No Nostr extension found.");
|
|
||||||
return { success: false, error: "No Nostr extension detected." };
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
const challengeResponse = await fetch("/api/nostr-challenge");
|
|
||||||
if (!challengeResponse.ok) throw new Error("Failed to fetch challenge");
|
|
||||||
const { challenge } = await challengeResponse.json();
|
|
||||||
|
|
||||||
const pubkey = await window.nostr.getPublicKey();
|
|
||||||
|
|
||||||
const event = {
|
|
||||||
kind: 22242,
|
|
||||||
created_at: Math.floor(Date.now() / 1000),
|
|
||||||
tags: [["challenge", challenge]],
|
|
||||||
content: "Sign this challenge to authenticate",
|
|
||||||
pubkey: pubkey
|
|
||||||
};
|
|
||||||
|
|
||||||
const signedEvent = await window.nostr.signEvent(event);
|
|
||||||
|
|
||||||
const verifyResponse = await fetch("/api/nostr-verify", {
|
|
||||||
method: "POST",
|
|
||||||
headers: { "Content-Type": "application/json" },
|
|
||||||
body: JSON.stringify(signedEvent),
|
|
||||||
});
|
|
||||||
|
|
||||||
} catch (error) { }
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue