keyra
v1.2.0
Published
Keyra is a stateless password generator that uses your master password and service name to create strong, unique, and repeatable passwords for every website.
Readme
Keyra
Keyra is a stateless password generator that uses your master password and service name to create strong, unique, and repeatable passwords for every website.
Features
- Stateless Design: No passwords are stored, just remember one master password
- Deterministic Generation: Same inputs always produce the same password
- Highly Configurable: Customize password rules and version control
- Secure Algorithm: Uses scrypt encryption algorithm to ensure password security
- Version Control: Allows updating passwords for specific services without changing the master password
Try Keyra Online
Try Keyra without installation on our web application: https://9b9387.github.io/keyra
The online application offers the same functionality as the installed version but runs directly in your browser.
Usage
As a CLI Tool
# Global installation
npm install -g keyraAvailable Commands
Password commands:
gen <service>: Generate a password for the given service.-r, --rule <rule>: Specify a password rule name (must already exist).-p, --password <masterPassword>: Provide master password (otherwise will prompt interactively / or use environment variableKEYRA_MASTER_PASSWORD).-s, --save: Save the generated service (version=1) locally.
get <service>: Retrieve current password for a service.-d, --detail: Show detailed metadata (rule, created time, note, etc.).-v, --versions: Show all historical versions (password history). Can be combined with--detail.-p, --password <masterPassword>: Provide master password (else prompt / env).
rotate <service>: Increment version for a service (does NOT output password directly; usegetafterwards to see the new password).list: List all saved service entries.delete <service>: Remove stored password data for the given service.note <service> [note]: View or update note for a service.sync: Sync local data to remote git repository.
Rule commands:
rule list: Show all password rules.rule add: Interactive creation of a new password rule.rule delete <rule>: Delete an existing password rule (cannot deletedefault).
Global master password environment variable:
export KEYRA_MASTER_PASSWORD="yourMasterPassword"Then you can omit -p/--password.
Examples
Generate (not saving):
keyra gen githubGenerate with rule and save:
keyra rule add # Interactively create a custom rule, assume it is named myrule
keyra gen github -r myrule -s -p "My$ecret" # Generate immediately and saveList saved services:
keyra listGet current password (using env variable for master password):
export KEYRA_MASTER_PASSWORD="My$ecret"
keyra get githubShow password with details:
keyra get github -dShow password history (all versions) with details:
keyra get github -v -dRotate (bump version):
keyra rotate github
keyra get github # See the new version passwordDelete a service:
keyra delete githubManage notes:
# Set a note
keyra note github "This is my personal github account"
# View note
keyra note githubGit Synchronization
Keyra supports syncing your local data (~/.keyra) to a remote Git repository.
- Create a configuration file at
~/.keyra/git.json:
{
"repository": "[email protected]:username/my-keyra-backup.git",
"branch": "main",
"name": "Your Name",
"email": "[email protected]"
}repository: (Required) The remote repository URL. It is recommended to use a private repository.branch: (Optional) The branch to sync with. Defaults tomain.name: (Optional) Git user name for commits (local config).email: (Optional) Git email for commits (local config).
- Run the sync command:
keyra syncThis will:
- Initialize a git repository in
~/.keyraif it doesn't exist. - Pull changes from the remote repository.
- Commit local changes.
- Push to the remote repository.
As a Library
npm install keyraimport { KeyraData, KeyraRule, Generator } from 'keyra';
// Create custom password rule
const rule = new KeyraRule(
'my-rule', // Rule name
16, // Password length
true, // Require uppercase letters
true, // Require lowercase letters
true, // Require numbers
true, // Require symbols
'!@#$%^&*', // Allowed symbols
);
// Create service data
const data = new KeyraData(
'github.com', // Service name
1, // Password version
rule, // Password rule
'My GitHub account', // Note
);
// Generate password
const generator = new Generator();
(async () => {
const password = await generator.generate('masterPassword', data);
console.log(password); // Output the generated password
})();Password Rules
You can customize password generation rules with the KeyraRule class:
name: Rule namelength: Password length (minimum 4 characters)requireUppercase: Whether uppercase letters are requiredrequireLowercase: Whether lowercase letters are requiredrequireNumbers: Whether numbers are requiredrequireSymbols: Whether symbols are requiredallowedSymbols: Which symbols are allowed
Version Control
When you need to update a password for a service, you can increase the version value to generate a new password without changing your master password.
const data = new KeyraData('github.com', 2); // Version 2 will generate a different passwordSecurity Notes
- Your master password is never stored or transmitted
- Password generation uses the scrypt algorithm, which has high computational cost to prevent brute force attacks
- All password generation is done locally with no network communication
Contributing
Pull requests and issues are welcome to improve this project.
License
MIT
