Keeping secrets on your Mac
Keep tokens and passwords out of shared workspace files.
Overview
A workspace you keep in a folder can be committed to Git and shared with your team. Tokens, passwords and keys shouldn't travel with it. Relay keeps them on your Mac instead: the workspace's files hold only the names of secret variables, and empty auth credentials, while the values stay in a separate store on your Mac, encrypted with a key kept in your keychain.
These stay on your Mac:
- Secret variables: The values of variables you mark as secret, at every level: globals, workspaces, environments, collections and folders.
- Auth credentials: Tokens, passwords, keys and other credential fields in authentication settings, on workspaces, collections, folders and requests.
- Client certificates: The certificate files and their passphrases.
Relay also encrypts your request history and stored OAuth 2.0 tokens.
Mark a variable as secret
In any variables table, click the lock beside a row's value. A closed lock means the variable is secret and its value is stored only on this Mac. An open lock means its value is stored in the workspace.
A secret's value shows as dots. To see it, hold the pointer over its field. While you're editing, it shows as you type.
Use secrets on another Mac
When a teammate opens the workspace, or you open it on another Mac, each secret variable is there with its name but without a value. Its value field shows "No value on this Mac", and so does the request editor's Variables list.
A secret without a value counts as missing: a token that uses it is sent as written. It still overrides levels below it, so a request never quietly picks up a lower level's value of the same name instead. To use the variable, enter a value. It's stored on that Mac only.
Reference secrets from authentication
An auth field whose whole value is variable references, such as {{token}} or {{user}}:{{password}}, is written to the workspace's files, because a reference isn't a secret. Any other credential, including one that mixes text with a reference, such as Bearer {{token}}, stays on your Mac.
Tip
{{apiToken}} for a bearer token. Your teammates then get the authentication set up and only need to enter their own value for the variable.For more information about authentication, see Inheriting authentication.
Import secret variables
Some imports mark variables as secret for you:
- Variables of type
secretin a Postman environment become secret variables. Postman leaves their values out of exports, so enter them after you import. - The credential variables Relay creates when it imports an OpenAPI spec start out secret and empty.
See Also
- Using variables: Insert values into requests with
{{name}}tokens and see where each value comes from. - Storing a workspace in a folder: Keep a workspace as files in a folder you choose and share it with Git.
- Inheriting authentication: Set authentication once on a workspace, collection or folder and let requests inherit it.
- Using client and CA certificates: Present client certificates and trust your own certificate authorities.