:warning: ᴛʜɪs ʀᴇᴘᴏsɪᴛᴏʀʏ ɪs ᴅᴇᴘʀᴇᴄᴀᴛᴇᴅ :warning:
We moved all the
r2-*-swift
modules to a single repository:swift-toolkit
.
Swift wrapper module for LCP support
Changes and releases are documented in the Changelog
Note: requires Swift 4.2 (and Xcode 10.1).
Carthage is a simple, decentralized dependency manager for Cocoa. To install ReadiumLCP
with Carthage:
Make sure Carthage is installed and up-to-date.
Update your app's Cartfile
to include the following:
github "readium/r2-lcp-swift" "develop"
Run:
mkdir -p Carthage/Build/iOS
carthage update --use-xcframeworks
After adding the r2-lcp-swift
module to your project and the private R2LCPClient.framework
provided by EDRLab, you can use LCP in your app by creating an instance of LCPService
.
LCPService
expects an implementation of LCPClient
, which acts as a facade to R2LCPClient.framework
. Copy and paste the following:
import R2LCPClient
import ReadiumLCP
let lcpService = LCPService(client: LCPClient())
/// Facade to the private R2LCPClient.framework.
class LCPClient: ReadiumLCP.LCPClient {
func createContext(jsonLicense: String, hashedPassphrase: String, pemCrl: String) throws -> LCPClientContext {
return try R2LCPClient.createContext(jsonLicense: jsonLicense, hashedPassphrase: hashedPassphrase, pemCrl: pemCrl)
}
func decrypt(data: Data, using context: LCPClientContext) -> Data? {
return R2LCPClient.decrypt(data: data, using: context as! DRMContext)
}
func findOneValidPassphrase(jsonLicense: String, hashedPassphrases: [String]) -> String? {
return R2LCPClient.findOneValidPassphrase(jsonLicense: jsonLicense, hashedPassphrases: hashedPassphrases)
}
}
link |
Stars: 5 |
Last commit: 2 years ago |
Take a look at the migration guide
Nothing new for r2-lcp-swift
in Readium Swift 2.2.0.
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics