5.5 KiB
5.5 KiB
Provisioning Profile Setup for macOS Biometric Authentication
Prerequisites
- Apple Developer Account (paid membership required)
- macOS development machine
- Xcode installed (for code signing tools)
Step 1: Log into Apple Developer Portal
- Go to developer.apple.com
- Sign in with your Apple Developer account
- Navigate to "Certificates, Identifiers & Profiles"
Step 2: Create App ID
- Click "Identifiers" in the sidebar
- Click the "+" button to create a new identifier
- Select "App IDs" and click "Continue"
- Choose "App" (not App Clip) and click "Continue"
- Fill in the details:
- Description:
Secret Manager macOS App
- Bundle ID: Select "Explicit" and enter
berlin.sneak.pkg.secret
- Description:
- In the "Capabilities" section, enable:
- Keychain Sharing (this is essential for keychain access)
- Leave other capabilities unchecked unless specifically needed
- Click "Continue" and then "Register"
Step 3: Create/Verify Development Certificate
- Click "Certificates" in the sidebar
- Click the "+" button if you need a new certificate
- Under "Development", select "Mac Development"
- Follow the instructions to generate a Certificate Signing Request (CSR):
- Open Keychain Access on your Mac
- Go to Keychain Access → Certificate Assistant → Request a Certificate from a Certificate Authority
- Enter your email address and name
- Select "Saved to disk" and "Let me specify key pair information"
- Click "Continue" and save the CSR file
- Upload the CSR file and download the certificate
- Double-click the downloaded certificate to install it in Keychain Access
Step 4: Register Development Device
- Click "Devices" in the sidebar
- Click the "+" button to register a new device
- Select "macOS" as the platform
- Get your Mac's hardware UUID:
system_profiler SPHardwareDataType | grep "Hardware UUID"
- Enter:
- Device Name: Your Mac's name (e.g., "John's MacBook Pro")
- Device ID (UUID): The hardware UUID from step 4
- Click "Continue" and then "Register"
Step 5: Create Development Provisioning Profile
- Click "Profiles" in the sidebar
- Click the "+" button to create a new profile
- Under "Development", select "Mac App Development"
- Click "Continue"
- Select your App ID:
berlin.sneak.pkg.secret
- Click "Continue"
- Select your development certificate
- Click "Continue"
- Select your registered Mac device
- Click "Continue"
- Enter a profile name:
Secret Manager macOS Development
- Click "Generate"
- Download the provisioning profile
Step 6: Install Provisioning Profile
- Double-click the downloaded
.provisionprofile
file to install it - Or manually copy it to:
~/Library/MobileDevice/Provisioning Profiles/
Step 7: Code Signing Setup
Option A: Manual Code Signing
Add these flags when building your Go binary:
# Build the binary
go build -o secret cmd/secret/main.go
# Sign the binary
codesign --sign "Apple Development: YOUR_NAME (TEAM_ID)" \
--entitlements entitlements.plist \
--options runtime \
--force \
./secret
Option B: Using Makefile
Update your Makefile to include code signing:
DEVELOPER_ID = "Apple Development: YOUR_NAME (TEAM_ID)"
ENTITLEMENTS = entitlements.plist
secret:
go build -o secret cmd/secret/main.go
codesign --sign $(DEVELOPER_ID) \
--entitlements $(ENTITLEMENTS) \
--options runtime \
--force \
./secret
.PHONY: secret
Step 8: Verify Code Signing
Check that your binary is properly signed:
# Check code signature
codesign -dv --verbose=4 ./secret
# Check entitlements
codesign -d --entitlements :- ./secret
Step 9: Test Biometric Authentication
Run your app and verify that:
- Touch ID/Face ID prompts appear when accessing keychain
- No entitlement errors occur
- Keychain operations work correctly
Troubleshooting
Common Issues:
-
errSecMissingEntitlement (-34018)
- Ensure your provisioning profile includes keychain access
- Verify code signing is applied correctly
- Check that bundle ID matches exactly
-
No biometric prompt appears
- Verify access control flags in your Security Framework calls
- Ensure device has biometric authentication enabled
- Check system preferences for app permissions
-
Code signing failures
- Ensure certificate is installed in Keychain Access
- Verify team ID matches between certificate and provisioning profile
- Check that provisioning profile is installed
Debug Commands:
# List installed certificates
security find-identity -v -p codesigning
# List provisioning profiles
ls ~/Library/MobileDevice/Provisioning\ Profiles/
# Check provisioning profile contents
security cms -D -i ~/Library/MobileDevice/Provisioning\ Profiles/YOUR_PROFILE.provisionprofile
Production Distribution
For production distribution, you'll need to:
- Create a "Developer ID Application" certificate
- Create a "Developer ID" provisioning profile
- Notarize your app with Apple
- Staple the notarization ticket
This allows distribution outside the Mac App Store while maintaining system trust.
Important Notes
- Keychain access groups are automatically included for explicit App IDs
- Biometric authentication requires proper access controls in your Security Framework calls
- The
com.apple.security.cs.disable-library-validation
entitlement may be needed for Go binaries - Test thoroughly on a clean system to ensure all entitlements work correctly