This commit is contained in:
mr0x50
2025-02-02 11:48:34 +01:00
parent 9f4e0cb780
commit 0f9664a18b
2 changed files with 22 additions and 2 deletions

View File

@@ -10,6 +10,7 @@ import { Inter } from "next/font/google";
import { Toaster } from "@/components/ui/toaster"
import Script from "next/script";
import Umami from "@/components/Umami";
import { useEffect } from "react";
const inter = Inter({ subsets: ["latin"] });
@@ -19,6 +20,15 @@ export default function RootLayout({
children: React.ReactNode;
}>) {
useEffect(() => {
// handle Amber Sign Response
const urlParams = new URLSearchParams(window.location.search);
const amberSignResponse = urlParams.get('amberSignResponse');
if (amberSignResponse !== null) {
alert(amberSignResponse);
}
}, []);
const relayUrls = [
"wss://relay.nostr.band",
"wss://relay.damus.io",

View File

@@ -31,8 +31,18 @@ export async function signEvent(loginType: string | null, event: NostrEvent): Pr
eventSigned = await window.nostr.signEvent(event);
} else if (loginType === 'amber') {
// TODO: Sign event with amber
alert('Signing with Amber is not implemented yet, sorry!');
return null;
// alert('Signing with Amber is not implemented yet, sorry!');
// return null;
// get the full current url of the user
let callbackUrl = window.location.host + window.location.pathname;
console.log(callbackUrl);
if (!callbackUrl) {
throw new Error("Callback URL is null or undefined but needed for Amber Signing");
}
const intent = `intent:#Intent;scheme=nostrsigner;S.compressionType=gzip;S.returnType=signature;S.type=get_public_key;S.callbackUrl=http://${callbackUrl}?amberSignResponse=;end`;
window.location.href = intent;
} else if (loginType === 'raw_nsec') {
if (typeof window !== 'undefined') {
let nsecStr = null;