Vault OS 1.0

Your passwords. Your terminal. Your rules.

๐Ÿ“„ Click to read about Vault OS โ–ผ
Vault OS 1.0 is a minimalist command-line password manager โ€” built in pure Python, with zero dependencies.

Inspired by retro terminal interfaces, Vault OS greets users as "Commander" and provides a mini-OS feel while performing actions like storing, updating, and retrieving credentials.

With animated text printing, file handling, and clean logic, it's not just functional โ€” it's a demonstration of how Python can feel powerful and personal at the same time.

๐Ÿ”— GitHub Project Link

        import json
        import time
        from pathlib import Path
        import sys
        
        def type_print(msg, speed=0.03):
            for ch in msg:
                print(ch, end='', flush=True)
                time.sleep(speed)
        
        greet = "\n๐Ÿ“€ Welcome to Vault OS 1.0 โ€” Your Personal Password Commander\n-------------------------------------------------------------\nChoose an operation:\n1. Access stored credentials\n2. Store a new credential\n3. Update existing credential\n4. Remove a saved credential\n5. Shut down Vault OS\n\n"
        
        database = Path(__file__).parent / "database.json"
        
        def clear():
            import os
            os.system('cls' if os.name == 'nt' else 'clear')
        
        def load_data():
            global data
            try:
                with open(database, "r") as f:
                    data = json.load(f)
            except (json.JSONDecodeError, FileNotFoundError):
                data = {}
        
        def main_menu():
            while True:
                clear()
                type_print(greet, 0.01)
                load_data()
                choice = input("--> Vault OS command: ")
        
                if choice == "1":
                    clear()
                    show_passwords()
                elif choice == "2":
                    clear()
                    add_password()
                elif choice == "3":
                    clear()
                    edit_password()
                elif choice == "4":
                    clear()
                    del_password()
                elif choice == "5":
                    clear()
                    type_print("\n๐Ÿ›ก๏ธ Shutting down Vault OS... Stay secure, Commander!\n")
                    sys.exit()
                else:
                    type_print("โŒ Invalid command. Please try again.\n")
        
        def show_passwords():
            if not data:
                type_print("โš ๏ธ Vault OS database is empty, Commander.\n")
                return
            else:
                type_print("๐Ÿ” Decrypted credentials:\n")
                for key, value in data.items():
                    website, username = key.split("_")
                    type_print(f"๐Ÿ”ธ {username}'s {website} -> {value}\n\n")
                type_print("โ†ฉ๏ธ Returning to Vault OS menu...\n")
        
        def add_password():
            a = input("๐ŸŒ Website: ")
            b = input("๐Ÿ‘ค Username: ")
            c = input("๐Ÿ”‘ Password: ")
            data[f"{a}_{b}"] = c
            with open(database, "w") as f:
                json.dump(data, f, indent=4)
            type_print("๐Ÿ’พ Saving to Vault...\n")
            type_print("โœ… Operation completed. Returning to menu...\n")
        
        def edit_password():
            if not data:
                type_print("โš ๏ธ Vault OS database is empty.\n")
                return
            else:
                temp_data = {}
                for i, (key, value) in enumerate(data.items(), start=1):
                    temp_data[f"key_{i}"] = key
                    a, b = key.split("_")
                    type_print(f"{i}. {b}'s {a} account -> {value}\n")
                number = input("๐Ÿ› ๏ธ Enter number to update: ")
                while True:
                    fstring = f"key_{number}"
                    key_in_process = temp_data.get(fstring)
                    if key_in_process:
                        a1, b1 = key_in_process.split("_")
                        new_pass = input(f"๐Ÿ”„ New password for {b1}'s {a1} account: ")
                        data[key_in_process] = new_pass
                        with open(database, "w") as f:
                            json.dump(data, f, indent=4)
                        type_print("โœ… Credential updated successfully.\n")
                        return
                    else:
                        type_print("โŒ Invalid input. Please retry.\n")
                        number = input("--> ")
        
        def del_password():
            if not data:
                type_print("โš ๏ธ Vault OS database is empty.\n")
                return
            else:
                temp_data = {}
                for i, (key, value) in enumerate(data.items(), start=1):
                    temp_data[f"key_{i}"] = key
                    a, b = key.split("_")
                    type_print(f"{i}. {b}'s {a} account -> {value}\n")
                number = input("๐Ÿงจ Enter number to delete: ")
                while True:
                    fstring = f"key_{number}"
                    key_in_process = temp_data.get(fstring)
                    if key_in_process:
                        data.pop(key_in_process)
                        with open(database, "w") as f:
                            json.dump(data, f, indent=4)
                        type_print("๐Ÿ—‘๏ธ Entry deleted. Returning to menu...\n")
                        return
                    else:
                        type_print("โŒ Invalid input. Please retry.\n")
                        number = input("--> ")
        
        if __name__ == "__main__":
            main_menu()