diff options
| author | Adam Soltys <[email protected]> | 2024-11-08 22:06:10 +0000 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2024-11-09 00:45:42 +0000 |
| commit | 7199b0f72b34e630e358f15f1a9351a58fa3008b (patch) | |
| tree | ce6c1ace9980e162b33e8742415193fc298ab2c3 /lib/nwc.ts | |
| parent | 6a6b9ab5b5292b51e2570eadb73e2e436c4f1117 (diff) | |
| download | coinos-server-7199b0f72b34e630e358f15f1a9351a58fa3008b.tar.gz coinos-server-7199b0f72b34e630e358f15f1a9351a58fa3008b.zip | |
logging
Diffstat (limited to 'lib/nwc.ts')
| -rw-r--r-- | lib/nwc.ts | 34 |
1 files changed, 19 insertions, 15 deletions
@@ -45,23 +45,27 @@ export default () => { const uid = await g(pubkey); const user = await g(`user:${uid}`); - const result = await handle(method, params, user); - const payload = JSON.stringify({ result_type: method, ...result }); - content = await nip04.encrypt(sk, pubkey, payload); + try { + const result = await handle(method, params, user); + const payload = JSON.stringify({ result_type: method, ...result }); + content = await nip04.encrypt(sk, pubkey, payload); - let response: UnsignedEvent = { - created_at: Math.floor(Date.now() / 1000), - kind: 23195, - pubkey: serverPubkey, - tags: [ - ["p", pubkey], - ["e", ev.id], - ], - content, - }; + let response: UnsignedEvent = { + created_at: Math.floor(Date.now() / 1000), + kind: 23195, + pubkey: serverPubkey, + tags: [ + ["p", pubkey], + ["e", ev.id], + ], + content, + }; - response = await finalizeEvent(response, sk); - r.send(["EVENT", response]); + response = await finalizeEvent(response, sk); + r.send(["EVENT", response]); + } catch(e) { + err("problem with nwc", user.username, params, e.message); + } } catch (e) { err("problem with nwc", e.message); } |
