#secret #secret-storage

bt_secure_storage

A simple and lightweight Secret Vault and Encryption Library for Rust to store secrets

9 releases

Uses new Rust 2024

0.2.4 Nov 24, 2025
0.2.3 Nov 24, 2025
0.1.3 Nov 13, 2025
0.1.2 Oct 28, 2025

#2325 in Cryptography


Used in bt_auth0

GPL-3.0-only

28KB
340 lines

Project Title

BT Secure Storage

Description

This library provides a simple secret vault and encryption system using the whoami crate to get the username and the keyring backend to store secrets securely. It also includes an encryption/decryption system based on AES.

Features

  • Secure Secret Storage: Store sensitive data like passwords, API keys, or tokens securely.
  • Encryption/Decryption: Use AES for encrypting and decrypting data.
  • Test Cases: Unit tests are included to verify the functionality of the library.

Usage

    let vault = SecretVault::new("my_app");
    let cipher = SecretCipher::new();

    // Store a secret securely
    let service_name = "my_service";
    let secret = "super_sensitive_data";
    vault.store_secret(service_name, secret)?;

    // Retrieve the stored secret
    let retrieved_secret = vault.retrieve_secret(service_name)?;
    assert_eq!(retrieved_secret, secret);

    // Encrypt and decrypt data using AES
    let encrypted_data = cipher.encrypt_secret(secret, "my_key")?;
    let decrypted_data = cipher.decrypt_secret(&encrypted_data.0, &encrypted_data.1, "my_key")?;

Version History

  • 0.1.0
    • Initial Release
  • 0.1.1
    • Make mod public
  • 0.1.2
    • Make hashing functions public
  • 0.1.2
    • Update dependencies
  • 0.2.0
    • Change to Base91 encoding from Based64 to reduce overhead in encrypt_secret
  • 0.2.1
    • Change Salt from 32 to 12 bytes
  • 0.2.2
    • Support for long secrets under windows using encrypted file.
  • 0.2.3
    • Cleaner code.
  • 0.2.4
    • Improve file name for long secrets

License

GPL-3.0-only

Dependencies

~12–29MB
~353K SLoC