Fix retrieving an expired LCP license to allow renewing it - #816
Draft
mickael-menu wants to merge 1 commit into
Draft
mickael-menu wants to merge 1 commit into
mickael-menu wants to merge 1 commit into
Conversation
LcpService.retrieveLicense() eagerly resolved the DRM context, which throws for licenses whose status is no longer valid (expired, returned, revoked), so no License was ever returned and renewal was impossible - while the Swift toolkit allows it. The eager getContext() check is removed so the License is returned after successful validation; the status error now surfaces lazily when decrypting content, matching iOS. As a result, opening a publication with an expired license no longer reports it as restricted: apps that relied on protectionError to detect expiry should check lcpLicense.status or handle LcpError.LicenseStatus decryption errors instead. Fixes #772 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This branch has not been deployed
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.
LcpService.retrieveLicense()eagerly resolved the DRM context, which throws for licenses whose status is no longer valid (expired, returned, revoked), so noLicensewas ever returned and renewal was impossible on Android — while the Swift toolkit allows it (itsLicensesServiceresolves the context lazily, only at decryption time).The eager
getContext()check is removed so theLicenseis returned after successful validation. Decrypting content with such a license still fails with the correspondingLcpError.LicenseStatuserror, surfaced lazily byLicense.decrypt(). Also removes a no-optry/catcharound the removed call.Behavior change: opening a publication with an expired license no longer reports it as restricted (
isRestrictedisfalse,publication.protectionErrorisnull). Apps that relied onprotectionErrorto detect expiry should checklcpLicense.statusor handleLcpError.LicenseStatusdecryption errors instead. This matches iOS and is called out in the CHANGELOG.Fixes #772
🤖 Generated with Claude Code