Pronounceable password format

Fixes #12
This commit is contained in:
Ian Gulliver
2018-12-07 06:11:51 +00:00
parent 1010c505bb
commit bd06a46b5e
3 changed files with 50 additions and 5 deletions

View File

@@ -404,15 +404,19 @@ overview,product {
font-size: 1.1em;
}
passwordAlphaNum,passwordWords {
passwordShort,passwordPronounceable,passwordReadable {
display: none;
}
product.passwords-short passwordAlphaNum {
product.passwords-short passwordShort {
display: inline;
}
product.passwords-readable passwordWords {
product.passwords-pronounceable passwordPronounceable {
display: inline;
}
product.passwords-readable passwordReadable {
display: inline;
}

View File

@@ -1,7 +1,10 @@
class PassMate {
constructor(container) {
this.SAFE_UALPHA = 'ABCDEFGHJKLMNPQRSTUVWXYZ';
this.SAFE_UALPHA_CON = 'BCDFGHJKLMNPQRSTVWXYZ';
this.SAFE_LALPHA = 'abcdefghijkmnpqrstuvwxyz';
this.SAFE_LALPHA_CON = 'bcdfghjkmnpqrstvwxyz';
this.SAFE_LALPHA_VOW = 'aeu';
this.SAFE_NUM = '23456789';
this.SAFE_ALPHANUM = this.SAFE_UALPHA + this.SAFE_LALPHA + this.SAFE_NUM;
this.SAFE_SYMBOL = '!?';
@@ -20,6 +23,7 @@ class PassMate {
this.pages = [];
this.shortPasswords = new Map();
this.pronounceablePasswords = new Map();
this.readablePasswords = new Map();
this.addProduct(container);
@@ -55,11 +59,14 @@ class PassMate {
let formats = this.addElement('ul', formatStep);
let format = new Select((key) => {
this.product.classList.remove('passwords-short');
this.product.classList.remove('passwords-pronounceable');
this.product.classList.remove('passwords-readable');
this.product.classList.add('passwords-' + key);
});
let shortItem = this.addElement('li', formats);
format.add('short', this.addElement('button', shortItem, 'Short: 5EQaDfNS'));
let pronounceableItem = this.addElement('li', formats);
format.add('pronounceable', this.addElement('button', pronounceableItem, 'Pronounceable: KebeDuveBagica39'));
let readableItem = this.addElement('li', formats);
format.add('readable', this.addElement('button', readableItem, 'Readable: LeasedBarneyPlays565 (too long for some websites)'));
@@ -210,10 +217,13 @@ class PassMate {
password.style.gridArea = 'password';
this.shortPasswords.set(
letter + '-' + (i % pagesPerLetter).toString() + '-' + j.toString(),
this.addElement('passwordAlphaNum', password));
this.addElement('passwordShort', password));
this.pronounceablePasswords.set(
letter + '-' + (i % pagesPerLetter).toString() + '-' + j.toString(),
this.addElement('passwordPronounceable', password));
this.readablePasswords.set(
letter + '-' + (i % pagesPerLetter).toString() + '-' + j.toString(),
this.addElement('passwordWords', password));
this.addElement('passwordReadable', password));
this.addElement('passwordSymbols', password, this.SAFE_SYMBOL);
this.addElement('websiteLabel', pwblock, 'Website:').style.gridArea = 'websiteLabel';
@@ -306,6 +316,32 @@ class PassMate {
container.innerText = arr.join('');
});
}
for (let [info, container] of this.pronounceablePasswords) {
let choices = [
this.SAFE_UALPHA_CON,
this.SAFE_LALPHA_VOW,
this.SAFE_LALPHA_CON,
this.SAFE_LALPHA_VOW,
this.SAFE_UALPHA_CON,
this.SAFE_LALPHA_VOW,
this.SAFE_LALPHA_CON,
this.SAFE_LALPHA_VOW,
this.SAFE_UALPHA_CON,
this.SAFE_LALPHA_VOW,
this.SAFE_LALPHA_CON,
this.SAFE_LALPHA_VOW,
this.SAFE_LALPHA_CON,
this.SAFE_LALPHA_VOW,
this.SAFE_NUM,
this.SAFE_NUM,
this.SAFE_NUM,
];
this.deriveValidArray(key, info, choices, this.validatePassword.bind(this))
.then((arr) => {
container.innerText = arr.join('');
});
}
}
/**

View File

@@ -4,6 +4,11 @@ A6Fe2bnneuTMUNEAVKQpjNQq74BQVG5JB
A-0-1: qhqv9Myy
A-1-0: MzyhW9Np
Z-1-4: 5EQaDfNS
Pronounceable
A-0-0: DetaNemaJekada532
A-0-1: JuquSafaCedece842
A-1-0: PuvuZahaTuzaxu628
Z-1-4: YataFeraQerura389
Readable
A-0-0: ReactorsHybridElected875
A-0-1: OlderOwnerGeneric253