Import
Import takes a previously exported blob and runs an internal keygen that derives a fresh shares for all parties from the encrypted material. The output is a wallet with the same keyId, public key, and blockchain address as the original — but the on-disk share bytes are new.
For the SDK contract see Import Key (Kotlin) and Import Key (Swift).
How the example does it
- Android
- iOS / macOS
vault/.../session/VaultSessionManager.kt
suspend fun importKeyshare(privateKey: ByteArray, keyType: KeyType): KeyResult {
val keyshare = sessionFor(keyType).import(
keysharePrivateKey = privateKey
).getOrThrow()
val keyId = extractKeyId(keyType, keyshare)
val publicKey = extractPublicKey(keyType, keyshare)
return KeyResult(keyId, publicKey)
}
Vault/Session/VaultSessionManager.swift
func importKeyshare(privateKey: Data, type: KeyType) async throws -> KeygenResult {
let keyshare = try await sessionForKeyType(type).import(
privateKey: privateKey
).get()
let keyId = try await extractKeyId(type, keyshare: keyshare)
let publicKey = try await extractPublicKeyFromKeyshare(type, keyshare: keyshare)
return KeygenResult(keyId: keyId, publicKey: publicKey)
}
Note: trio's import takes only privateKey (no rootChainCode parameter, unlike duo). The SDK auto-persists the new keyshare via the registered storage client.