passes shell script error

Hello!
I have used the following script for several years to test a PDF for encryption. Moved to a M1 Mac and it stopped working
qpdf --requires-password "$1"
if [[ $? = 3 ]]; then
exit 0
else
exit 1
fi
QPDF is installed and if I run it on terminal it works perfectly and answers with a code = 3
I tried reversing the exit codes in the if statement to see if the exit code was giving a wrong answer, but the if statement fails either way
What could be the error?
I have used the following script for several years to test a PDF for encryption. Moved to a M1 Mac and it stopped working
qpdf --requires-password "$1"
if [[ $? = 3 ]]; then
exit 0
else
exit 1
fi
QPDF is installed and if I run it on terminal it works perfectly and answers with a code = 3
I tried reversing the exit codes in the if statement to see if the exit code was giving a wrong answer, but the if statement fails either way
What could be the error?