kotlin-toolkit icon indicating copy to clipboard operation
kotlin-toolkit copied to clipboard

Proguard minification breaks LicenseValidation

Open olivierkorner opened this issue 3 years ago • 0 comments

With minification and Proguard enabled, LCP licenses validation doesn't work anymore.

fun findOneValidPassphrase(jsonLicense: String, hashedPassphrases: List<String>): String =
        try {
            klass
                .getMethod("findOneValidPassphrase", String::class.java, Array<String>::class.java)
                .invoke(instance, jsonLicense, hashedPassphrases.toTypedArray()) as String
        } catch (e: InvocationTargetException) {
            throw mapException(e.targetException)
        }

As the name of the function is changed by Proguard, findOneValidPassphrase (in LcpClient.kt:67) breaks and throws an exception.

It seems that adding the following exceptions in Proguard rules restores the functionality:

-keep class org.readium.lcp.sdk.* { *; }

olivierkorner avatar Feb 23 '21 10:02 olivierkorner