new XKPasswd()
- Description:
Main class
- Source:
Methods
__padWithChar(passwd, padChar) → {any}
- Description:
Pad the password with pad character
- Source:
Parameters:
Name | Type | Description |
---|---|---|
passwd |
any | |
padChar |
any |
Returns:
- the padded password
- Type
- any
__padWithDigits(passwd, separator) → {any}
- Description:
Pad the password with random digits
- Source:
Parameters:
Name | Type | Description |
---|---|---|
passwd |
any | |
separator |
any |
Returns:
- the padded password
- Type
- any
__substituteCharacters(words) → {any}
- Description:
Substitute characters
TODO - should this be implemented? there is no config option for it
- Source:
Parameters:
Name | Type | Description |
---|---|---|
words |
any |
Returns:
- Type
- any
__transformCase(words) → {array}
- Description:
Apply the case transform (if any) specified in the loaded config.
Notes:
- The transformations applied are controlled by the case_transform config variable.
- Treat this as a private function
- Source:
Parameters:
Name | Type | Description |
---|---|---|
words |
array | array of words to be transformed |
Throws:
exception when there is a problem
Returns:
- array of transformed words
- Type
- array
generatePassword(num) → {object}
- Description:
Generate the password(s) and stats
- Source:
Parameters:
Name | Type | Description |
---|---|---|
num |
number | number of passwords to generate |
Returns:
- contains the passwords and the stats
- Type
- object
getPreset() → {Presets}
- Description:
Get the current preset
- Source:
Returns:
the current preset
- Type
- Presets
getPresets() → {array}
- Description:
Get all available presets
- Source:
Returns:
keys - names of the Presets
- Type
- array
password() → {string}
- Description:
Return a password that adheres to the chosen preset
- Source:
Returns:
- Type
- string
passwords(num) → {array}
- Description:
Generate the requested number of passwords
- Source:
Parameters:
Name | Type | Description |
---|---|---|
num |
number | the number of passwords requested |
Returns:
- the array with num passwords
- Type
- array
setCustomPreset(settings)
- Description:
Create a CUSTOM preset and set the default preset to it.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
settings |
object | object containing the settings |
setPreset(preset)
- Description:
Set a different preset to work with
- Source:
Parameters:
Name | Type | Description |
---|---|---|
preset |
any |
toTitleCase(str) → {string}
- Description:
Turn the string into a title case
- Source:
Parameters:
Name | Type | Description |
---|---|---|
str |
string | string to be converted |
Returns:
- converted string
- Type
- string