Skip to main content

Pre-signature

Pre-signatures let you precompute the expensive multi-round MPC computation (between mobile and first server) before the transaction is ready. When the user submits a transaction, preSignatureFinal returns the signature instantly — no MPC round-trip at that point.

For the SDK contract see Pre-signature (Kotlin) and Pre-signature (Swift).

How the example does it

Step 1: Generate the pre-signature (expensive, do this in advance)

vault/.../session/VaultSessionManager.kt
suspend fun preSignature(keyId: String): ByteArray {
val dao = readDao(keyId)
val keyshare = dao.currentKeyshare
?: throw Exception("No active keyshare found for keyId: $keyId")
return sessionFor(dao.keyType).preSignature(keyshare).getOrThrow()
}

Step 2: Finalize when the transaction is ready (instant)

vault/.../session/VaultSessionManager.kt
suspend fun preSignatureFinal(
keyId: String,
preSignature: ByteArray,
message: ByteArray,
derivationPath: String,
): ByteArray {
val keyType = readDao(keyId).keyType
return sessionFor(keyType)
.preSignatureFinal(
preSignature = preSignature,
message = message.toHex(),
derivationPath = derivationPath,
).getOrThrow()
}

Single-use

Each pre-signature can only be finalized once. Consuming it via preSignatureFinal invalidates it — the example resets the UI state so the user generates a fresh one for the next transaction. The pre-signature is held in memory (not persisted to disk), so it's also lost if the app is killed before finalization.

The example wires this up under the Pre-Signature screen, available from the dashboard for ECDSA (Ethereum) tokens only.

Pre-signature screen