mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 16:53:34 +00:00
passphrase generator on CLI
This commit is contained in:
@@ -15,6 +15,9 @@ export class GenerateCommand {
|
||||
number: cmd.number || false,
|
||||
special: cmd.special || false,
|
||||
length: cmd.length || 14,
|
||||
type: cmd.passphrase ? 'passphrase' : 'password',
|
||||
wordSeparator: cmd.separator == null ? '-' : cmd.separator,
|
||||
numWords: cmd.words || 3,
|
||||
};
|
||||
if (!options.uppercase && !options.lowercase && !options.special && !options.number) {
|
||||
options.lowercase = true;
|
||||
@@ -24,6 +27,14 @@ export class GenerateCommand {
|
||||
if (options.length < 5) {
|
||||
options.length = 5;
|
||||
}
|
||||
if (options.numWords < 3) {
|
||||
options.numWords = 3;
|
||||
}
|
||||
if (options.wordSeparator === 'space') {
|
||||
options.wordSeparator = ' ';
|
||||
} else if (options.wordSeparator != null && options.wordSeparator.length > 1) {
|
||||
options.wordSeparator = options.wordSeparator[0];
|
||||
}
|
||||
const password = await this.passwordGenerationService.generatePassword(options);
|
||||
const res = new StringResponse(password);
|
||||
return Response.success(res);
|
||||
|
||||
Reference in New Issue
Block a user