Keygen
Keygen creates a new distributed key pair — one share stays on the device, the other lives on the cloud server. Neither party holds the full private key. The public key (and the derived blockchain address) are available immediately after keygen returns.
For the SDK contract see Keygen (Kotlin) and Keygen (Swift).
How the example does it
- Android
- iOS / macOS
vault/.../session/VaultSessionManager.kt
suspend fun keygen(keyType: KeyType): KeyResult {
val keyshare = sessionFor(keyType).keygen().getOrThrow()
val keyId = extractKeyId(keyType, keyshare)
val publicKey = extractPublicKey(keyType, keyshare)
return KeyResult(keyId, publicKey)
}
Vault/Session/VaultSessionManager.swift
func keygen(type: KeyType) async throws -> KeygenResult {
let keyshare = try await sessionForKeyType(type).keygen().get()
let keyId = try await extractKeyId(type, keyshare: keyshare)
let publicKey = try await extractPublicKey(type, keyshare: keyshare)
return KeygenResult(keyId: keyId, publicKey: publicKey)
}
The example does not persist the keyshare manually after keygen — the SDK writes it via the registered storage client automatically. The KeyResult returned contains the keyId (hex-encoded keyshare identifier) and the publicKey (used by the app layer for address derivation).
The session is selected by KeyType: SilentShard.ECDSA.createDuoSession(...) for Ethereum, SilentShard.EdDSA.createDuoSession(...) for Solana.