|
| 1 | +--- |
| 2 | +skill: sqlcipher-update |
| 3 | +description: Update SQLCipher dependency in Salesforce Mobile SDK for iOS SPM distribution |
| 4 | +globs: |
| 5 | + - "Package.swift" |
| 6 | +tags: |
| 7 | + - dependency-update |
| 8 | + - sqlcipher |
| 9 | + - encryption |
| 10 | + - smartstore |
| 11 | + - spm |
| 12 | +--- |
| 13 | + |
| 14 | +# Update SQLCipher Skill (iOS-SPM) |
| 15 | + |
| 16 | +This skill automates the process of updating the SQLCipher library version in the SalesforceMobileSDK-iOS-SPM Swift Package Manager distribution repository. |
| 17 | + |
| 18 | +## When to Use |
| 19 | +Use this skill when you need to: |
| 20 | +- Update SQLCipher to a newer version for security patches or new features |
| 21 | +- Align the SPM distribution with SQLCipher updates in the main iOS repo |
| 22 | +- Ensure SPM consumers get the latest SQLCipher version |
| 23 | + |
| 24 | +## Background |
| 25 | +SQLCipher is an open-source extension to SQLite that provides transparent 256-bit AES encryption of database files. The SDK uses it in the SmartStore library for secure local data storage. |
| 26 | + |
| 27 | +The iOS-SPM repository is a **binary distribution repository** that uses Swift Package Manager. It references SQLCipher as an external package dependency. |
| 28 | + |
| 29 | +## Parameters |
| 30 | +- `NEW_VERSION`: The new SQLCipher version (e.g., "4.15.0", "4.16.0") |
| 31 | +- `OLD_VERSION`: The current SQLCipher version (check Package.swift) |
| 32 | + |
| 33 | +## Prerequisite |
| 34 | +- SQLCipher version is available at https://github.com/sqlcipher/SQLCipher.swift.git |
| 35 | +- The main iOS repo (SalesforceMobileSDK-iOS) has been updated to the same version |
| 36 | +- The iOS-Specs CocoaPods repo has been updated with the new SQLCipher podspec |
| 37 | + |
| 38 | +## Process |
| 39 | + |
| 40 | +### 1. Research the New Version |
| 41 | + |
| 42 | +Before starting, check the SQLCipher release notes: |
| 43 | +- Visit: https://github.com/sqlcipher/sqlcipher/releases |
| 44 | +- Review changes, breaking changes, and new features |
| 45 | +- Check for API changes that might affect the SDK |
| 46 | + |
| 47 | +**Key things to look for:** |
| 48 | +- Provider version changes (OpenSSL/LibTomCrypt versions) |
| 49 | +- Security fixes or enhancements |
| 50 | +- Changes to encryption algorithms or key derivation |
| 51 | + |
| 52 | +### 2. Update Package.swift |
| 53 | + |
| 54 | +Update the SQLCipher dependency version in Package.swift: |
| 55 | + |
| 56 | +**Before:** |
| 57 | +```swift |
| 58 | +dependencies: [ |
| 59 | + .package(url: "https://github.com/sqlcipher/SQLCipher.swift.git", exact: "OLD_VERSION"), |
| 60 | + .package(url: "https://github.com/forcedotcom/fmdb.git", exact: "2.7.12-sqlcipher") |
| 61 | +], |
| 62 | +``` |
| 63 | + |
| 64 | +**After:** |
| 65 | +```swift |
| 66 | +dependencies: [ |
| 67 | + .package(url: "https://github.com/sqlcipher/SQLCipher.swift.git", exact: "NEW_VERSION"), |
| 68 | + .package(url: "https://github.com/forcedotcom/fmdb.git", exact: "2.7.12-sqlcipher") |
| 69 | +], |
| 70 | +``` |
| 71 | + |
| 72 | +**Note:** The SDK uses exact version constraints for stability. Only update the SQLCipher version, not FMDB unless explicitly required. |
| 73 | + |
| 74 | +### 3. Verify Package Resolution |
| 75 | + |
| 76 | +Test that SPM can resolve the updated package: |
| 77 | + |
| 78 | +```bash |
| 79 | +swift package resolve |
| 80 | +``` |
| 81 | + |
| 82 | +This validates that: |
| 83 | +- The new SQLCipher version exists and is accessible |
| 84 | +- All dependencies can be resolved together |
| 85 | +- No version conflicts exist |
| 86 | + |
| 87 | +### 4. Test Locally |
| 88 | + |
| 89 | +Create a test Xcode project to verify the package works: |
| 90 | + |
| 91 | +```bash |
| 92 | +# Method 1: Add as local package in Xcode |
| 93 | +# File → Add Package Dependencies → Add Local... |
| 94 | +# Select the iOS-SPM directory |
| 95 | + |
| 96 | +# Method 2: Create a test Package.swift |
| 97 | +mkdir -p /tmp/test-spm |
| 98 | +cd /tmp/test-spm |
| 99 | +cat > Package.swift <<'EOF' |
| 100 | +// swift-tools-version: 6.0 |
| 101 | +import PackageDescription |
| 102 | +
|
| 103 | +let package = Package( |
| 104 | + name: "TestSPM", |
| 105 | + platforms: [.iOS(.v18)], |
| 106 | + dependencies: [ |
| 107 | + .package(path: "/path/to/SalesforceMobileSDK-iOS-SPM") |
| 108 | + ], |
| 109 | + targets: [ |
| 110 | + .target( |
| 111 | + name: "TestSPM", |
| 112 | + dependencies: [ |
| 113 | + .product(name: "SmartStore", package: "SalesforceMobileSDK-iOS-SPM") |
| 114 | + ] |
| 115 | + ) |
| 116 | + ] |
| 117 | +) |
| 118 | +EOF |
| 119 | +swift package resolve |
| 120 | +``` |
| 121 | + |
| 122 | +### 5. Create Branch and Commit |
| 123 | + |
| 124 | +```bash |
| 125 | +# Create feature branch |
| 126 | +git checkout -b sqlcipher-4.x.x |
| 127 | + |
| 128 | +# Stage changes |
| 129 | +git add Package.swift .claude/skills/update-sqlcipher/skill.md |
| 130 | + |
| 131 | +# Commit with descriptive message |
| 132 | +git commit -m "Update SQLCipher to 4.x.x" |
| 133 | + |
| 134 | +# Push to origin (your fork) |
| 135 | +git push -u origin sqlcipher-4.x.x |
| 136 | +``` |
| 137 | + |
| 138 | +### 6. Create Pull Request |
| 139 | + |
| 140 | +When creating the PR: |
| 141 | +- **Title:** "Update SQLCipher to {NEW_VERSION}" |
| 142 | +- **Description:** Include: |
| 143 | + - SQLCipher version being updated to |
| 144 | + - Link to SQLCipher release notes |
| 145 | + - Reference to corresponding iOS repo PR (if applicable) |
| 146 | + - Note that this is for SPM distribution |
| 147 | + - Any breaking changes or migration notes |
| 148 | + |
| 149 | +**Example PR Description:** |
| 150 | +```markdown |
| 151 | +## Summary |
| 152 | +Updates SQLCipher dependency from 4.15.0 to 4.16.0 in the SPM distribution. |
| 153 | + |
| 154 | +## Details |
| 155 | +- Updated Package.swift to reference SQLCipher 4.16.0 |
| 156 | +- Verified package resolution with `swift package resolve` |
| 157 | +- Tested local package integration |
| 158 | + |
| 159 | +## References |
| 160 | +- SQLCipher Release: https://github.com/sqlcipher/sqlcipher/releases/tag/v4.16.0 |
| 161 | +- iOS Repo PR: https://github.com/forcedotcom/SalesforceMobileSDK-iOS/pull/XXXX |
| 162 | +- iOS-Specs PR: https://github.com/forcedotcom/SalesforceMobileSDK-iOS-Specs/pull/XXXX |
| 163 | +- iOS-Hybrid PR: https://github.com/forcedotcom/SalesforceMobileSDK-iOS-Hybrid/pull/XXXX |
| 164 | +- Android PR: https://github.com/forcedotcom/SalesforceMobileSDK-Android/pull/XXXX |
| 165 | + |
| 166 | +## Testing |
| 167 | +- [x] `swift package resolve` succeeds |
| 168 | +- [x] Local package integration tested in Xcode |
| 169 | +``` |
| 170 | + |
| 171 | +## File Checklist |
| 172 | + |
| 173 | +- [ ] `Package.swift` - Update SQLCipher dependency version |
| 174 | +- [ ] `.claude/skills/update-sqlcipher/skill.md` - Create/update this skill (if first time) |
| 175 | +- [ ] Verify `swift package resolve` succeeds |
| 176 | +- [ ] Test local package integration |
| 177 | + |
| 178 | +## Key Files Reference |
| 179 | + |
| 180 | +**Configuration:** |
| 181 | +- `Package.swift` - Swift Package Manager manifest with dependencies |
| 182 | + |
| 183 | +**Build Archives:** |
| 184 | +- `archives/` - Pre-built XCFrameworks (not affected by SQLCipher version) |
| 185 | + |
| 186 | +**Note:** The actual SQLCipher library is pulled by SPM at build time. The XCFrameworks in archives/ are pre-built SDK libraries that depend on SQLCipher but don't include it. |
| 187 | + |
| 188 | +## Important Notes |
| 189 | + |
| 190 | +- This repo is a **distribution repository**. It does not contain SDK source code. |
| 191 | +- The XCFrameworks in `archives/` are built from the main iOS repo and include compiled code that uses SQLCipher, but SQLCipher itself is resolved by SPM. |
| 192 | +- Always coordinate SQLCipher updates across all SDK repositories: |
| 193 | + 1. SalesforceMobileSDK-iOS (main source) |
| 194 | + 2. SalesforceMobileSDK-iOS-Specs (CocoaPods) |
| 195 | + 3. SalesforceMobileSDK-iOS-SPM (Swift Package Manager) ← This repo |
| 196 | + 4. SalesforceMobileSDK-iOS-Hybrid (if applicable) |
| 197 | + 5. SalesforceMobileSDK-Android (for consistency) |
| 198 | +- Do not update XCFrameworks as part of a SQLCipher update — those are rebuilt during SDK releases using `build_xcframeworks.sh` |
| 199 | + |
| 200 | +## Resources |
| 201 | + |
| 202 | +- SQLCipher: https://www.zetetic.net/sqlcipher/ |
| 203 | +- SQLCipher iOS: https://github.com/sqlcipher/sqlcipher |
| 204 | +- SQLCipher Swift Package: https://github.com/sqlcipher/SQLCipher.swift |
| 205 | +- SQLCipher Releases: https://github.com/sqlcipher/sqlcipher/releases |
| 206 | +- Swift Package Manager: https://swift.org/package-manager/ |
| 207 | +- SmartStore docs: https://forcedotcom.github.io/SalesforceMobileSDK-iOS/Documentation/SmartStore/html/index.html |
0 commit comments