Add Keychain-based LCP repositories, deprecate SQLite adapter#713
Merged
mickael-menu merged 6 commits intodevelopfrom Feb 5, 2026
Merged
Add Keychain-based LCP repositories, deprecate SQLite adapter#713mickael-menu merged 6 commits intodevelopfrom
mickael-menu merged 6 commits intodevelopfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces new Keychain-based implementations for LCP license and passphrase repositories, deprecating the existing SQLite adapter. The new repositories provide better security by leveraging the iOS/macOS Keychain, persist data across app reinstalls, and optionally synchronize across devices via iCloud Keychain.
Changes:
- Added
LCPKeychainLicenseRepositoryandLCPKeychainPassphraseRepositoryas built-in Keychain-based implementations - Added
Keychainutility class inReadiumInternalfor low-level Keychain operations - Deprecated
ReadiumAdapterLCPSQLitemodule with migration helpers to facilitate transition - Extended
LCPPassphraseRepositoryprotocol withpassphrases()method for fallback passphrase lookup
Reviewed changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
Sources/Internal/Keychain.swift |
New utility class for Keychain operations with proper error handling and Sendable compliance |
Sources/LCP/Repositories/Keychain/LCPKeychainLicenseRepository.swift |
Actor-based Keychain implementation for license storage with typed throws |
Sources/LCP/Repositories/Keychain/LCPKeychainPassphraseRepository.swift |
Actor-based Keychain implementation for passphrase storage with typed throws |
Sources/LCP/LCPPassphraseRepository.swift |
Extended protocol with passphrases() method for legacy compatibility |
Sources/LCP/Services/PassphrasesService.swift |
Updated to support fallback passphrase lookup for legacy SQLite compatibility |
Sources/Adapters/LCPSQLite/SQLiteLCPLicenseRepository.swift |
Added migration helper to transfer data to Keychain repository |
Sources/Adapters/LCPSQLite/SQLiteLCPPassphraseRepository.swift |
Added migration helper and passphrases() method implementation |
Tests/LCPTests/Repositories/Keychain/LCPKeychainLicenseRepositoryTests.swift |
Comprehensive test coverage for license repository |
Tests/LCPTests/Repositories/Keychain/LCPKeychainPassphraseRepositoryTests.swift |
Comprehensive test coverage for passphrase repository |
Tests/InternalTests/KeychainTests.swift |
Keychain tests (commented out due to entitlement requirements) |
TestApp/Sources/App/Readium.swift |
Updated to use new Keychain repositories |
TestApp/Sources/LCP/LCPModule.swift |
Removed SQLite adapter import |
TestApp/Integrations/*/project+lcp.yml |
Removed SQLite adapter dependencies from integration configurations |
Package.swift |
Added ReadiumInternal dependency to ReadiumLCP |
CHANGELOG.md |
Documented new features and deprecations |
docs/Migration Guide.md |
Added comprehensive migration instructions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog
Added
LCP
LCPKeychainLicenseRepositoryandLCPKeychainPassphraseRepository.Deprecated
LCP
ReadiumAdapterLCPSQLiteis now deprecated in favor of the built-in Keychain repositories. See the migration guide for instructions.Migration Guide
Migrating LCP Repositories from SQLite to the Keychain
The
ReadiumAdapterLCPSQLitemodule is now deprecated.ReadiumLCPprovides built-in Keychain-based repositories that are more secure, persist across app reinstalls, and optionally synchronize across devices via iCloud Keychain.Updating the
LCPServiceinitializationReplace the SQLite repositories with their Keychain equivalents:
Then remove
ReadiumAdapterLCPSQLitefrom your project dependencies:ReadiumAdapterLCPSQLiteproduct from your target dependencies.ReadiumAdapterLCPSQLite.xcframeworkandSQLite.xcframeworkfrom your project.pod 'ReadiumAdapterLCPSQLite'from yourPodfileand runpod install.Migrating existing data
If your app already stores LCP data in the SQLite database, you can migrate it to the Keychain using the built-in migration helpers. Run this migration once, for example during an app update: