SeedDeriver

Derives wallet seed material from the user's passkey via the WebAuthn PRF extension.

Two outputs sit at different levels of the chain:

  • derivePrfEntropy — raw 32-byte PRF output. Suitable as BIP-39 entropy, an HKDF source, a symmetric key, etc.

  • deriveBip39Seed — full chain: PRF → 32-byte entropy → 24-word mnemonic → 64-byte BIP-39 PBKDF2 seed. This is what MidnightSdk.Builder.seed(...) consumes.

The PRF output is identical on every device + every Kuira ecosystem app that shares the RP via assetlinks.json, so the derived seed is identical too — no shared backup blob needed.

SEED_SALT is domain-separated from AppStateBackup.BACKUP_SALT; PRF with two different salts produces two independent secrets from the same passkey credential.

Known limitation: the entropy → seed chain temporarily materializes the 24-word mnemonic as a String. JVM strings are immutable and may be copied/interned by the allocator before GC can reclaim them — same trap as the existing WalletPanelViewModel.ensureSeedReady random-seed path. A direct entropyToSeed path would close this gap; deferred until both consumers can migrate in one pass.

Properties

Link copied to clipboard

Purpose-bound salt: SHA-256("kuira:seed:v1"). Deterministic, public.

Link copied to clipboard

Purpose-bound salt: SHA-256("kuira:sigil:v1"). Deterministic, public. PRF output under this salt seeds the user's sigil identity Ed25519 keypair (see Ed25519PrfSigilProvider).

Functions

Link copied to clipboard
suspend fun deriveBip39Seed(activity: Activity, passkeyManager: PasskeyManager): ByteArray

One-shot: passkey PRF → BIP-39 entropy → mnemonic → BIP-39 seed.

Link copied to clipboard
suspend fun derivePrfEntropy(activity: Activity, passkeyManager: PasskeyManager): ByteArray

Authenticate the user's passkey with the seed-derivation salt and return the raw 32-byte PRF output. The output is BIP-39 entropy size — callers can pass it directly to BIP39.entropyToMnemonic.

Link copied to clipboard
suspend fun derivePrfMaterial(activity: Activity, passkeyManager: PasskeyManager): PrfSeedMaterial

One-shot derive that returns BOTH the 32-byte BIP-39 entropy and the 64-byte BIP-39 seed from a single PRF authentication.

Link copied to clipboard

Deterministic chain from BIP-39 entropy to BIP-39 seed.