Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/ios.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: iOS

on:
pull_request:
push:
branches:
- master
- main
workflow_dispatch:

permissions:
contents: read

jobs:
ios-artifact:
name: iOS Artifact
runs-on: macos-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Validate Swift package manifest
run: swift package dump-package

- name: Build iOS XCFramework
run: ./build_ios.sh

- name: Verify iOS artifact outputs
run: |
test -d dist/ios/VssRustClientFfi.xcframework
test -f dist/ios/VssRustClientFfi.xcframework.zip
swift package compute-checksum dist/ios/VssRustClientFfi.xcframework.zip

- name: Upload iOS artifact
uses: actions/upload-artifact@v4
with:
name: VssRustClientFfi-iOS
path: |
dist/ios/VssRustClientFfi.xcframework
dist/ios/VssRustClientFfi.xcframework.zip
if-no-files-found: error
43 changes: 43 additions & 0 deletions .github/workflows/validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Validation

on:
pull_request:
push:
branches:
- master
- main
workflow_dispatch:

permissions:
contents: read

jobs:
validation:
name: Validation
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: clippy

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y pkg-config libssl-dev protobuf-compiler

- name: Check shell scripts
run: bash -n build.sh build_ios.sh build_android.sh

- name: Check Rust package
run: cargo check --locked

- name: Run Rust tests
run: cargo test --locked

- name: Run Clippy
run: cargo clippy --locked --all-targets
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@
/httpRequests/
.ai
.build
/dist/

# SwiftPM workspace files
.swiftpm/
9 changes: 4 additions & 5 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co

## Project Overview

Cross-platform FFI library wrapping the [VSS (Versioned Storage Service) Rust Client](https://github.com/lightningdevkit/vss-server) via UniFFI. Generates bindings for Swift (iOS), Kotlin (Android), and Python. Used by mobile Lightning wallets to back up both app data and LDK (Lightning Development Kit) channel state to a VSS server.
Cross-platform FFI library wrapping the [VSS (Versioned Storage Service) Rust Client](https://github.com/lightningdevkit/vss-server) via UniFFI. Generates bindings for Swift (iOS) and Kotlin (Android). Used by mobile Lightning wallets to back up both app data and LDK (Lightning Development Kit) channel state to a VSS server.

## Build & Test Commands

Expand All @@ -19,8 +19,7 @@ cargo clippy # Lint
# Platform bindings (requires platform-specific toolchains)
./build.sh ios # XCFramework + Swift bindings
./build.sh android # JNI libs + Kotlin bindings
./build.sh python # Python package
./build.sh all # All platforms
./build.sh all # iOS + Android bindings
```

## Architecture
Expand Down Expand Up @@ -68,8 +67,8 @@ When investigating VSS server behavior, protocol details, or LDK key derivation,

1. **ALWAYS** bump the version in `Cargo.toml` before generating bindings.
2. **ALWAYS** bump the iOS framework tag in `Package.swift` to match the new version.
3. **ALWAYS** regenerate all bindings with `./build.sh all` after any code changes.
4. **ALWAYS** upload `bindings/ios/VssRustClientFfi.xcframework.zip` to new GitHub releases.
3. **ALWAYS** regenerate iOS and Android bindings with `./build.sh all` after any code changes.
4. **ALWAYS** upload `dist/ios/VssRustClientFfi.xcframework.zip` to new GitHub releases.

## Commit Convention

Expand Down
10 changes: 5 additions & 5 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.5
// swift-tools-version:5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription
Expand All @@ -10,13 +10,13 @@ let url = "https://github.com/synonymdev/vss-rust-client-ffi/releases/download/\
let package = Package(
name: "vss-rust-client-ffi",
platforms: [
.iOS(.v13),
.macOS(.v11),
.iOS(.v17),
Comment thread
pwltr marked this conversation as resolved.
],
products: [
.library(
name: "VssRustClientFfi",
targets: ["VssRustClientFfi", "VssRustClientFfiFFI"]),
targets: ["VssRustClientFfi", "VssRustClientFfiFFI"]
),
],
targets: [
.target(
Expand All @@ -29,6 +29,6 @@ let package = Package(
name: "VssRustClientFfiFFI",
url: url,
checksum: checksum
)
),
]
)
102 changes: 5 additions & 97 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,14 @@ Cross-platform FFI bindings for the [VSS (Versioned Storage Service) Rust Client
# Basic build
cargo build --release

# Generate ALL bindings
# Generate iOS and Android bindings
./build.sh all

# Generate Swift bindings for iOS
./build_ios.sh

# Generate Kotlin bindings for Android
./build_android.sh

# Generate Python bindings
./build_python.sh
```

## Usage Examples
Expand Down Expand Up @@ -117,88 +114,6 @@ let allKeys = try await vssLdkListAllKeys()
vssShutdownLdkClient()
```

### Python

```python
from vss_rust_client_ffi import *

mnemonic = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about"
passphrase = None
store_id = vss_derive_store_id(
prefix="bitkit_v1_regtest",
mnemonic=mnemonic,
passphrase=passphrase
)

await vss_new_client_with_lnurl_auth(
"https://vss.example.com",
store_id,
mnemonic,
passphrase,
"https://auth.example.com/lnurl"
)

# Store data
item = await vss_store("user-settings", b"{'theme': 'dark'}")
print(f"Stored at version: {item.version}")

# Retrieve data
item = await vss_get("user-settings")
if item:
print(f"Retrieved: {item.value.decode()}")

# List keys only (more efficient)
keys = await vss_list_keys("user/")
for kv in keys:
print(f"Key: {kv.key}, Version: {kv.version}")

# Batch store multiple items
items_to_store = [
KeyValue(key="config/theme", value=b"dark"),
KeyValue(key="config/lang", value=b"en")
]
stored_items = await vss_put_with_key_prefix(items_to_store)
print(f"Stored {len(stored_items)} items")

# Delete data
was_deleted = await vss_delete("user-settings")
print(f"Deleted: {was_deleted}")

# Clean shutdown (optional)
vss_shutdown_client()
```

#### Dedicated LDK Client (Python)

```python
# Initialize the dedicated LDK client (separate from the app client)
await vss_new_ldk_client_with_lnurl_auth(
"https://vss.example.com",
store_id,
mnemonic,
passphrase,
"https://auth.example.com/lnurl"
)

# Read an ldk-node key
item = await vss_ldk_get("network_graph", LdkNamespace.DEFAULT)

# Store a key
item = await vss_ldk_store("network_graph", graph_data, LdkNamespace.DEFAULT)

# Delete a key
was_deleted = await vss_ldk_delete("network_graph", LdkNamespace.DEFAULT)

# List keys in a namespace
keys = await vss_ldk_list_keys(LdkNamespace.MONITORS)

# List all keys across all namespaces
all_keys = await vss_ldk_list_all_keys()

# Clean shutdown
vss_shutdown_ldk_client()
```

### Kotlin (Android)

```kotlin
Expand Down Expand Up @@ -388,8 +303,10 @@ Error enum with detailed error information for different failure scenarios.
```

Generates:
- `bindings/ios/VssRustClientFfi.xcframework` - iOS framework
- `bindings/ios/vss_rust_client_ffi.swift` - Swift bindings
- `dist/ios/VssRustClientFfi.xcframework` - iOS framework
- `dist/ios/VssRustClientFfi.xcframework.zip` - zipped SwiftPM binary artifact for release upload
- `bindings/ios/vss_rust_client_ffi.swift` - Swift bindings source used by `Package.swift`
- `bindings/ios/vss_rust_client_ffiFFI.h` and `bindings/ios/module.modulemap` - C interface files used by the Swift package

### Android Library

Expand All @@ -401,15 +318,6 @@ Generates:
- `bindings/android/vss_rust_client_ffi.kt` - Kotlin bindings
- `bindings/android/jniLibs/` - Native libraries for all Android architectures

### Python Package

```bash
./build_python.sh
```

Generates:
- `bindings/python/` - Python package with bindings and native library

## Development

### Prerequisites
Expand Down
Binary file removed bindings/ios/VssRustClientFfi.xcframework.zip
Binary file not shown.
43 changes: 0 additions & 43 deletions bindings/ios/VssRustClientFfi.xcframework/Info.plist

This file was deleted.

Loading
Loading