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


Example


Example.swift
    let MESSAGE_HASH = "e2a159d17b7bb714aed7675d7c7d394dec8d2e4337842848104694bf89c71c03"

func performSignature(keyshare: Data, trioSession: TrioSession) async -> Data?
{
let result = await trioSession.signature(
keyshare: keyshare, message: MESSAGE_HASH,
chainPath: "m" // This is the default, use your desired path here. For e.g 'm/1/2'
)
// returns nil if operation fails or other flow you might have
switch result {
case .success(let dataBytes):
do {
// do something with bytes
Swift.print(dataBytes)
return dataBytes
}
case .failure(let error):
do {
// show error to user or abort process
Swift.print(error)
return nil
}
}
}
  • keyshare is the client's "share" of the MPC wallet.
  • messageHash is the hash of the message to be signed as ByteArray.
  • trioSession.signature() performs message exchange between mobile and server to generate a ECDSA/EdDSA signature.
  • Result of trioSession.signature() could be a Success with Data (ECDSA/EdDSA signature) of messageHash, corresponding to the public key (or address) of the wallet or Failure with error.