Touch ID Command Line Interface (tidcli) simply pops a Touch ID prompt.
It returns an exit code of 0 on success and 1 on failure.
You can use this to embed additional authentication steps into your shell script or the like.
![image](https://private-user-images.githubusercontent.com/1150684/335502672-999a9a41-75d6-4366-b97b-ee6b425e1c1e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ2NzQ5ODEsIm5iZiI6MTcyNDY3NDY4MSwicGF0aCI6Ii8xMTUwNjg0LzMzNTUwMjY3Mi05OTlhOWE0MS03NWQ2LTQzNjYtYjk3Yi1lZTZiNDI1ZTFjMWUucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDgyNiUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA4MjZUMTIxODAxWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZTdkZWU1ZGEzNWUwMWI0YmE3Zjc0Y2Q0ZDkwMWQxOTYyOTI4ZTc0M2EzNzkwOTNkOTIzYWY2OTBjZWEwNTBjYiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.clLXr7eCq1Dn0IHgId4SMLje1-4rZ3GTEFSUxybScRk)
tidcli [optional prompt context]
Optional custom prompt information can be passed as the first argument. This is limited to 100 characters.
An example of using it in a bash shell script to exit if there is an authentication failure is:
tidcli "EXAMPLE SCRIPT"
if [[ "$?" -ne 0 ]]; then
exit 1
fi
Download the appropriate binary from the releases page.
Build a release binary with swift by running:
swift build -c release
The resulting binary will be in the .build/release
directory as tidcli
.
The Touch ID prompt will contain a "Use Password" button, but only biometric authentication is allowed, so clicking it will result in an authentication failure. If you wanted to change this you could use .deviceOwnerAuthentication
instead of .deviceOwnerAuthenticationWithBiometrics
.
Success and failure messages are output to standard error.
A macOS sandbox profile is included if you're so inclined. You can execute it with sandbox-exec
and just need to pass the full path of where the binary is located. For example:
sandbox-exec -D_PWD="$PWD/tidcli" -f tidcli.sb tidcli