package com.apeaksoft.toolkit.license
// 6️⃣ Build the LicenseInfo object val expires = json.getString("expires") val features = json.getJSONArray("features") val featureSet = mutableSetOf<String>() for (i in 0 until features.length()) featureSet.add(features.getString(i))
/** Helper: verify server‑side HMAC signature */ private fun verifySignature(data: String, signature: String): Boolean val secret = "s3cr3t_server_key".toByteArray(Charsets.UTF_8) // not really hard‑coded in production val mac = javax.crypto.Mac.getInstance("HmacSHA256") mac.init(javax.crypto.spec.SecretKeySpec(secret, "HmacSHA256")) val expected = Base64.getEncoder().encodeToString(mac.doFinal(data.toByteArray())) return expected == signature apeaksoft android toolkit registration code
/** * Validate the key. Returns a [LicenseInfo] on success, * throws a [LicenseException] otherwise. */ @Throws(LicenseException::class) fun verify(key: String, machineId: String = ""): LicenseInfo // 1️⃣ Basic sanity checks require(key.matches(Regex("^[A-Z0-9]32$"))) "License key must be a 32‑character alphanumeric string."
private const val LICENSE_ENDPOINT = "https://license.apeaksoft.com/validate" private val httpClient = OkHttpClient() package com
// Kotlin DSL tasks.register<JavaExec>("validateApeaksoftLicense") group = "verification" description = "Validates the APEAKSOFT Toolkit license."
./gradlew validateApeaksoftLicense If everything is correct, you’ll see: Example content: private lateinit var api: ApiClient
# APEAKSOFT Toolkit License license.key=AB12CD34EF56GH78IJ90KL12MN34OP56 # Optional – bind to this machine ID (generated by the tool) machine.id=5f4dcc3b5aa765d61d8327deb882cf99 Add it to .gitignore :
class MainActivity : AppCompatActivity() {
Create a file apeaksoft_license.properties at the project root (same folder as settings.gradle ). Example content:
private lateinit var api: ApiClient