@@ -17,7 +17,7 @@ module.exports = { | |||||
_calcEntropy: v2._calcEntropy, | _calcEntropy: v2._calcEntropy, | ||||
_consumeEntropy: v2._consumeEntropy, | _consumeEntropy: v2._consumeEntropy, | ||||
_getSetOfCharacters: v2._getSetOfCharacters, | _getSetOfCharacters: v2._getSetOfCharacters, | ||||
_validRules: v2._validRules, | |||||
_getConfiguredRules: v2._getConfiguredRules, | |||||
_insertStringPseudoRandomly: v2._insertStringPseudoRandomly, | _insertStringPseudoRandomly: v2._insertStringPseudoRandomly, | ||||
_getOneCharPerRule: v2._getOneCharPerRule, | _getOneCharPerRule: v2._getOneCharPerRule, | ||||
_renderPassword: v2._renderPassword, | _renderPassword: v2._renderPassword, |
@@ -13,7 +13,7 @@ describe('LessPass v2', function () { | |||||
digits: true, | digits: true, | ||||
symbols: true, | symbols: true, | ||||
length: 16, | length: 16, | ||||
counter: 1, | |||||
index: 1, | |||||
version: 2 | version: 2 | ||||
}; | }; | ||||
return LessPass.generatePassword(site, login, masterPassword, passwordProfile).then(function (generatedPassword) { | return LessPass.generatePassword(site, login, masterPassword, passwordProfile).then(function (generatedPassword) { | ||||
@@ -31,11 +31,11 @@ describe('LessPass v2', function () { | |||||
digits: true, | digits: true, | ||||
symbols: false, | symbols: false, | ||||
length: 14, | length: 14, | ||||
counter: 1, | |||||
index: 2, | |||||
version: 2 | version: 2 | ||||
}; | }; | ||||
return LessPass.generatePassword(site, login, masterPassword, passwordProfile).then(function (generatedPassword) { | return LessPass.generatePassword(site, login, masterPassword, passwordProfile).then(function (generatedPassword) { | ||||
assert.equal('y5Im77Ctww2695', generatedPassword); | |||||
assert.equal('MBAsB7b1Prt8Sl', generatedPassword); | |||||
}); | }); | ||||
}); | }); | ||||
it('render password only digit', function () { | it('render password only digit', function () { | ||||
@@ -49,11 +49,11 @@ describe('LessPass v2', function () { | |||||
digits: true, | digits: true, | ||||
symbols: false, | symbols: false, | ||||
length: 6, | length: 6, | ||||
counter: 1, | |||||
index: 3, | |||||
version: 2 | version: 2 | ||||
}; | }; | ||||
return LessPass.generatePassword(site, login, masterPassword, passwordProfile).then(function (generatedPassword) { | return LessPass.generatePassword(site, login, masterPassword, passwordProfile).then(function (generatedPassword) { | ||||
assert.equal('874623', generatedPassword); | |||||
assert.equal('117843', generatedPassword); | |||||
}); | }); | ||||
}); | }); | ||||
it('render password no number', function () { | it('render password no number', function () { | ||||
@@ -67,7 +67,7 @@ describe('LessPass v2', function () { | |||||
digits: false, | digits: false, | ||||
symbols: true, | symbols: true, | ||||
length: 14, | length: 14, | ||||
counter: 1, | |||||
index: 1, | |||||
version: 2 | version: 2 | ||||
}; | }; | ||||
return LessPass.generatePassword(site, login, masterPassword, passwordProfile).then(function (generatedPassword) { | return LessPass.generatePassword(site, login, masterPassword, passwordProfile).then(function (generatedPassword) { | ||||
@@ -7,7 +7,13 @@ describe('LessPass v2', function () { | |||||
var site = 'example.org'; | var site = 'example.org'; | ||||
var login = 'contact@example.org'; | var login = 'contact@example.org'; | ||||
var masterPassword = 'password'; | var masterPassword = 'password'; | ||||
return LessPass._calcEntropy(site, login, masterPassword).then(function (entropy) { | |||||
var passwordProfile = { | |||||
iterations: 100000, | |||||
keylen: 32, | |||||
digest: 'sha256', | |||||
index: 1 | |||||
}; | |||||
return LessPass._calcEntropy(site, login, masterPassword, passwordProfile).then(function (entropy) { | |||||
assert.equal('dc33d431bce2b01182c613382483ccdb0e2f66482cbba5e9d07dab34acc7eb1e', entropy); | assert.equal('dc33d431bce2b01182c613382483ccdb0e2f66482cbba5e9d07dab34acc7eb1e', entropy); | ||||
}); | }); | ||||
}); | }); | ||||
@@ -1,17 +1,24 @@ | |||||
var assert = chai.assert; | var assert = chai.assert; | ||||
describe('LessPass v2', function () { | describe('LessPass v2', function () { | ||||
var defaultPasswordProfile = { | |||||
length: 16, | |||||
lowercase: true, | |||||
uppercase: true, | |||||
digits: true, | |||||
symbols: true | |||||
}; | |||||
it('render password use remainder of long division beetween entropy and set of chars length as an index', function () { | it('render password use remainder of long division beetween entropy and set of chars length as an index', function () { | ||||
var entropy = 'dc33d431bce2b01182c613382483ccdb0e2f66482cbba5e9d07dab34acc7eb1e'; | var entropy = 'dc33d431bce2b01182c613382483ccdb0e2f66482cbba5e9d07dab34acc7eb1e'; | ||||
assert.equal('W', LessPass._renderPassword(entropy)[0]); | |||||
assert.equal('W', LessPass._renderPassword(entropy, defaultPasswordProfile)[0]); | |||||
}); | }); | ||||
it('render password use quotient as second entropy recursively', function () { | it('render password use quotient as second entropy recursively', function () { | ||||
var entropy = 'dc33d431bce2b01182c613382483ccdb0e2f66482cbba5e9d07dab34acc7eb1e'; | var entropy = 'dc33d431bce2b01182c613382483ccdb0e2f66482cbba5e9d07dab34acc7eb1e'; | ||||
assert.equal('H', LessPass._renderPassword(entropy)[1]); | |||||
assert.equal('H', LessPass._renderPassword(entropy, defaultPasswordProfile)[1]); | |||||
}); | }); | ||||
it('render password has default length of 16', function () { | it('render password has default length of 16', function () { | ||||
var entropy = 'dc33d431bce2b01182c613382483ccdb0e2f66482cbba5e9d07dab34acc7eb1e'; | var entropy = 'dc33d431bce2b01182c613382483ccdb0e2f66482cbba5e9d07dab34acc7eb1e'; | ||||
assert.equal(16, LessPass._renderPassword(entropy).length); | |||||
assert.equal(16, LessPass._renderPassword(entropy, defaultPasswordProfile).length); | |||||
}); | }); | ||||
it('render password can specify length', function () { | it('render password can specify length', function () { | ||||
var entropy = 'dc33d431bce2b01182c613382483ccdb0e2f66482cbba5e9d07dab34acc7eb1e'; | var entropy = 'dc33d431bce2b01182c613382483ccdb0e2f66482cbba5e9d07dab34acc7eb1e'; | ||||