clog_rs 0.0.1

A cryptographically secure content storing library. Provides simple APIs to create, read, and edit files without compromising security.
Documentation

πŸ›‘οΈ clog β€” Cryptographically Secure Daily Journal/Diary

clog is a Rust crate for safely creating, storing, and updating daily notes or any content using cryptographically secure methods. All files and metadata are stored in a single encrypted .clog(or custom file extension) file, making your private thoughts or sensitive content both secure and portable. Without the correct password, no content can be accessed.

This crate is ideal for diary writing, private note-taking, or storing content, where privacy and tamper-resistance are essential.


✨ Features

  • πŸ” End-to-end password-based encryption
  • πŸ“ Entries organized in auto-created date-based folders (dd/mm/yyyy)
  • πŸ“ Only entries inside today's folder can be edited
  • πŸ“„ All content (notes + metadata) stored in a single encrypted file
  • πŸ‘₯ Multi-user support
  • 🧾 Clean JSON metadata export for backup or syncing

πŸ“¦ Installation

Add this to your Cargo.toml:

[dependencies]
clog_rs = "0.0.1"

πŸ”§ Exposed API

βž• Add New User

add_new_user(password: &str, clogfile_path: &str)

Creates a new encrypted .clog(or custom file extension) file with a user.


πŸ“ Add a Folder

add_folder(clogfile_path: &str, password: &str)

Creates a new folder for the current date. Automatically handled internally.


πŸ“„ Add a Note

add_file(password: &str, clogfile_path: &str, filename: &str, file_content: &str)

Adds a note to today’s folder (dd/mm/yyyy). Creates the folder if missing.


✏️ Edit a Note

update_file_content(
    password: &str,
    clogfile_path: &str,
    filename: &str,
    foldername: &str,
    new_file_content: &str,
)

Replaces content of a note inside today's folder only. Older notes are read-only.


πŸ”“ Read a Note

get_file_content(
    password: &str,
    clogfile_path: &str,
    filename: &str,
    foldername: &str,
) -> String

Decrypts and returns note content if the password is correct.


🧠 Get JSON Metadata

get_json_metadata(password: &str, clogfile_path: &str) -> String

Returns stripped metadata as a clean JSON string.


🧱 Metadata Structure

Internally, metadata is securely stored in the .clog(or custom file extension) file. It looks like this (JSON):

{
  "folders": {
    "25/05/2025": {
      "morning-thoughts.txt": {
        "created_at": "08:15:02 AM"
      },
      "evening-reflection.md": {
        "created_at": "08:55:42 PM"
      }
    },
    "24/05/2025": {
      "goals.txt": {
        "created_at": "03:31:12 PM"
      }
    }
  },
  "created_at": "24/05/2025"
}
  • folders β€” contains all journal folders by date.
  • Each note includes created_at in "%I:%M:%S %p" format (e.g., 08:15:02 AM).
  • Top-level created_at marks the file's creation date.

πŸ” Security Model

  • Uses AES encryption from trusted Rust crypto libraries.
  • All content β€” notes + metadata β€” encrypted in one file.
  • Without password, nothing is accessible.
  • Only today's entries are editable β€” older entries are locked.

πŸš€ Example Usage

use clog::*;

let clog_path = "my_journal.clog";
let password = "super_secure_password";

// Step 1: Create your secure journal
add_new_user(password, clog_path);

// Step 2: Add a new entry
add_file(password, clog_path, "reflection.txt", "Today I learned something new...");

// Step 3: Read it later
let content = get_file_content(password, clog_path, "reflection.txt", "25/05/2025");
println!("Decrypted entry: {}", content);

// Step 4: View metadata
let metadata = get_json_metadata(password, clog_path);
println!("Metadata: {}", metadata);

πŸ“„ License

MIT Β© 2025 Deep Gajjar


🀝 Contributions

PRs and suggestions are welcome! Let's make encrypted journaling elegant and secure.