Skip to content

Cannot retrieve an expired license from Asset #772

Description

@fgrzeskowiak

Describe the bug

Calling lcpService.retrieveLicense for an asset with expired license returns Try.failure(LcpError.LicenseStatus.Expired).
This results in not being able to renew such a license to continue consuming the publication.

In swift-toolkit 3.7.0 the same function always obtains the license successfully, even if it has expired.
Thanks to it, the license can be renewed.

How to reproduce?

Call lcpService.retrieveLicense with an asset having an expired license. (rights.end < now).
It can be an lcpl file, or an lcpa that had a license injected before it expired.

Readium version

3.1.2

Android API version

API 36

Additional context

After some digging, I guess the issue is in line 349 of LicensesService file:

Image

documents.getContext() throws an exception if anything during license validation failed. Because of that, the License object is not created.

swift-toolkit 3.7.0 doesn't have such check before creating the License object in its LicensesService, that's why it returns the current license from retrieveLicense function, even if it's expired.

Image

Probably for the same reason, calling publication.lcpLicense after trying to open the publication with expired license with PublicationOpener returns null on Android, while on iOS it returns its current (expired) license.

Android:
Image

iOS:

Image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions