#!/bin/bash
# setup
# install zbar
# brew install zbar
# apt-get install -y zbar
# ...
# which zbarimg
# should get something like: /usr/local/bin/zbarimg
# Path to the QR code image. you can use snap tool to copy it from your screen
QR_CODE_IMAGE_PATH="path/to/your/qr-code.png"
# Use zbarimg to read the QR code and extract the secret key
SECRET_KEY=$(zbarimg --raw "$QR_CODE_IMAGE_PATH" | grep -o 'secret=[^&]*' | cut -d'=' -f2)
# Print the secret key
echo "Secret Key: $SECRET_KEY to paste into the Right click on the KeePassXC entri , TOTP, Setup ToTP , Secret Key input field"
# Click Ok. Next time you want the code - Right Click on the pw entry , Ctrl + T or Cmd + T