Skip to content

Commit 12672cf

Browse files
Merge pull request #3 from synonymdev/feat/derive-store-id
feat: add store id derivation
2 parents 931d287 + af508ef commit 12672cf

File tree

20 files changed

+243
-17
lines changed

20 files changed

+243
-17
lines changed

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.2.0"
3+
version = "0.3.0"
44
edition = "2021"
55
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
66

README.md

Lines changed: 43 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,19 @@ cargo build --release
3232
```swift
3333
import vss_rust_client_ffi
3434

35-
// Initialize VSS client with LNURL-auth
35+
let mnemonic = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about"
36+
let passphrase: String? = nil
37+
let storeId = try vssDeriveStoreId(
38+
prefix: "bitkit_v1_regtest",
39+
mnemonic: mnemonic,
40+
passphrase: passphrase
41+
)
42+
3643
try await vssNewClientWithLnurlAuth(
3744
baseUrl: "https://vss.example.com",
38-
storeId: "my-app-store",
39-
mnemonic: "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about",
40-
passphrase: nil,
45+
storeId: storeId,
46+
mnemonic: mnemonic,
47+
passphrase: passphrase,
4148
lnurlAuthServerUrl: "https://auth.example.com/lnurl"
4249
)
4350

@@ -73,12 +80,19 @@ vssShutdownClient()
7380
```python
7481
from vss_rust_client_ffi import *
7582

76-
# Initialize VSS client with LNURL-auth
83+
mnemonic = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about"
84+
passphrase = None
85+
store_id = vss_derive_store_id(
86+
prefix="bitkit_v1_regtest",
87+
mnemonic=mnemonic,
88+
passphrase=passphrase
89+
)
90+
7791
await vss_new_client_with_lnurl_auth(
7892
"https://vss.example.com",
79-
"my-app-store",
80-
"abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about",
81-
None, # passphrase
93+
store_id,
94+
mnemonic,
95+
passphrase,
8296
"https://auth.example.com/lnurl"
8397
)
8498

@@ -117,12 +131,19 @@ vss_shutdown_client()
117131
```kotlin
118132
import uniffi.vss_rust_client_ffi.*
119133

120-
// Initialize VSS client with LNURL-auth
134+
val mnemonic = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about"
135+
val passphrase: String? = null
136+
val storeId = vssDeriveStoreId(
137+
prefix = "bitkit_v1_regtest",
138+
mnemonic = mnemonic,
139+
passphrase = passphrase
140+
)
141+
121142
vssNewClientWithLnurlAuth(
122143
baseUrl = "https://vss.example.com",
123-
storeId = "my-app-store",
124-
mnemonic = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about",
125-
passphrase = null,
144+
storeId = storeId,
145+
mnemonic = mnemonic,
146+
passphrase = passphrase,
126147
lnurlAuthServerUrl = "https://auth.example.com/lnurl"
127148
)
128149

@@ -171,6 +192,15 @@ Initialize the global VSS client connection with LNURL-auth authentication. Prov
171192
#### `vssShutdownClient() -> Void`
172193
Shutdown the VSS client and clean up resources. Optional but recommended for clean application shutdown.
173194

195+
### Utility Functions
196+
197+
#### `vssDeriveStoreId(prefix: String, mnemonic: String, passphrase: String?) -> String`
198+
Derives a deterministic VSS store ID from a mnemonic and optional passphrase using BIP32 key derivation.
199+
200+
- `prefix`: A prefix to include in the store ID (e.g., "bitkit_v1_regtest")
201+
- `mnemonic`: BIP39 mnemonic phrase (12 or 24 words)
202+
- `passphrase`: Optional BIP39 passphrase
203+
174204
### Data Operations
175205

176206
#### `vssStore(key: String, value: Data) -> VssItem`
@@ -294,4 +324,4 @@ This project is licensed under the MIT License - see the LICENSE file for detail
294324

295325
- [VSS Server](https://github.com/lightningdevkit/vss-server) - The VSS server implementation
296326
- [vss-client](https://crates.io/crates/vss-client) - The underlying Rust client library
297-
- [UniFFI](https://mozilla.github.io/uniffi-rs/) - The FFI binding generator
327+
- [UniFFI](https://mozilla.github.io/uniffi-rs/) - The FFI binding generator

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.2.0
6+
version=0.3.0

0 commit comments

Comments
 (0)