> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polygon.technology/llms.txt
> Use this file to discover all available pages before exploring further.

# Kotlin SDK sign and verify

> Sign messages and EIP-712 typed data, then verify signatures for the active wallet.

Signing creates a signature without submitting a transaction. Signing and verification both require an active selected wallet context because the Kotlin API verifies against that wallet's OMS wallet ID.

## Sign and verify a message

The message API accepts only `String`. It does not provide a byte-array or hexadecimal-message overload.

```kotlin theme={null}
import technology.polygon.omswallet.Network

val message = "Approve login for Example App"
val signature = omsWallet.wallet.signMessage(
    network = Network.AMOY,
    message = message,
)

val valid = omsWallet.wallet.isValidMessageSignature(
    network = Network.AMOY,
    message = message,
    signature = signature,
)

println("Valid: $valid")
```

Verify with the exact original string and network. Verification returns `false` for a signature that OMS does not validate; request or session failures throw an `OMSWalletException`.

## Sign and verify EIP-712 typed data

Typed data uses `JsonElement`. Build the complete EIP-712 payload expected by the application and contract:

```kotlin theme={null}
import kotlinx.serialization.json.Json
import technology.polygon.omswallet.Network

val typedData = Json.parseToJsonElement(
    """
    {
      "domain": {
        "name": "Example App",
        "version": "1",
        "chainId": 80002
      },
      "types": {
        "EIP712Domain": [
          { "name": "name", "type": "string" },
          { "name": "version", "type": "string" },
          { "name": "chainId", "type": "uint256" }
        ],
        "Message": [
          { "name": "contents", "type": "string" }
        ]
      },
      "primaryType": "Message",
      "message": {
        "contents": "Approve login for Example App"
      }
    }
    """.trimIndent(),
)

val signature = omsWallet.wallet.signTypedData(
    network = Network.AMOY,
    typedData = typedData,
)

val valid = omsWallet.wallet.isValidTypedDataSignature(
    network = Network.AMOY,
    typedData = typedData,
    signature = signature,
)
```

Use the same typed-data value and network for verification. The verification methods use the selected wallet context but do not sign a request or create a transaction.
