Skip to main content

Sign

This distributed signing process allows for secure transaction authorization while preserving the key's distributed nature, exemplifying the MPC wallet's enhanced security model.

Step 1 : Create Session


Step 2 : Perform Sign


  • Call trioSession.sign() which returns Result of Success with Signature ByteArray or Failure with exception.

Example


Example.kt
val messageHash = "e2a159d17b7bb714aed7675d7c7d394dec8d2e4337842848104694bf89c71c03"

// Sign the message hash with the key addressed by keyId (returned from keygen/import).
suspend fun performSignature(keyId: String, trioSession: TrioSession): ByteArray {
return withContext(Dispatchers.IO) {
trioSession.sign(
keyId = keyId,
message = messageHash,
derivationPath = "m" // This is the default; use your desired path, e.g. "m/1/2"
).getOrThrow()
}
}
  • keyId is the identifier returned by keygen that addresses the client's keyshare in your storage.
  • messageHash is the hash of the message to be signed as ByteArray.
  • trioSession.sign() performs message exchange between mobile and server to generate a ECDSA/EdDSA signature.
  • Result of trioSession.sign() could be a Success with ByteArray (ECDSA/EdDSA signature) of messageHash, corresponding to the public key (or address) of the wallet or Failure with Exception.