preSignature

abstract suspend fun preSignature(keyshare: ByteArray): Result<ByteArray>

Generates a pre-signature for instant signing later with preSignatureFinal.

Pre-compute expensive MPC operations before knowing the message. Ideal for high-frequency trading where sub-100ms signing is critical.

Example: Instant Trading

// Generate pre-signature in advance
val preSig = session.preSignature(keyshare).getOrThrow()

// Later, when you have the trade details:
val tradeHash = hashTrade(symbol = "ETH/USD", amount = "1.5", price = "3500")

// Instant signature (<100ms)
val signature = session.preSignatureFinal(
preSignature = preSig,
message = tradeHash.toHexString(),
derivationPath = "m/44'/60'/0'/0/0"
).getOrThrow()

// Submit signed trade
exchange.submitOrder(trade.withSignature(signature))

Important: Each pre-signature is single-use only. Generate new ones after use.

Return

Result containing the pre-signature as ByteArray

Parameters

keyshare

The keyshare to use for pre-signature generation

See also

to finalize with message