Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 
 

389 righe
9.9 KiB

  1. var assert = require("assert");
  2. var LessPass = require("../src/lesspass");
  3. describe("api", function() {
  4. describe("v1", function() {
  5. it("generatedPassword", function() {
  6. var site = "example.org";
  7. var login = "contact@example.org";
  8. var masterPassword = "password";
  9. var options = {
  10. lowercase: true,
  11. uppercase: true,
  12. numbers: true,
  13. symbols: true,
  14. length: 12,
  15. counter: 1,
  16. version: 1
  17. };
  18. return LessPass.generatePassword(
  19. site,
  20. login,
  21. masterPassword,
  22. options
  23. ).then(function(generatedPassword) {
  24. assert.equal("izIS5@ozYM2?", generatedPassword);
  25. });
  26. });
  27. it("generatedPassword", function() {
  28. var site = "lesspass.com";
  29. var login = "contact@lesspass.com";
  30. var masterPassword = "password";
  31. var options = {
  32. lowercase: true,
  33. uppercase: true,
  34. numbers: true,
  35. symbols: true,
  36. length: 12,
  37. counter: 1,
  38. version: 1
  39. };
  40. return LessPass.generatePassword(
  41. site,
  42. login,
  43. masterPassword,
  44. options
  45. ).then(function(generatedPassword) {
  46. assert.equal("azYS7,olOL2]", generatedPassword);
  47. });
  48. });
  49. it("generatedPassword", function() {
  50. var site = "lesspass.com";
  51. var login = "contact@lesspass.com";
  52. var masterPassword = "password";
  53. var options = {
  54. lowercase: true,
  55. uppercase: true,
  56. numbers: true,
  57. symbols: true,
  58. length: 14,
  59. counter: 1,
  60. version: 1
  61. };
  62. return LessPass.generatePassword(
  63. site,
  64. login,
  65. masterPassword,
  66. options
  67. ).then(function(generatedPassword) {
  68. assert.equal("azYS7,olOL2]iz", generatedPassword);
  69. });
  70. });
  71. it("generatedPassword", function() {
  72. var site = "lesspass.com";
  73. var login = "contact@lesspass.com";
  74. var masterPassword = "password";
  75. var options = {
  76. lowercase: true,
  77. uppercase: false,
  78. numbers: false,
  79. symbols: false,
  80. length: 12,
  81. counter: 1,
  82. version: 1
  83. };
  84. return LessPass.generatePassword(
  85. site,
  86. login,
  87. masterPassword,
  88. options
  89. ).then(function(generatedPassword) {
  90. assert.equal("azyseqololat", generatedPassword);
  91. });
  92. });
  93. it("generatedPassword", function() {
  94. var site = "lesspass.com";
  95. var login = "contact@lesspass.com";
  96. var masterPassword = "password";
  97. var options = {
  98. lowercase: false,
  99. uppercase: true,
  100. numbers: true,
  101. symbols: true,
  102. length: 12,
  103. counter: 1,
  104. version: 1
  105. };
  106. return LessPass.generatePassword(
  107. site,
  108. login,
  109. masterPassword,
  110. options
  111. ).then(function(generatedPassword) {
  112. assert.equal("AZ3[EQ7@OL2]", generatedPassword);
  113. });
  114. });
  115. it("generatedPassword", function() {
  116. var site = "lesspass.com";
  117. var login = "contact@lesspass.com";
  118. var masterPassword = "password";
  119. var options = {
  120. lowercase: false,
  121. uppercase: false,
  122. numbers: true,
  123. symbols: true,
  124. length: 12,
  125. counter: 1,
  126. version: 1
  127. };
  128. return LessPass.generatePassword(
  129. site,
  130. login,
  131. masterPassword,
  132. options
  133. ).then(function(generatedPassword) {
  134. assert.equal("4?3[7,7@7@2]", generatedPassword);
  135. });
  136. });
  137. it("generatedPassword", function() {
  138. var site = "lesspass.com";
  139. var login = "contact@lesspass.com";
  140. var masterPassword = "password";
  141. var options = {
  142. lowercase: false,
  143. uppercase: false,
  144. numbers: false,
  145. symbols: true,
  146. length: 12,
  147. counter: 1,
  148. version: 1
  149. };
  150. return LessPass.generatePassword(
  151. site,
  152. login,
  153. masterPassword,
  154. options
  155. ).then(function(generatedPassword) {
  156. assert.equal("[?=[&,:@:@[]", generatedPassword);
  157. });
  158. });
  159. it("generatedPassword", function() {
  160. var site = "lesspass.com";
  161. var login = "contact@lesspass.com";
  162. var masterPassword = "password";
  163. var options = {
  164. lowercase: true,
  165. uppercase: true,
  166. numbers: true,
  167. symbols: false,
  168. length: 12,
  169. counter: 1,
  170. version: 1
  171. };
  172. return LessPass.generatePassword(
  173. site,
  174. login,
  175. masterPassword,
  176. options
  177. ).then(function(generatedPassword) {
  178. assert.equal("azYS7uwAW8at", generatedPassword);
  179. });
  180. });
  181. it("generatedPassword", function() {
  182. var site = "lesspass.com";
  183. var login = "contact@lesspass.com";
  184. var masterPassword = "password";
  185. var options = {
  186. lowercase: true,
  187. uppercase: true,
  188. numbers: false,
  189. symbols: false,
  190. length: 12,
  191. counter: 1,
  192. version: 1
  193. };
  194. return LessPass.generatePassword(
  195. site,
  196. login,
  197. masterPassword,
  198. options
  199. ).then(function(generatedPassword) {
  200. assert.equal("azYSeqOLolAT", generatedPassword);
  201. });
  202. });
  203. it("generatedPassword", function() {
  204. var site = "lesspass.com";
  205. var login = "contact@lesspass.com";
  206. var masterPassword = "password";
  207. var options = {
  208. lowercase: true,
  209. uppercase: true,
  210. numbers: true,
  211. symbols: true,
  212. length: 12,
  213. counter: 2,
  214. version: 1
  215. };
  216. return LessPass.generatePassword(
  217. site,
  218. login,
  219. masterPassword,
  220. options
  221. ).then(function(generatedPassword) {
  222. assert.equal("obYT2=olOV9=", generatedPassword);
  223. });
  224. });
  225. it("generatedPassword", function() {
  226. var site = "lesspass.com";
  227. var login = "lesspass";
  228. var masterPassword = "password";
  229. var options = {
  230. lowercase: true,
  231. uppercase: true,
  232. numbers: true,
  233. symbols: true,
  234. length: 12,
  235. counter: 1,
  236. version: 1
  237. };
  238. return LessPass.generatePassword(
  239. site,
  240. login,
  241. masterPassword,
  242. options
  243. ).then(function(generatedPassword) {
  244. assert.equal("erOC1%imIW3,", generatedPassword);
  245. });
  246. });
  247. it("generatedPassword", function() {
  248. var site = "lesspass.com";
  249. var login = "contact@lesspass.com";
  250. var masterPassword = "password2";
  251. var options = {
  252. lowercase: true,
  253. uppercase: true,
  254. numbers: true,
  255. symbols: true,
  256. length: 12,
  257. counter: 1,
  258. version: 1
  259. };
  260. return LessPass.generatePassword(
  261. site,
  262. login,
  263. masterPassword,
  264. options
  265. ).then(function(generatedPassword) {
  266. assert.equal("uvUM5_ucUP5=", generatedPassword);
  267. });
  268. });
  269. });
  270. describe("v2", function() {
  271. it("generatedPassword", function() {
  272. this.timeout(10000);
  273. var site = "example.org";
  274. var login = "contact@example.org";
  275. var masterPassword = "password";
  276. var options = {
  277. lowercase: true,
  278. uppercase: true,
  279. numbers: true,
  280. symbols: true,
  281. length: 16,
  282. counter: 1,
  283. version: 2
  284. };
  285. return LessPass.generatePassword(
  286. site,
  287. login,
  288. masterPassword,
  289. options
  290. ).then(function(generatedPassword) {
  291. assert.equal("WHLpUL)e00[iHR+w", generatedPassword);
  292. });
  293. });
  294. it("generatedPassword", function() {
  295. this.timeout(10000);
  296. var site = "example.org";
  297. var login = "contact@example.org";
  298. var masterPassword = "password";
  299. var options = {
  300. lowercase: true,
  301. uppercase: true,
  302. numbers: true,
  303. symbols: false,
  304. length: 14,
  305. counter: 2,
  306. version: 2
  307. };
  308. return LessPass.generatePassword(
  309. site,
  310. login,
  311. masterPassword,
  312. options
  313. ).then(function(generatedPassword) {
  314. assert.equal("MBAsB7b1Prt8Sl", generatedPassword);
  315. });
  316. });
  317. it("generatedPassword", function() {
  318. this.timeout(10000);
  319. var site = "example.org";
  320. var login = "contact@example.org";
  321. var masterPassword = "password";
  322. var options = {
  323. lowercase: false,
  324. uppercase: false,
  325. numbers: true,
  326. symbols: false,
  327. length: 6,
  328. counter: 3,
  329. version: 2
  330. };
  331. return LessPass.generatePassword(
  332. site,
  333. login,
  334. masterPassword,
  335. options
  336. ).then(function(generatedPassword) {
  337. assert.equal("117843", generatedPassword);
  338. });
  339. });
  340. it("generatedPassword", function() {
  341. this.timeout(10000);
  342. var site = "example.org";
  343. var login = "contact@example.org";
  344. var masterPassword = "password";
  345. var options = {
  346. lowercase: true,
  347. uppercase: true,
  348. numbers: false,
  349. symbols: true,
  350. length: 14,
  351. counter: 1,
  352. version: 2
  353. };
  354. return LessPass.generatePassword(
  355. site,
  356. login,
  357. masterPassword,
  358. options
  359. ).then(function(generatedPassword) {
  360. assert.equal("sB>{qF}wN%/-fm", generatedPassword);
  361. });
  362. });
  363. it("generatedPassword", function() {
  364. this.timeout(10000);
  365. var site = "example.org";
  366. var login = "contact@example.org";
  367. var masterPassword = "password";
  368. return LessPass.generatePassword(
  369. site,
  370. login,
  371. masterPassword
  372. ).then(function(generatedPassword) {
  373. assert.equal("WHLpUL)e00[iHR+w", generatedPassword);
  374. });
  375. });
  376. });
  377. describe("fingerprint", function() {
  378. it("createFingerprint", function() {
  379. return LessPass.createFingerprint("password").then(function(fingerprint) {
  380. assert.equal(
  381. "e56a207acd1e6714735487c199c6f095844b7cc8e5971d86c003a7b6f36ef51e",
  382. fingerprint
  383. );
  384. });
  385. });
  386. });
  387. });