aboutsummaryrefslogtreecommitdiffstats
path: root/routes/nostr.ts
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-11-21 16:31:51 -0800
committerAdam Soltys <[email protected]>2024-11-21 16:31:51 -0800
commitff4d63f395a556543e9a642676f92dea5d1c1645 (patch)
treedbee8887d40bf535f587c1f10bc0fa7f36db31f8 /routes/nostr.ts
parent3b15d16339c9209f307f8453af91fba15f3d340c (diff)
downloadcoinos-server-ff4d63f395a556543e9a642676f92dea5d1c1645.tar.gz
coinos-server-ff4d63f395a556543e9a642676f92dea5d1c1645.zip
ecash requests
Diffstat (limited to 'routes/nostr.ts')
-rw-r--r--routes/nostr.ts19
1 files changed, 15 insertions, 4 deletions
diff --git a/routes/nostr.ts b/routes/nostr.ts
index 1ad86baf..360ae22c 100644
--- a/routes/nostr.ts
+++ b/routes/nostr.ts
@@ -1,14 +1,17 @@
import config from "$config";
-import { bail, fail, getUser, time } from "$lib/utils";
-import { g, s, db } from "$lib/db";
+import { db, g, s } from "$lib/db";
import {
anon,
- send,
getCount,
+ getProfile,
getRelays,
- serverPubkey,
pool,
+ send,
+ serverPubkey,
} from "$lib/nostr";
+import { bail, fail, getUser } from "$lib/utils";
+import { decode } from "nostr-tools/nip19";
+import type { ProfilePointer } from "nostr-tools/nip19";
const opts = { maxWait: 2000 };
@@ -198,4 +201,12 @@ export default {
async info(_, res) {
res.send({ pubkey: serverPubkey });
},
+
+ async profile(req, res) {
+ const { profile } = req.params;
+ const { data } = decode(profile);
+ const { pubkey, relays } = data as ProfilePointer;
+ const user = await getProfile(pubkey, relays);
+ res.send(user);
+ },
};