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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ jobs:
run: cargo clippy --all-targets --all-features -- -D warnings

- name: Build Rust core
run: cargo build --release --package idkit-core
run: cargo build --release --package idkit

- name: Run Rust tests
run: cargo test --package idkit-core
run: cargo test --package idkit --all-features
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you probably also want to run tests with --no-default-features


swift-bindings:
name: Swift Bindings - Build & Test
Expand Down
44 changes: 44 additions & 0 deletions .github/workflows/publish-rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Publish Rust Release

on:
pull_request:
types: [closed]
branches:
- main

permissions:
contents: write

jobs:
publish-rust:
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'release')
runs-on: ubuntu-latest
environment: production
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable

- name: Ensure release version
id: version
run: |
VERSION=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[] | select(.name=="idkit") | .version')
if [ -z "$VERSION" ]; then
echo "Could not find idkit crate in workspace" >&2
exit 1
fi
if echo "$VERSION" | grep -q "-"; then
echo "Version contains pre-release identifier ($VERSION); aborting publish." >&2
exit 1
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"

- name: Run tests
run: cargo test -p idkit --all-features --no-default-features

- name: Publish crate to crates.io
run: cargo publish -p idkit --locked
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
/kotlin/bindings/src/main/jniLibs/
/kotlin/bindings/src/main/kotlin/uniffi/
/kotlin/bindings/src/main/resources/libidkit.*
/kotlin/bindings/src/main/resources/libidkitffi.*
/kotlin/dist/
/kotlin/idkit-kotlin-*.zip

