commonMain.io.eqoty.secretk.wallet.Pubkey.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of client-jvm Show documentation
Show all versions of client-jvm Show documentation
A Kotlin multiplatform REST client utilizing secret network's gRPC gateway endpoints.
package io.eqoty.secretk.wallet
import io.eqoty.secretk.types.response.PubKeySecp256k1
import io.eqoty.secretk.utils.toByteString
fun encodeSecp256k1Pubkey(pubkey: UByteArray): PubKeySecp256k1 {
if (pubkey.size != 33 || (pubkey[0] != 0x02u.toUByte() && pubkey[0] != 0x03.toUByte())) {
throw Error("Public key must be compressed secp256k1, i.e. 33 bytes starting with 0x02 or 0x03")
}
return PubKeySecp256k1(
value = pubkey.toByteString().base64()
)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy