Secrets
is a simple key-value storage utility to retrieve secrets in a secure way:
- Store third-party service tokens and API keys
- Retrieve them in runtime
Import the Secrets
module and use the get
function declared in the Keys
class. For example:
import Secrets
let value = Secrets.shared.get(.posthog)
The target must have a Secrets.plist
file in the bundle resources. It can be empty, or can contain any of the keys listed in the Key
enum. For example:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>posthog</key>
<string>The posthog key here</string>
<key>bugsnag</key>
<string>The busnag key here</string>
</dict>
</plist>