LcpLicense

Opened license, used to decipher a protected publication and manage its license.

Types

Link copied to clipboard
interface RenewListener

UX delegate for the loan renew LSD interaction.

Properties

Link copied to clipboard
abstract val canCopy: Boolean
Link copied to clipboard
abstract val canPrint: Boolean
Link copied to clipboard
abstract val canRenewLoan: Boolean

Can the user renew the loaned publication?

Link copied to clipboard

Can the user return the loaned publication?

Link copied to clipboard
abstract val charactersToCopyLeft: StateFlow<Int?>

Number of remaining characters allowed to be copied by the user. If null, there's no limit.

Link copied to clipboard
abstract val license: LicenseDocument

License Document information. https://readium.org/lcp-specs/releases/lcp/latest.html

Link copied to clipboard
abstract val maxRenewDate: Instant?

The maximum potential date to renew to. If null, then the renew date might not be customizable.

Link copied to clipboard
abstract val pagesToPrintLeft: StateFlow<Int?>

Number of pages allowed to be printed by the user. If null, there's no limit.

Link copied to clipboard
abstract val status: StatusDocument?

License Status Document information. https://readium.org/lcp-specs/releases/lsd/latest.html

Functions

Link copied to clipboard
abstract fun canCopy(text: String): Boolean
Link copied to clipboard
abstract fun canPrint(pageCount: Int): Boolean
Link copied to clipboard
abstract fun close()
Link copied to clipboard
abstract suspend fun copy(text: String): Boolean
Link copied to clipboard
abstract suspend fun decrypt(data: ByteArray): Try<ByteArray, LcpError>

Decrypts the given data encrypted with the license's content key.

Link copied to clipboard
abstract suspend fun print(pageCount: Int): Boolean
Link copied to clipboard
abstract suspend fun renewLoan(listener: LcpLicense.RenewListener, prefersWebPage: Boolean = false): Try<Instant?, LcpError>

Renews the loan by starting a renew LSD interaction.

Link copied to clipboard
abstract suspend fun returnPublication(): Try<Unit, LcpError>

Returns the publication to its provider.