All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.io.eqoty.secretk.wallet.Signature.kt Maven / Gradle / Ivy

Go to download

A Kotlin multiplatform REST client utilizing secret network's gRPC gateway endpoints.

There is a newer version: 6.4.1-rc
Show newest version
package io.eqoty.secretk.wallet

import io.eqoty.secretk.types.StdSignature
import io.eqoty.secretk.utils.toByteString


fun encodeSecp256k1Signature(pubkey: UByteArray, signature: UByteArray): StdSignature {
    if (signature.size != 64) {
        throw Error(
            "Signature must be 64 bytes long. Cosmos SDK uses a 2x32 byte fixed length encoding for the secp256k1 signature integers r and s.",
        )
    }

    return StdSignature(
        // eslint-disable-next-line @typescript-eslint/camelcase
        pubKey = encodeSecp256k1Pubkey(pubkey),
        signature = signature.toByteString().base64()
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy