Hey is a decentralized and permissionless social media app built with Lens Protocol 馃尶
1import type { Context } from "hono";
2import getLensAccount from "@/utils/getLensAccount";
3
4const getAccount = async (ctx: Context) => {
5 const name = ctx.req.query("name");
6 if (!name) return ctx.json({ error: "Missing name" }, 400);
7
8 const lower = name.toLowerCase();
9 if (!lower.endsWith(".hey.xyz")) {
10 return ctx.json({ error: "Unsupported domain" }, 400);
11 }
12
13 const label = lower.split(".hey.xyz")[0];
14 if (!label || label.includes(".")) {
15 return ctx.json({ error: "Invalid label" }, 400);
16 }
17
18 const account = await getLensAccount(label);
19
20 return ctx.json({ account });
21};
22
23export default getAccount;