mirror of
https://github.com/hzrd149/nostrudel.git
synced 2025-09-25 11:13:30 +02:00
verify zaps with wasm
This commit is contained in:
@@ -11,3 +11,8 @@ export default function BackButton({ ...props }: Omit<IconButtonProps, "onClick"
|
|||||||
</IconButton>
|
</IconButton>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function BackIconButton({ ...props }: Omit<IconButtonProps, "onClick" | "children" | "aria-label">) {
|
||||||
|
const navigate = useNavigate();
|
||||||
|
return <IconButton icon={<ChevronLeftIcon />} aria-label="Back" {...props} onClick={() => navigate(-1)} />;
|
||||||
|
}
|
||||||
|
@@ -3,7 +3,8 @@ import { isETag, isPTag, NostrEvent } from "../../types/nostr-event";
|
|||||||
import { ParsedInvoice, parsePaymentRequest } from "../bolt11";
|
import { ParsedInvoice, parsePaymentRequest } from "../bolt11";
|
||||||
|
|
||||||
import { Kind0ParsedContent } from "./user-metadata";
|
import { Kind0ParsedContent } from "./user-metadata";
|
||||||
import { nip57, utils, validateEvent } from "nostr-tools";
|
import { nip57, utils } from "nostr-tools";
|
||||||
|
import verifyEvent from "../../services/verify-event";
|
||||||
|
|
||||||
// based on https://github.com/nbd-wtf/nostr-tools/blob/master/nip57.ts
|
// based on https://github.com/nbd-wtf/nostr-tools/blob/master/nip57.ts
|
||||||
export async function getZapEndpoint(metadata: Kind0ParsedContent): Promise<null | string> {
|
export async function getZapEndpoint(metadata: Kind0ParsedContent): Promise<null | string> {
|
||||||
@@ -102,7 +103,7 @@ export function parseZapEvent(event: NostrEvent): ParsedZap {
|
|||||||
if (error) throw new Error(error);
|
if (error) throw new Error(error);
|
||||||
|
|
||||||
const request = JSON.parse(zapRequestStr) as NostrEvent;
|
const request = JSON.parse(zapRequestStr) as NostrEvent;
|
||||||
if (!validateEvent(request)) throw new Error("Invalid zap request");
|
if (!verifyEvent(request)) throw new Error("Invalid zap request");
|
||||||
const payment = parsePaymentRequest(bolt11);
|
const payment = parsePaymentRequest(bolt11);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@@ -27,6 +27,7 @@ import RelaySet from "../../classes/relay-set";
|
|||||||
import useAppSettings from "../../hooks/use-app-settings";
|
import useAppSettings from "../../hooks/use-app-settings";
|
||||||
import { truncateId } from "../../helpers/string";
|
import { truncateId } from "../../helpers/string";
|
||||||
import useRouterMarker from "../../hooks/use-router-marker";
|
import useRouterMarker from "../../hooks/use-router-marker";
|
||||||
|
import BackButton, { BackIconButton } from "../../components/router/back-button";
|
||||||
|
|
||||||
/** This is broken out from DirectMessageChatPage for performance reasons. Don't use outside of file */
|
/** This is broken out from DirectMessageChatPage for performance reasons. Don't use outside of file */
|
||||||
const ChatLog = memo(({ timeline }: { timeline: TimelineLoader }) => {
|
const ChatLog = memo(({ timeline }: { timeline: TimelineLoader }) => {
|
||||||
@@ -121,13 +122,7 @@ function DirectMessageChatPage({ pubkey }: { pubkey: string }) {
|
|||||||
<IntersectionObserverProvider callback={callback}>
|
<IntersectionObserverProvider callback={callback}>
|
||||||
<Card size="sm" flexShrink={0} p="2" flexDirection="row">
|
<Card size="sm" flexShrink={0} p="2" flexDirection="row">
|
||||||
<Flex gap="2" alignItems="center">
|
<Flex gap="2" alignItems="center">
|
||||||
<IconButton
|
<BackIconButton />
|
||||||
variant="ghost"
|
|
||||||
icon={<ChevronLeftIcon />}
|
|
||||||
aria-label="Back"
|
|
||||||
onClick={() => navigate(-1)}
|
|
||||||
hideFrom="xl"
|
|
||||||
/>
|
|
||||||
<UserAvatar pubkey={pubkey} size="sm" />
|
<UserAvatar pubkey={pubkey} size="sm" />
|
||||||
<UserLink pubkey={pubkey} fontWeight="bold" />
|
<UserLink pubkey={pubkey} fontWeight="bold" />
|
||||||
<UserDnsIdentity pubkey={pubkey} onlyIcon />
|
<UserDnsIdentity pubkey={pubkey} onlyIcon />
|
||||||
|
Reference in New Issue
Block a user