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
- Create TrioSession if you haven't already.
Step 2 : Perform Sign
- Call trioSession.signature() which returns
ResultofSuccesswithSignaturebytes asDataor Failure witherror.
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
}
}
}
keyshareis the client's "share" of the MPC wallet.messageHashis the hash of the message to be signed asByteArray.- trioSession.signature() performs message exchange between mobile and server to generate a ECDSA/EdDSA signature.
- Result of trioSession.signature() could be a
SuccesswithData(ECDSA/EdDSA signature) ofmessageHash, corresponding to the public key (or address) of the wallet orFailurewitherror.