Skip to content
/ vault Public

Vault is a local CLI-based password manager. Safely stored & encrypted. Built using Go programming language.

License

Notifications You must be signed in to change notification settings

1001api/vault

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

banner

Vault

A secure, local CLI-based password manager built in Go. Store and manage your passwords with military-grade encryption, all stored locally on your machine.

Features

  • πŸ” Strong Encryption: AES-256-GCM encryption with Argon2id key derivation
  • πŸ”‘ Master Password: Single master password protects all your credentials
  • πŸ’Ύ Local Storage: All data stored locally in ~/.vault.json
  • πŸ“‹ Clipboard Integration: Automatic password copying to clipboard
  • 🎯 Interactive Mode: User-friendly command-line interface
  • πŸ”’ Memory Safety: Sensitive data zeroed out after use to prevent memory leaks
  • πŸ†” Unique IDs: Cryptographically secure random IDs using nanoid

Security Architecture

Encryption Details

  • Key Derivation: Argon2id with configurable parameters
    • Time cost: 2 iterations
    • Memory cost: 128 MiB
    • Parallelism: 4 threads
    • Output: 32-byte key
  • Encryption Algorithm: AES-256-GCM (Galois/Counter Mode)
  • Key Wrapping: Master password derives KEK (Key Encryption Key), which encrypts DEK (Data Encryption Key)
  • Nonce: Unique 12-byte nonce for each encryption operation
  • Salt: 16-byte random salt for key derivation

How It Works

  1. Initialization: Master password β†’ Argon2id β†’ KEK β†’ Encrypts DEK β†’ Stores wrapped DEK
  2. Unlock: Master password β†’ Argon2id β†’ KEK β†’ Decrypts DEK β†’ Unlocks vault
  3. Entry Storage: Password β†’ AES-GCM (using DEK) β†’ Base64-encoded ciphertext

Installation

Prerequisites

  • Go 1.25.1 or higher
  • Linux/macOS (clipboard support)

Build from Source

git clone <repository-url>
cd vault
go build -o vault ./cmd/main.go

Install

# Move to a directory in your PATH
sudo mv vault /usr/local/bin/

Usage

Initialize Vault

Create a new vault with a master password:

vault init

You'll be prompted to create and confirm a master password.

Unlock Vault

Unlock the vault and enter interactive mode:

vault unlock

Interactive Commands

Once unlocked, you can use the following commands:

Add Entry

vault> add <site> <username>

Example:

vault> add github.com john.doe
Enter entry password: ********
βœ… Entry added successfully

Get Entry

Retrieve an entry by ID or site name (password copied to clipboard):

vault> get <id/site>

Example:

vault> get github.com
============================================================
Site:     github.com
Username: john.doe
------------------------------------------------------------
πŸ”‘ Password copied to clipboard.
============================================================

List Entries

Display all stored entries:

vault> list
============================================================
No.   | ID     | Site                     | Username            
------------------------------------------------------------
1     | abc123 | github.com               | john.doe            
2     | def456 | gitlab.com               | jane.smith          
------------------------------------------------------------
Total entries: 2

Remove Entry

Delete an entry by ID:

vault> remove <id>

Example:

vault> remove abc123
βœ… Entry removed successfully.

Lock Vault

Lock the vault and exit:

vault> lock
πŸ”’ Vault locked successfully.

Project Structure

vault/
β”œβ”€β”€ cmd/
β”‚   └── main.go           # Main application entry point and CLI logic
β”œβ”€β”€ internal/
β”‚   β”œβ”€β”€ vault.go          # Cryptographic operations (Argon2, AES-GCM)
β”‚   β”œβ”€β”€ io.go             # File I/O and password input handling
β”‚   └── type.go           # Data structures (Vault, Entry)
β”œβ”€β”€ go.mod                # Go module dependencies
β”œβ”€β”€ go.sum                # Dependency checksums
β”œβ”€β”€ LICENSE               # License file
└── README.md             # This file

Dependencies

  • golang.org/x/crypto: Argon2 key derivation
  • golang.org/x/term: Secure password input
  • golang.design/x/clipboard: Clipboard operations
  • github.com/sixafter/nanoid: Cryptographically secure ID generation

Data Storage

Vault data is stored in ~/.vault.json with the following structure:

{
  "salt": "base64-encoded-salt",
  "wrapped_dek": "base64-encoded-encrypted-dek",
  "nonce_dek": "base64-encoded-nonce",
  "version": "1.0.0",
  "created_at": 1234567890,
  "entries": [
    {
      "id": "abc123",
      "site": "example.com",
      "username": "user@example.com",
      "password": "base64-encoded-encrypted-password"
    }
  ]
}

File Permissions: The vault file is created with 0600 permissions (read/write for owner only).

Security Best Practices

  1. Choose a Strong Master Password: Use a long, unique passphrase
  2. Keep Backups: Regularly backup ~/.vault.json to a secure location
  3. Protect Your Master Password: Never share or write down your master password
  4. Secure Your System: Ensure your operating system is secure and up-to-date
  5. Lock When Done: Always lock the vault when finished

Limitations

  • No Cloud Sync: All data is stored locally
  • Single User: Designed for single-user use
  • No Password Recovery: If you forget your master password, data cannot be recovered
  • Platform Support: Currently supports Linux/macOS (clipboard functionality)

Development

Run Tests

go test ./...

Build

go build -o vault ./cmd/main.go

Code Structure

  • VaultService: Handles all cryptographic operations
  • IOService: Manages file I/O and user input
  • Interactive Mode: REPL-style interface for vault operations

License

See LICENSE file for details.

Contributing

Contributions are welcome! Please ensure all security-related changes are thoroughly reviewed.

Disclaimer

This is a personal password manager. While it uses industry-standard encryption, use at your own risk. Always maintain backups of your vault file.

About

Vault is a local CLI-based password manager. Safely stored & encrypted. Built using Go programming language.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages