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 2.6 KiB

8 years ago
8 years ago
8 years ago
8 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. [![Build Status](https://travis-ci.org/lesspass/core.svg?branch=master)](https://travis-ci.org/lesspass/core)
  2. # LessPass Core
  3. core library for LessPass password manager in node.js used to generate unique password
  4. ## Requirements
  5. - node 4.x.x
  6. ## Install
  7. npm install lesspass
  8. ## Usage
  9. ### Node
  10. var lesspass = require('lesspass');
  11. var login = 'contact@lesspass.com';
  12. var masterPassword = 'password';
  13. var site = 'lesspass.com';
  14. var options = {
  15. counter: 1,
  16. password: {
  17. length: 12,
  18. settings: ['lowercase', 'uppercase', 'numbers', 'symbols']
  19. }
  20. };
  21. lesspass.generatePassword(login, masterPassword, site, options).then(function (generatedPassword) {
  22. console.log(generatedPassword) //azYS7,olOL2]
  23. });
  24. ### Browser
  25. <!doctype html>
  26. <html lang="en">
  27. <head>
  28. <meta charset="UTF-8">
  29. </head>
  30. <body>
  31. <script src="lesspass.min.js"></script>
  32. <script>
  33. var login = 'contact@lesspass.com';
  34. var masterPassword = 'password';
  35. var site = 'lesspass.com';
  36. var options = {
  37. counter: 1,
  38. password: {
  39. length: 12,
  40. settings: ['lowercase', 'uppercase', 'numbers', 'symbols']
  41. }
  42. };
  43. lesspass.generatePassword(login, masterPassword, site, options).then(function (generatedPassword) {
  44. console.log(generatedPassword) //azYS7,olOL2]
  45. });
  46. </script>
  47. </body>
  48. </html>
  49. ## API
  50. ### `generatePassword(login, masterPassword, site, options)`
  51. generate unique password based on login, masterPassword, site and options.
  52. paramaters :
  53. * `login`: string
  54. * `masterPassword`: string
  55. * `site`: string
  56. * option: dict with lesspass options
  57. * `counter`: integer (default: 1)
  58. * `password.length`: integer between 6 and 64 (default: 12)
  59. * `password.settings`: array of string in `lowercase`, `uppercase`, `numbers` or `symbols` (default: `['lowercase', 'uppercase', 'numbers', 'symbols']`)
  60. exemple :
  61. var options = {
  62. counter: 2,
  63. password: {
  64. length: 14,
  65. settings: ['lowercase', 'uppercase', 'numbers']
  66. }
  67. };
  68. return:
  69. * promise with generated password
  70. lesspass.generatePassword(login, masterPassword, site, options)
  71. .then(function (generatedPassword) {
  72. console.log(generatedPassword);
  73. })
  74. .catch(function (error) {
  75. console.log(error);
  76. });
  77. see **tests/api.tests.js** for more examples
  78. ## Tests
  79. npm test
  80. see [LessPass](https://github.com/lesspass/lesspass) project