package
0.0.0-20240919114743-50719c65f9a9
Repository: https://github.com/alex1988m/go-gophercises.git
Documentation: pkg.go.dev
# README
Vault - Encrypted Key-Value Store
Vault is a simple command-line application that provides an encrypted key-value store. It allows users to securely store and retrieve sensitive information using AES encryption.
Features
- Set encrypted values associated with keys
- Retrieve decrypted values using keys
- AES encryption for secure storage
- File-based persistence
- Command-line interface
Installation
-
Clone the repository:
git clone https://github.com/alex1988m/go-gophercises.git
-
Navigate to the project directory:
cd go-gophercises/5-vault
-
Install dependencies:
go mod tidy
-
Create a
.env
file in the project root and set your cipher key:CIPHER_KEY=your32charactercipherkeygoeshere
Usage
Set a value
go run main.go set <key> <value>
Example:
go run main.go set mypassword secretpassword123
Get a value
go run main.go get <key>
Example:
go run main.go get mypassword
Project Structure
main.go
: Entry point of the application, handles CLI commandsvault/vault.go
: Core vault functionality including encryption/decryptionvault/file_vault.go
: File-based storage implementationlogger/logger.go
: Logging configuration
Dependencies
- github.com/urfave/cli/v2: CLI application framework
- github.com/sirupsen/logrus: Structured logger
- github.com/joho/godotenv: Loads environment variables from .env file
- github.com/pkg/errors: Error handling
Security Note
Ensure that your .env
file and vault.json
are not shared or committed to version control, as they contain sensitive information.