diff options
| author | Adam Soltys <[email protected]> | 2021-12-09 16:45:09 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2021-12-09 16:55:08 -0800 |
| commit | d23f225a306c29fc3416233f98a7316996686c22 (patch) | |
| tree | 4c4ef883ee3f0b195295b03753befb6a1b8369ec | |
| parent | ff51e91efafc8f12f303ba1c86a5032d5b963aa1 (diff) | |
| download | coinos-server-d23f225a306c29fc3416233f98a7316996686c22.tar.gz coinos-server-d23f225a306c29fc3416233f98a7316996686c22.zip | |
signMessage endpoint
| -rw-r--r-- | routes/users.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/routes/users.js b/routes/users.js index d9a04304..7ea91413 100644 --- a/routes/users.js +++ b/routes/users.js @@ -770,3 +770,23 @@ app.get( res.send(invoices); }) ); + +app.post( + "/signMessage", + auth, + ah(async function(req, res) { + let { address, message } = req.body; + + let invoices = await db.Invoice.findAll({ + where: { user_id: req.user.id } + }); + + if (invoices.find(i => i.address === address)) { + if (config.bitcoin.walletpass) + await bc.walletPassphrase(config.bitcoin.walletpass, 300); + return res.send(await bc.signMessage(address, message)); + } + + res.status(500).send("Address not found for user"); + }) +); |
