Skip to content

Instantly share code, notes, and snippets.

@cqsd
Last active April 10, 2023 15:37
Show Gist options
  • Save cqsd/1f9241ae24a9e209b932cbc1188fdb58 to your computer and use it in GitHub Desktop.
Save cqsd/1f9241ae24a9e209b932cbc1188fdb58 to your computer and use it in GitHub Desktop.
Use the macOS `security` tool to manage [minor] secrets

cringe

export GITHUB_TOKEN=ghp_adiugaslhdg...
export IQAIR_API_KEY=oiheorhialjkfbld...

based

# add a new token called "cqsd/auth-only" for the "github" service to the macOS keychain
security add-generic-password -a cqsd/auth-only -s github -w

# recall it later
security find-generic-password -a cqsd/auth-only -s github -wg

now you can keep plaintext strings out...

export GITHUB_TOKEN=$(security find-generic-password -a cqsd/auth-only -s github -wg)
export IQAIR_API_KEY=oiheorhialjkfbld... # you can have this for free hehe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment