feat: check zap service pubkeys

This commit is contained in:
2023-03-05 17:54:55 +00:00
parent c702d1b760
commit b71c279a0d
4 changed files with 30 additions and 0 deletions

View File

@ -10,6 +10,7 @@ import Text from "Element/Text";
import ProfileImage from "Element/ProfileImage";
import { RootState } from "State/Store";
import { ZapperSpam } from "Const";
import { UserCache } from "State/Users/UserCache";
import messages from "./messages";
@ -75,6 +76,10 @@ export function parseZap(zapReceipt: TaggedRawEvent): ParsedZap {
ret.valid = false;
ret.errors.push("amount tag does not match invoice amount");
}
if (UserCache.get(ret.receiver)?.zapService !== ret.zapService) {
ret.valid = false;
ret.errors.push("zap service pubkey doesn't match");
}
if (!ret.valid) {
console.debug("Invalid zap", ret);
}