Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. # node-http-signature
  2. node-http-signature is a node.js library that has client and server components
  3. for Joyent's [HTTP Signature Scheme](http_signing.md).
  4. ## Usage
  5. Note the example below signs a request with the same key/cert used to start an
  6. HTTP server. This is almost certainly not what you actually want, but is just
  7. used to illustrate the API calls; you will need to provide your own key
  8. management in addition to this library.
  9. ### Client
  10. ```js
  11. var fs = require('fs');
  12. var https = require('https');
  13. var httpSignature = require('http-signature');
  14. var key = fs.readFileSync('./key.pem', 'ascii');
  15. var options = {
  16. host: 'localhost',
  17. port: 8443,
  18. path: '/',
  19. method: 'GET',
  20. headers: {}
  21. };
  22. // Adds a 'Date' header in, signs it, and adds the
  23. // 'Authorization' header in.
  24. var req = https.request(options, function(res) {
  25. console.log(res.statusCode);
  26. });
  27. httpSignature.sign(req, {
  28. key: key,
  29. keyId: './cert.pem'
  30. });
  31. req.end();
  32. ```
  33. ### Server
  34. ```js
  35. var fs = require('fs');
  36. var https = require('https');
  37. var httpSignature = require('http-signature');
  38. var options = {
  39. key: fs.readFileSync('./key.pem'),
  40. cert: fs.readFileSync('./cert.pem')
  41. };
  42. https.createServer(options, function (req, res) {
  43. var rc = 200;
  44. var parsed = httpSignature.parseRequest(req);
  45. var pub = fs.readFileSync(parsed.keyId, 'ascii');
  46. if (!httpSignature.verifySignature(parsed, pub))
  47. rc = 401;
  48. res.writeHead(rc);
  49. res.end();
  50. }).listen(8443);
  51. ```
  52. ## Installation
  53. npm install http-signature
  54. ## License
  55. MIT.
  56. ## Bugs
  57. See <https://github.com/joyent/node-http-signature/issues>.