jvmMain.com.algolia.client.extensions.internal.Encoding.jvm.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of algoliasearch-client-kotlin-jvm Show documentation
Show all versions of algoliasearch-client-kotlin-jvm Show documentation
"Algolia is a powerful search-as-a-service solution, made easy to use with API clients, UI libraries, and pre-built integrations. Algolia API Client for Kotlin lets you easily use the Algolia Search REST API from your JVM project, such as Android or backend implementations."
package com.algolia.client.extensions.internal
import javax.crypto.Mac
import javax.crypto.spec.SecretKeySpec
internal actual fun encodeKeySHA256(key: String, message: String): String {
val rawHmac = Mac.getInstance("HmacSHA256").run {
init(SecretKeySpec(key.toByteArray(), "HmacSHA256"))
doFinal(message.toByteArray())
}
return Hex.buildString(rawHmac)
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy