Skip to main content
coreydaley.dev
Docs menu

Using a secret in Shortcuts or a script

Coming in Secret Store 1.3. It's built and arrives with the next update; the version on the App Store doesn't have it yet.

Secret Store has four Shortcuts actions:

  • Find Secrets lists secrets by name and tag. It never gives a value.
  • Copy Secret copies a value to the clipboard, hidden from clipboard history and cleared after 90 seconds. Use this for anything you paste yourself.
  • Get Secret gives a value to the shortcut, for a script that needs it.
  • Add Secret stores a new secret, for example a key a script just made.

Turning them on

Shortcuts can’t use any secret until you allow it, in Secret Store’s Settings (⌘, on Mac, under Shortcuts; on iPhone and iPad, tap the ⋯ button, then Settings):

  1. Turn on Allow Shortcuts to use secrets.
  2. Click Choose What Shortcuts Can Use…, add the tags or single secrets Shortcuts may use (search, or open a tag to pick a sub-tag or a secret), and click Save. A tag includes its nested tags and any secret added under it later. What can Shortcuts see? lists everything that adds up to.

Both are set on each device and don’t sync. Find Secrets only lists the secrets on the list, and Copy Secret and Get Secret refuse every other one.

Every time Copy Secret or Get Secret runs, Secret Store asks for Touch ID, Face ID or your password, and the prompt names the secret. If you cancel, the shortcut gets an error and no value.

Using a secret in a script on Mac

Make a shortcut with a Get Secret action for the secret, and name it, for example, “Stripe key”. Then, in Terminal:

STRIPE_KEY=$(shortcuts run "Stripe key") ./deploy.sh

The value goes only to that command, and nothing is written to disk.

Important: Once a shortcut has a value, Secret Store can’t protect it any more: the shortcut or script can save it, send it or show it. Only share secrets with shortcuts you made, and use Copy Secret for anything you do by hand.

Seeing what Shortcuts used

Settings ▸ Shortcuts activity lists each time a shortcut used, was refused or added a secret, with the date. It’s kept on that device only and never includes a value. Clear Activity empties it.