Sign Message

Once your app is connected to Blocto wallet, it can sign message on behalf of the user, with the user's permission.

To sign a message, the app must specify the sign type. All available types are listed below.

Sign Type
Type
Message

ETH Sign

EvmSignType.ETH_SIGN

hex string (0x prefix)

Personal Sign

EvmSignType.PERSONAL_SIGN

plain string

Sign Typed Data v3

EvmSignType.TYPED_DATA_V3

json string

Sign Typed Data v4

EvmSignType.TYPED_DATA_V4

json string

Sign Typed Data

(currently identical to Sign Typed Data v4)

EvmSignType.TYPED_DATA

json string

// Sign message based on specific chain

BloctoSDK.evm.signMessage(
    context = context,
    blockchain = Blockchain.ETHEREUM,
    fromAddress = address,
    signType = [EvmSignType.ETH_SIGN/EvmSignType.PERSONAL_SIGN/...],
    message = message,
    onSuccess = { signature ->
        // get signature
    },
    onError = { error ->
        // handle error
    }
)

For dApps relying on signMessage for off-chain authentication, Blocto follows EIP-1654. To verify the signature, you need to call a method on the wallet contract to check if the signature came from a rightful owner of the wallet contract.

Last updated

Was this helpful?