diff options
| author | Adam Soltys <[email protected]> | 2025-01-15 12:45:31 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2025-01-15 12:45:31 -0800 |
| commit | 273afd10bb321c1ac23ce14aba9f61b6ffe1e910 (patch) | |
| tree | 204fc74ab91522f2731debd435a420657cb781f5 /routes | |
| parent | f850f8f2a5b9a6ee9c038d5231bdb9c2db98fad0 (diff) | |
| download | coinos-server-273afd10bb321c1ac23ce14aba9f61b6ffe1e910.tar.gz coinos-server-273afd10bb321c1ac23ce14aba9f61b6ffe1e910.zip | |
sign endpoint
Diffstat (limited to 'routes')
| -rw-r--r-- | routes/invoices.ts | 10 | ||||
| -rw-r--r-- | routes/nostr.ts | 6 |
2 files changed, 13 insertions, 3 deletions
diff --git a/routes/invoices.ts b/routes/invoices.ts index ead2284c..e7295b6e 100644 --- a/routes/invoices.ts +++ b/routes/invoices.ts @@ -1,7 +1,11 @@ +import config from "$config"; import { db, g } from "$lib/db"; import { generate } from "$lib/invoices"; import { err } from "$lib/logging"; import { bail, getInvoice, pick } from "$lib/utils"; +import rpc from "@coinos/rpc"; + +const bc = rpc(config.bitcoin); export default { async get(req, res) { @@ -48,4 +52,10 @@ export default { invoices = await Promise.all(invoices.map((i) => getInvoice(i))); res.send(invoices); }, + + async sign(req, res) { + const { address, message } = req.body; + const signature = await bc.signMessage({ address, message }); + res.send({ signature }); + }, }; diff --git a/routes/nostr.ts b/routes/nostr.ts index ae2be7e9..f43f3517 100644 --- a/routes/nostr.ts +++ b/routes/nostr.ts @@ -64,14 +64,14 @@ export default { if (!events.length) return res.send([]); const event = events[0]; - const pubkeys = event.tags + let pubkeys = event.tags .filter((tag) => tag[0] === "p") - .map((tag) => tag[1]) - .slice(offset, limit); + .map((tag) => tag[1]); let follows = []; if (pubkeysOnly) follows = pubkeys; else { + pubkeys = pubkeys.slice(limit, offset); const profiles = await scan({ authors: pubkeys, kinds: [0] }); for (const p of profiles) { const { content, pubkey } = p; |
