mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 00:33:44 +00:00
fix typo: EEFLongWordList -> EFFLongWordList (#3742)
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
// EFF's Long Wordlist from https://www.eff.org/dice
|
// EFF's Long Wordlist from https://www.eff.org/dice
|
||||||
export const EEFLongWordList = [
|
export const EFFLongWordList = [
|
||||||
"abacus",
|
"abacus",
|
||||||
"abdomen",
|
"abdomen",
|
||||||
"abdominal",
|
"abdominal",
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import { KdfType } from "../enums/kdfType";
|
|||||||
import { KeySuffixOptions } from "../enums/keySuffixOptions";
|
import { KeySuffixOptions } from "../enums/keySuffixOptions";
|
||||||
import { sequentialize } from "../misc/sequentialize";
|
import { sequentialize } from "../misc/sequentialize";
|
||||||
import { Utils } from "../misc/utils";
|
import { Utils } from "../misc/utils";
|
||||||
import { EEFLongWordList } from "../misc/wordlist";
|
import { EFFLongWordList } from "../misc/wordlist";
|
||||||
import { EncryptedOrganizationKeyData } from "../models/data/encryptedOrganizationKeyData";
|
import { EncryptedOrganizationKeyData } from "../models/data/encryptedOrganizationKeyData";
|
||||||
import { EncArrayBuffer } from "../models/domain/encArrayBuffer";
|
import { EncArrayBuffer } from "../models/domain/encArrayBuffer";
|
||||||
import { EncString } from "../models/domain/encString";
|
import { EncString } from "../models/domain/encString";
|
||||||
@@ -734,7 +734,7 @@ export class CryptoService implements CryptoServiceAbstraction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async hashPhrase(hash: ArrayBuffer, minimumEntropy = 64) {
|
private async hashPhrase(hash: ArrayBuffer, minimumEntropy = 64) {
|
||||||
const entropyPerWord = Math.log(EEFLongWordList.length) / Math.log(2);
|
const entropyPerWord = Math.log(EFFLongWordList.length) / Math.log(2);
|
||||||
let numWords = Math.ceil(minimumEntropy / entropyPerWord);
|
let numWords = Math.ceil(minimumEntropy / entropyPerWord);
|
||||||
|
|
||||||
const hashArr = Array.from(new Uint8Array(hash));
|
const hashArr = Array.from(new Uint8Array(hash));
|
||||||
@@ -746,9 +746,9 @@ export class CryptoService implements CryptoServiceAbstraction {
|
|||||||
const phrase: string[] = [];
|
const phrase: string[] = [];
|
||||||
let hashNumber = bigInt.fromArray(hashArr, 256);
|
let hashNumber = bigInt.fromArray(hashArr, 256);
|
||||||
while (numWords--) {
|
while (numWords--) {
|
||||||
const remainder = hashNumber.mod(EEFLongWordList.length);
|
const remainder = hashNumber.mod(EFFLongWordList.length);
|
||||||
hashNumber = hashNumber.divide(EEFLongWordList.length);
|
hashNumber = hashNumber.divide(EFFLongWordList.length);
|
||||||
phrase.push(EEFLongWordList[remainder as any]);
|
phrase.push(EFFLongWordList[remainder as any]);
|
||||||
}
|
}
|
||||||
return phrase;
|
return phrase;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { PasswordGenerationService as PasswordGenerationServiceAbstraction } fro
|
|||||||
import { PolicyService } from "../abstractions/policy/policy.service.abstraction";
|
import { PolicyService } from "../abstractions/policy/policy.service.abstraction";
|
||||||
import { StateService } from "../abstractions/state.service";
|
import { StateService } from "../abstractions/state.service";
|
||||||
import { PolicyType } from "../enums/policyType";
|
import { PolicyType } from "../enums/policyType";
|
||||||
import { EEFLongWordList } from "../misc/wordlist";
|
import { EFFLongWordList } from "../misc/wordlist";
|
||||||
import { EncString } from "../models/domain/encString";
|
import { EncString } from "../models/domain/encString";
|
||||||
import { GeneratedPasswordHistory } from "../models/domain/generatedPasswordHistory";
|
import { GeneratedPasswordHistory } from "../models/domain/generatedPasswordHistory";
|
||||||
import { PasswordGeneratorPolicyOptions } from "../models/domain/passwordGeneratorPolicyOptions";
|
import { PasswordGeneratorPolicyOptions } from "../models/domain/passwordGeneratorPolicyOptions";
|
||||||
@@ -161,14 +161,14 @@ export class PasswordGenerationService implements PasswordGenerationServiceAbstr
|
|||||||
o.includeNumber = false;
|
o.includeNumber = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const listLength = EEFLongWordList.length - 1;
|
const listLength = EFFLongWordList.length - 1;
|
||||||
const wordList = new Array(o.numWords);
|
const wordList = new Array(o.numWords);
|
||||||
for (let i = 0; i < o.numWords; i++) {
|
for (let i = 0; i < o.numWords; i++) {
|
||||||
const wordIndex = await this.cryptoService.randomNumber(0, listLength);
|
const wordIndex = await this.cryptoService.randomNumber(0, listLength);
|
||||||
if (o.capitalize) {
|
if (o.capitalize) {
|
||||||
wordList[i] = this.capitalize(EEFLongWordList[wordIndex]);
|
wordList[i] = this.capitalize(EFFLongWordList[wordIndex]);
|
||||||
} else {
|
} else {
|
||||||
wordList[i] = EEFLongWordList[wordIndex];
|
wordList[i] = EFFLongWordList[wordIndex];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { FirefoxRelayForwarder } from "../emailForwarders/firefoxRelayForwarder"
|
|||||||
import { Forwarder } from "../emailForwarders/forwarder";
|
import { Forwarder } from "../emailForwarders/forwarder";
|
||||||
import { ForwarderOptions } from "../emailForwarders/forwarderOptions";
|
import { ForwarderOptions } from "../emailForwarders/forwarderOptions";
|
||||||
import { SimpleLoginForwarder } from "../emailForwarders/simpleLoginForwarder";
|
import { SimpleLoginForwarder } from "../emailForwarders/simpleLoginForwarder";
|
||||||
import { EEFLongWordList } from "../misc/wordlist";
|
import { EFFLongWordList } from "../misc/wordlist";
|
||||||
|
|
||||||
const DefaultOptions = {
|
const DefaultOptions = {
|
||||||
type: "word",
|
type: "word",
|
||||||
@@ -50,8 +50,8 @@ export class UsernameGenerationService implements BaseUsernameGenerationService
|
|||||||
o.wordIncludeNumber = true;
|
o.wordIncludeNumber = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const wordIndex = await this.cryptoService.randomNumber(0, EEFLongWordList.length - 1);
|
const wordIndex = await this.cryptoService.randomNumber(0, EFFLongWordList.length - 1);
|
||||||
let word = EEFLongWordList[wordIndex];
|
let word = EFFLongWordList[wordIndex];
|
||||||
if (o.wordCapitalize) {
|
if (o.wordCapitalize) {
|
||||||
word = word.charAt(0).toUpperCase() + word.slice(1);
|
word = word.charAt(0).toUpperCase() + word.slice(1);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user