#!/bin/bash # ComfyUI Encryption Scripts - Encryption (macOS) # Works with both DropSend and DriveSend nodes # Encrypts image/video files using a key stored in macOS Keychain # # NOTE: This script is for LOCAL USE ONLY - for encrypting files on your local machine # outside of ComfyUI. The nodes handle encryption automatically during upload. echo "=== ComfyUI File Encryption (macOS) ===" echo "" echo "NOTE: This script is for LOCAL USE ONLY." echo "The ComfyUI nodes handle encryption automatically during upload." echo "" echo "Drag in the folder of files to encrypt, or type the path:" # Read folder path (supports drag-and-drop) read -r FOLDER # Remove any surrounding quotes and trailing backslash from drag-and-drop FOLDER=$(echo "$FOLDER" | sed "s/^['\"]//;s/['\"]$//;s/\\\\$//" | xargs) # Validate folder path if [ -z "$FOLDER" ] || [ ! -d "$FOLDER" ]; then echo "Error: '$FOLDER' is not a valid directory." exit 1 fi echo "Processing folder: $FOLDER" echo "" # Prompt for recursive option echo "Would you like to encrypt files recursively (including subfolders)? (Y/N)" read -r RECURSIVE_RESPONSE if [[ "$RECURSIVE_RESPONSE" == "Y" || "$RECURSIVE_RESPONSE" == "y" ]]; then RECURSIVE="true" else RECURSIVE="false" fi # Retrieve key from Keychain (try multiple names for compatibility) echo "" echo "Retrieving key from Keychain..." KEY=$(security find-generic-password -s "ComfyUI_Encryption_Key" -a "ComfyUI" -w 2>/dev/null) if [ -z "$KEY" ]; then KEY=$(security find-generic-password -s "DropSend_Encryption_Key" -a "DropSend" -w 2>/dev/null) fi if [ -z "$KEY" ]; then KEY=$(security find-generic-password -s "DriveSend_Encryption_Key" -a "DriveSend" -w 2>/dev/null) fi if [ -z "$KEY" ]; then echo "" echo "Error: Failed to retrieve key from Keychain." echo "" echo "To store your encryption key in Keychain:" echo " 1. Open Keychain Access (search in Spotlight)" echo " 2. Click File > New Password Item" echo " 3. Set Keychain Item Name: ComfyUI_Encryption_Key" echo " 4. Set Account Name: ComfyUI" echo " 5. Set Password: [your encryption key]" echo " 6. Click Add" echo "" exit 1 fi echo "Key retrieved successfully." echo "" # Python script to encrypt supported files python3 - <