mirror of
https://github.com/lumina-rocks/lumina.git
synced 2026-06-06 18:51:16 +02:00
add NIP-46 support (#61)
Co-authored-by: highperfocused <highperfocused@pm.me>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { Event as NostrEvent, finalizeEvent} from "nostr-tools";
|
||||
import { hexToBytes } from "@noble/hashes/utils"
|
||||
import { signEventWithBunker } from "./bunkerUtils";
|
||||
|
||||
export function getImageUrl(tags: string[][]): string {
|
||||
const imetaTag = tags.find(tag => tag[0] === 'imeta');
|
||||
@@ -33,6 +34,15 @@ export async function signEvent(loginType: string | null, event: NostrEvent): Pr
|
||||
// TODO: Sign event with amber
|
||||
alert('Signing with Amber is not implemented yet, sorry!');
|
||||
return null;
|
||||
} else if (loginType === 'bunker') {
|
||||
// Sign with bunker (NIP-46)
|
||||
const signedWithBunker = await signEventWithBunker(event);
|
||||
if (signedWithBunker) {
|
||||
return signedWithBunker;
|
||||
} else {
|
||||
alert('Failed to sign with bunker. Please check your connection and try again.');
|
||||
return null;
|
||||
}
|
||||
} else if (loginType === 'raw_nsec') {
|
||||
if (typeof window !== 'undefined') {
|
||||
let nsecStr = null;
|
||||
|
||||
Reference in New Issue
Block a user