Skip to content

Commit 6fb9afa

Browse files
committed
fix: ldk key prefix and update bindings
1 parent 5181abf commit 6fb9afa

24 files changed

Lines changed: 226 additions & 144 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "vss-rust-client-ffi"
3-
version = "0.5.5"
3+
version = "0.5.6"
44
edition = "2021"
55
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
66

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
import PackageDescription
55

6-
let tag = "v0.4.0"
7-
let checksum = "dd7a726b13bed7bca8f8fe30488f20fab0467a77ee8b2b5bdbe06487aa605d50"
6+
let tag = "v0.5.6"
7+
let checksum = "11df637177c2f7f3b222ece10dee1d9a6c3c23905d12884d6085de967f498fc5"
88
let url = "https://github.com/synonymdev/vss-rust-client-ffi/releases/download/\(tag)/VssRustClientFfi.xcframework.zip"
99

1010
let package = Package(

README.md

Lines changed: 38 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -84,18 +84,21 @@ For interacting with data stored by ldk-node (e.g., `network_graph`, `channel_ma
8484

8585
```swift
8686
// Delete an ldk-node key (e.g., stale network graph)
87-
let wasDeleted = try await vssDeleteLdk(key: "network_graph")
87+
let wasDeleted = try await vssDeleteLdk(key: "network_graph", namespace: .default)
8888

8989
// Read an ldk-node key
90-
if let item = try await vssGetLdk(key: "network_graph") {
90+
if let item = try await vssGetLdk(key: "network_graph", namespace: .default) {
9191
print("Graph size: \(item.value.count) bytes")
9292
}
9393

94-
// List all ldk-node keys
95-
let ldkKeys = try await vssListKeysLdk()
96-
for kv in ldkKeys {
94+
// List all ldk-node keys across all namespaces
95+
let allLdkKeys = try await vssListAllKeysLdk()
96+
for kv in allLdkKeys {
9797
print("LDK key: \(kv.key), Version: \(kv.version)")
9898
}
99+
100+
// List ldk-node keys in a specific namespace
101+
let defaultKeys = try await vssListKeysLdk(namespace: .default)
99102
```
100103

101104
### Python
@@ -153,14 +156,14 @@ vss_shutdown_client()
153156

154157
```python
155158
# Delete an ldk-node key
156-
was_deleted = await vss_delete_ldk("network_graph")
159+
was_deleted = await vss_delete_ldk("network_graph", LdkNamespace.DEFAULT)
157160

158161
# Read an ldk-node key
159-
item = await vss_get_ldk("network_graph")
162+
item = await vss_get_ldk("network_graph", LdkNamespace.DEFAULT)
160163

161-
# List all ldk-node keys
162-
ldk_keys = await vss_list_keys_ldk()
163-
for kv in ldk_keys:
164+
# List all ldk-node keys across all namespaces
165+
all_ldk_keys = await vss_list_all_keys_ldk()
166+
for kv in all_ldk_keys:
164167
print(f"LDK key: {kv.key}, Version: {kv.version}")
165168
```
166169

@@ -212,15 +215,18 @@ vssShutdownClient()
212215

213216
```kotlin
214217
// Delete an ldk-node key (e.g., stale network graph)
215-
val wasDeleted = vssDeleteLdk(key = "network_graph")
218+
val wasDeleted = vssDeleteLdk(key = "network_graph", namespace = LdkNamespace.Default)
216219

217220
// Read an ldk-node key
218-
val graph = vssGetLdk(key = "network_graph")
221+
val graph = vssGetLdk(key = "network_graph", namespace = LdkNamespace.Default)
219222
graph?.let { println("Graph size: ${it.value.size} bytes") }
220223

221-
// List all ldk-node keys
222-
val ldkKeys = vssListKeysLdk()
223-
ldkKeys.forEach { println("LDK key: ${it.key}, Version: ${it.version}") }
224+
// List all ldk-node keys across all namespaces
225+
val allLdkKeys = vssListAllKeysLdk()
226+
allLdkKeys.forEach { println("LDK key: ${it.key}, Version: ${it.version}") }
227+
228+
// List ldk-node keys in a specific namespace
229+
val defaultKeys = vssListKeysLdk(namespace = LdkNamespace.Default)
224230
```
225231

226232
## API Reference
@@ -280,20 +286,23 @@ These methods derive the same encryption and obfuscation keys as ldk-node. Use t
280286

281287
The standard `vssStore`/`vssGet`/`vssDelete` methods use different key derivation and **cannot** read or delete keys written by ldk-node.
282288

283-
#### `vssStoreLdk(key: String, value: Data) -> VssItem`
284-
Store a key-value pair using ldk-node's key derivation.
289+
#### `vssStoreLdk(key: String, value: Data, namespace: LdkNamespace) -> VssItem`
290+
Store a key-value pair using ldk-node's key derivation in the given namespace.
285291

286-
#### `vssGetLdk(key: String) -> VssItem?`
292+
#### `vssGetLdk(key: String, namespace: LdkNamespace) -> VssItem?`
287293
Retrieve an item by key using ldk-node's key derivation. Returns `null` if not found.
288294

289-
#### `vssDeleteLdk(key: String) -> Bool`
295+
#### `vssDeleteLdk(key: String, namespace: LdkNamespace) -> Bool`
290296
Delete an item using ldk-node's key derivation. Returns `true` if item existed and was deleted.
291297

292-
#### `vssListKeysLdk() -> [KeyVersion]`
293-
List all keys stored by ldk-node with their versions.
298+
#### `vssListKeysLdk(namespace: LdkNamespace) -> [KeyVersion]`
299+
List keys stored by ldk-node in the given namespace.
294300

295-
#### `vssListLdk() -> [VssItem]`
296-
List all items stored by ldk-node with their full data.
301+
#### `vssListAllKeysLdk() -> [KeyVersion]`
302+
List all keys across all singleton LDK namespaces (Default, Monitors, ArchivedMonitors).
303+
304+
#### `vssListLdk(namespace: LdkNamespace) -> [VssItem]`
305+
List all items stored by ldk-node in the given namespace with their full data.
297306

298307
### Data Types
299308

@@ -310,6 +319,12 @@ List all items stored by ldk-node with their full data.
310319
- `key: String` - The item key
311320
- `version: Int64` - Version number
312321

322+
#### `LdkNamespace`
323+
- `Default` - Default namespace (channel_manager, scorer, etc.)
324+
- `Monitors` - Channel monitors
325+
- `MonitorUpdates(monitorId)` - Updates for a specific monitor
326+
- `ArchivedMonitors` - Archived channel monitors
327+
313328
#### `VssError`
314329
Error enum with detailed error information for different failure scenarios.
315330

TESTING.md

Lines changed: 0 additions & 111 deletions
This file was deleted.

bindings/android/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ android.useAndroidX=true
33
android.nonTransitiveRClass=true
44
kotlin.code.style=official
55
# project settings:
6-
version=0.5.5
6+
version=0.5.6
Binary file not shown.
Binary file not shown.
26.4 KB
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)