Verify nip05 address, display status

This commit is contained in:
2024-10-25 17:50:59 +02:00
parent a6517c61a4
commit 4c68be19fe
6 changed files with 85 additions and 4 deletions

View File

@@ -1,4 +1,5 @@
import { nip19, NostrEvent as NEvent } from "@nostr/tools";
import { verifyNip05Address } from "../nostr.ts";
import { getImageMagickCommand } from "../utils.ts";
import config from "../config.ts";
@@ -43,7 +44,7 @@ export default class Profile {
}
get nip05(): string | undefined {
return this.data.nip05;
return this.data.nip05?.replace("_@", "");
}
get lud16(): string | undefined {
@@ -69,4 +70,12 @@ export default class Profile {
return this.picture || "";
}
}
verifyNip05(): Promise<boolean> {
if (typeof this.data.nip05 !== "undefined") {
return verifyNip05Address(this.data.nip05, this.pubkey);
} else {
return Promise.resolve(false);
}
}
}