mirror of https://github.com/tasks/tasks
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
662 B
Kotlin
22 lines
662 B
Kotlin
package org.tasks.billing
|
|
|
|
import android.content.Context
|
|
import dagger.hilt.android.qualifiers.ApplicationContext
|
|
import org.tasks.R
|
|
import timber.log.Timber
|
|
import java.io.IOException
|
|
import javax.inject.Inject
|
|
|
|
internal class SignatureVerifier @Inject constructor(@ApplicationContext context: Context) {
|
|
private val billingKey: String = context.getString(R.string.gp_key)
|
|
|
|
fun verifySignature(purchase: Purchase): Boolean {
|
|
return try {
|
|
Security.verifyPurchase(
|
|
billingKey, purchase.originalJson, purchase.signature)
|
|
} catch (e: IOException) {
|
|
Timber.e(e)
|
|
false
|
|
}
|
|
}
|
|
} |