Expand Down
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions rust/core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "idkit-core"
name = "idkit"
version.workspace = true
edition.workspace = true
license.workspace = true
Expand Down Expand Up @@ -44,4 +44,4 @@ uniffi-bindings = ["uniffi"] # Enable UniFFI scaffolding for Swift/Kotlin bindi
# Protocol features
bridge = ["uuid/v4", "reqwest", "dep:tokio", "dep:urlencoding"] # Bridge client and session management for verifications
bridge-wasm = ["uuid/js", "reqwest", "dep:urlencoding"] # Bridge for WASM (no tokio)
verification = ["reqwest", "dep:tokio"] # Backend proof verification via Developer Portal API
verification = ["reqwest", "dep:tokio"] # Backend proof verification via Developer Portal API
2 changes: 1 addition & 1 deletion rust/core/src/bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ impl Session {

// Send to bridge
let client = reqwest::Client::builder()
.user_agent(format!("idkit-core/{}", env!("CARGO_PKG_VERSION")))
.user_agent(format!("idkit/{}", env!("CARGO_PKG_VERSION")))
.build()?;

let response = client
Expand Down
2 changes: 1 addition & 1 deletion rust/core/src/verification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ pub async fn verify_proof_with_endpoint(
.post(&url)
.header(
"User-Agent",
&format!("idkit-core/{}", env!("CARGO_PKG_VERSION")),
&format!("idkit/{}", env!("CARGO_PKG_VERSION")),
)
.json(&request)
.send()
Expand Down
4 changes: 2 additions & 2 deletions rust/uniffi-bindings/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ description = "UniFFI bindings for IDKit - generates native Swift and Kotlin bin

[lib]
crate-type = ["staticlib", "cdylib"]
name = "idkit"
name = "idkitffi"

[dependencies]
idkit-core = { path = "../core", default-features = false, features = ["uniffi-bindings", "native-crypto", "bridge"] }
idkit-core = { package = "idkit", path = "../core", default-features = false, features = ["uniffi-bindings", "native-crypto", "bridge"] }
uniffi = { workspace = true }
thiserror = { workspace = true }
serde_json = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion rust/wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ wasm-opt = false
crate-type = ["cdylib", "rlib"]

[dependencies]
idkit-core = { path = "../core", default-features = false, features = ["wasm-crypto", "bridge-wasm"] }
idkit-core = { package = "idkit", path = "../core", default-features = false, features = ["wasm-crypto", "bridge-wasm"] }
wasm-bindgen = { workspace = true }
wasm-bindgen-futures = { workspace = true }
js-sys = { workspace = true }
Expand Down
4 changes: 2 additions & 2 deletions scripts/build-kotlin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ case "$SYSTEM" in
MINGW*|MSYS*|CYGWIN*) LIB_EXT="dll" ;;
esac

HOST_LIB="$PROJECT_ROOT/target/release/libidkit.$LIB_EXT"
HOST_LIB="$PROJECT_ROOT/target/release/libidkitffi.$LIB_EXT"

echo "🔧 Building Rust library (host) for binding generation"
cargo build --package idkit-uniffi --release --locked
Expand Down Expand Up @@ -70,7 +70,7 @@ else
echo " • $TARGET -> $ABI"
CROSS_NO_WARNINGS=1 cross build --package idkit-uniffi --target "$TARGET" --release --locked
mkdir -p "$JNI_DIR/$ABI"
cp "$PROJECT_ROOT/target/$TARGET/release/libidkit.so" "$JNI_DIR/$ABI/libidkit.so"
cp "$PROJECT_ROOT/target/$TARGET/release/libidkitffi.so" "$JNI_DIR/$ABI/libidkitffi.so"
# Clean up Docker resources to save disk space during multi-target builds (CI only)
if [ -n "${CI:-}" ] && command -v docker >/dev/null 2>&1; then
echo " ↳ Cleaning Docker resources after $TARGET build..."
Expand Down
37 changes: 23 additions & 14 deletions scripts/package-swift.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,17 @@ cargo build --package idkit-uniffi --target aarch64-apple-ios --release --locked
cargo build --package idkit-uniffi --target aarch64-apple-darwin --release --locked
cargo build --package idkit-uniffi --target x86_64-apple-darwin --release --locked

cp target/aarch64-apple-ios/release/libidkit.a target/aarch64-apple-ios/release/libidkitFFI.a
cp target/x86_64-apple-ios/release/libidkit.a target/x86_64-apple-ios/release/libidkitFFI.a
cp target/aarch64-apple-ios-sim/release/libidkit.a target/aarch64-apple-ios-sim/release/libidkitFFI.a
cp target/aarch64-apple-darwin/release/libidkit.a target/aarch64-apple-darwin/release/libidkitFFI.a
cp target/x86_64-apple-darwin/release/libidkit.a target/x86_64-apple-darwin/release/libidkitFFI.a
rm -f target/aarch64-apple-ios/release/libidkitFFI.a
rm -f target/x86_64-apple-ios/release/libidkitFFI.a
rm -f target/aarch64-apple-ios-sim/release/libidkitFFI.a
rm -f target/aarch64-apple-darwin/release/libidkitFFI.a
rm -f target/x86_64-apple-darwin/release/libidkitFFI.a

cp target/aarch64-apple-ios/release/deps/libidkitffi.a target/aarch64-apple-ios/release/libidkitFFI.a
cp target/x86_64-apple-ios/release/deps/libidkitffi.a target/x86_64-apple-ios/release/libidkitFFI.a
cp target/aarch64-apple-ios-sim/release/deps/libidkitffi.a target/aarch64-apple-ios-sim/release/libidkitFFI.a
cp target/aarch64-apple-darwin/release/deps/libidkitffi.a target/aarch64-apple-darwin/release/libidkitFFI.a
cp target/x86_64-apple-darwin/release/deps/libidkitffi.a target/x86_64-apple-darwin/release/libidkitFFI.a

strip -S -x target/aarch64-apple-ios/release/libidkitFFI.a
strip -S -x target/x86_64-apple-ios/release/libidkitFFI.a
Expand All @@ -62,21 +68,19 @@ lipo -info $IOS_BUILD/target/universal-macos/release/libidkitFFI.a

echo "🧬 Generating UniFFI Swift bindings"
cargo run -p uniffi-bindgen generate \
--library target/aarch64-apple-ios-sim/release/libidkit.dylib \
--library target/aarch64-apple-ios-sim/release/libidkitffi.dylib \
--language swift \
--no-format \
--out-dir "$IOS_BUILD/bindings"

rm -f "$GENERATED_DIR"/*
cp "$IOS_BUILD/bindings"/idkit.swift "$GENERATED_DIR/"
cp "$IOS_BUILD/bindings"/idkitffi.swift "$GENERATED_DIR/idkit.swift"
cp "$IOS_BUILD/bindings"/idkit_core.swift "$GENERATED_DIR/"
cp "$IOS_BUILD/bindings"/idkitFFI.h "$GENERATED_DIR/"
cp "$IOS_BUILD/bindings"/idkitFFI.modulemap "$GENERATED_DIR/"
cp "$IOS_BUILD/bindings"/idkitffiFFI.h "$GENERATED_DIR/idkitFFI.h"
cp "$IOS_BUILD/bindings"/idkit_coreFFI.h "$GENERATED_DIR/"
cp "$IOS_BUILD/bindings"/idkit_coreFFI.modulemap "$GENERATED_DIR/"

rm -f "$FFI_INCLUDE_DIR"/idkitFFI.h "$FFI_INCLUDE_DIR"/idkit_coreFFI.h "$FFI_INCLUDE_DIR"/module.modulemap
cp "$IOS_BUILD/bindings"/idkitFFI.h "$FFI_INCLUDE_DIR/"
cp "$IOS_BUILD/bindings"/idkitffiFFI.h "$FFI_INCLUDE_DIR/idkitFFI.h"
cp "$IOS_BUILD/bindings"/idkit_coreFFI.h "$FFI_INCLUDE_DIR/"
cat <<'EOF' > "$FFI_INCLUDE_DIR/module.modulemap"
module idkitFFI {
Expand All @@ -86,10 +90,15 @@ module idkitFFI {
}
EOF

cp "$IOS_BUILD/bindings"/idkitFFI.h "$IOS_BUILD/Headers/IDKit/"
cp "$IOS_BUILD/bindings"/idkitffiFFI.h "$IOS_BUILD/Headers/IDKit/idkitFFI.h"
cp "$IOS_BUILD/bindings"/idkit_coreFFI.h "$IOS_BUILD/Headers/IDKit/"
cat "$IOS_BUILD/bindings"/idkitFFI.modulemap > "$IOS_BUILD/Headers/IDKit/module.modulemap"
cat "$IOS_BUILD/bindings"/idkit_coreFFI.modulemap >> "$IOS_BUILD/Headers/IDKit/module.modulemap"
cat <<'EOF' > "$IOS_BUILD/Headers/IDKit/module.modulemap"
module idkitFFI {
header "idkitFFI.h"
header "idkit_coreFFI.h"
export *
}
EOF

echo "🏗️ Creating XCFramework"
xcodebuild -create-xcframework \
Expand Down
2 changes: 1 addition & 1 deletion swift/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This Swift SDK is a wrapper over the Rust core:

```
┌─────────────────────────────────────┐
│ Rust Core (idkit-core)
│ Rust Core (idkit)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm shouldn't foreign bindings still inherit from idkit-core? so idkit-core (Rust package) -> idkit-js (with react), idkit-swift, idkit-kotlin

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah it's just a naming thing, I made it idkit so the rust package is idkit not idkit core, even though it is core

│ - All business logic │
│ - Session management │
│ - Constraints │
Expand Down
Loading