Skip to main content

Export Key


Users can at any time request to "export" their keys into a private key.

Step 1 : Create Session


Step 2 : Perform Export


  • Call trioSession.export() with the keyId which returns Result of Success with the exported private key as ByteArray or Failure with exception.

Example


Example.kt
// export reconstructs the raw private key of the key addressed by keyId.
// Treat the result like any private key — encrypt it at rest; bring it back
// under MPC later with import.
suspend fun exportPrivateKey(keyId: String, trioSession: TrioSession): ByteArray {
return withContext(Dispatchers.IO) {
trioSession.export(
keyId = keyId
).getOrThrow()
}
}

  • keyId: Identifies the key to export; it is returned by keygen and addresses the client's keyshare in your storage.