Skip to content

Conversation

@ovitrif
Copy link
Collaborator

@ovitrif ovitrif commented Feb 9, 2026

Context

The app's VSS client was using a truncated 32-byte seed for all key derivation, while ldk-node uses the full 64-byte BIP39 seed. This made it impossible to read ldk-node's VSS data from the app layer. Additionally, ldk-node uses a namespaced key format (obf("primary#secondary")#obf("key")) that the flat-key APIs couldn't address.

Changes

Dual key derivation

The client derives two independent key sets during initialization:

  • App keys (store/get/delete/list_keys/list): derived from the truncated 32-byte seed, preserving backward compatibility with existing app backups
  • LDK keys (via dedicated LdkVssClient): derived from the full 64-byte seed, matching ldk-node's internal key derivation

LNURL auth is derived from the app seed path (truncated 32-byte), maintaining the same server identity as v0.4.0.

Dedicated LDK client with LdkNamespace enum

Decoupled LDK operations into a standalone LdkVssClient (ldk_client.rs), completely separate from the app backup VssClient. Each has its own global singleton, initialization, and shutdown:

  • vss_new_ldk_client_with_lnurl_auth() / vss_shutdown_ldk_client()
  • vss_ldk_get(), vss_ldk_store(), vss_ldk_delete(), vss_ldk_list_keys(), vss_ldk_list_all_keys()

All accept a type-safe LdkNamespace enum (defined in Rust, generated for Kotlin/Swift by UniFFI):

pub enum LdkNamespace {
    Default,                                // ("", "")
    Monitors,                               // ("monitors", "")
    MonitorUpdates { monitor_id: String },   // ("monitor_updates", monitor_id)
    ArchivedMonitors,                        // ("archived_monitors", "")
}

This ensures the LDK client uses only ldk-node's key derivation chain (full 64-byte seed → m/877' → HKDF) with no coupling to the app client's truncated-seed derivation.

CI

Aligns the Gradle publish workflow with bitkit-core's pattern.

QA Notes

@ovitrif ovitrif marked this pull request as draft February 9, 2026 21:40
@ovitrif
Copy link
Collaborator Author

ovitrif commented Feb 9, 2026

Drafted to fix keyspace for ldk APIs

ovitrif and others added 2 commits February 9, 2026 23:05
The seed was truncated to 32 bytes before being passed to
Xpriv::new_master, while ldk-node uses the full 64-byte BIP39
seed. This caused all LDK-namespaced APIs to operate on a
different key space than ldk-node's actual VSS data.

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
@ovitrif ovitrif changed the title feat: add ldk-node namespaced key APIs fix: align key derivation with ldk-node Feb 10, 2026
ovitrif and others added 5 commits February 10, 2026 14:40
Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ovitrif and others added 6 commits February 10, 2026 23:02
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ovitrif ovitrif requested a review from pwltr February 11, 2026 08:04
@pwltr
Copy link

pwltr commented Feb 11, 2026

Thanks for doing the release as well, will test now on iOS end

@ovitrif

This comment was marked as outdated.

ovitrif

This comment was marked as outdated.

@ovitrif ovitrif marked this pull request as draft February 11, 2026 14:11
@ovitrif

This comment was marked as outdated.

ovitrif and others added 2 commits February 11, 2026 22:55
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ovitrif ovitrif marked this pull request as ready for review February 11, 2026 22:19
@ovitrif ovitrif changed the title fix: align key derivation with ldk-node feat: add client for ldk-node backup operations Feb 11, 2026
@ovitrif ovitrif changed the title feat: add client for ldk-node backup operations feat: add client for handling ldk-node backups Feb 11, 2026
@ovitrif ovitrif requested review from jvsena42 and pwltr February 11, 2026 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants