Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
fb54790
feat(swift-sdk): add full shielded pool (ZK) support for iOS
QuantumExplorer Mar 16, 2026
a16eede
fix(rs-sdk-ffi): address quality review findings in crypto module
QuantumExplorer Mar 16, 2026
16cfce5
fix(rs-sdk-ffi): address critical and high security audit findings
QuantumExplorer Mar 16, 2026
10bbed3
refactor(swift-sdk): replace JSON bundle serialization with direct C …
QuantumExplorer Mar 16, 2026
47b9587
security(rs-sdk-ffi): zeroize spending key bytes after derivation
QuantumExplorer Mar 16, 2026
c19a56e
fix(rs-sdk-ffi): address CodeRabbit review findings + fix CI compilation
QuantumExplorer Mar 16, 2026
8104871
feat(swift-sdk): add ShieldedPoolClient with commitment tree management
QuantumExplorer Mar 16, 2026
31b5c92
fix(swift-sdk): address CodeRabbit review findings (round 2)
QuantumExplorer Mar 16, 2026
b7de183
fix(swift-sdk): add Sendable conformance to types captured across iso…
QuantumExplorer Mar 16, 2026
272d1a2
fix(swift-sdk): widen SendableSdkPtr access from private to internal
QuantumExplorer Mar 16, 2026
49a53e2
fix(swift-sdk): widen shieldedExtractString/Void from private to inte…
QuantumExplorer Mar 16, 2026
fc38cc2
fix(swift-sdk): add Sendable to all public shielded value types
QuantumExplorer Mar 16, 2026
7dc7969
fix(swift-sdk): use C header types instead of manual Swift struct defs
QuantumExplorer Mar 16, 2026
e494b40
fix(swift-sdk): wrap .count with UInt() for FFI usize parameters
QuantumExplorer Mar 16, 2026
6ce0f79
fix(swift-sdk): fix Swift 6 concurrency and unused result warnings
QuantumExplorer Mar 16, 2026
e99d33e
fix(rs-sdk-ffi): address blocking review findings in pool_client
QuantumExplorer Mar 16, 2026
93a5dd2
fix(swift-sdk): fix mutable var capture in syncNullifiersRaw closure
QuantumExplorer Mar 16, 2026
187dc2a
fix: address remaining CodeRabbit review comments
QuantumExplorer Mar 16, 2026
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
1 change: 1 addition & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions packages/rs-sdk-ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ libc = "0.2"

# Cryptography
getrandom = "0.2"
rand = "0.8"
zeroize = "1.8"

# Concurrency
once_cell = "1.20"
Expand Down
67 changes: 67 additions & 0 deletions packages/rs-sdk-ffi/src/shielded/crypto/address.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
//! Orchard address derivation FFI function.

use std::ffi::CString;
use std::os::raw::c_void;

use dash_sdk::grovedb_commitment_tree::{FullViewingKey, Scope, SpendingKey};
use zeroize::Zeroize;

use crate::{DashSDKError, DashSDKErrorCode, DashSDKResult, DashSDKResultDataType};

/// Derive an Orchard payment address from a 32-byte spending key.
///
/// # Parameters
/// - `spending_key_bytes`: Pointer to a 32-byte spending key.
/// - `diversifier_index`: Address diversifier index (usually 0).
///
/// # Returns
/// `DashSDKResult` with a hex-encoded 43-byte Orchard raw address string on success.
/// The string is returned inside `DashSDKResult.data` and freed when the result is consumed.
///
Comment thread
QuantumExplorer marked this conversation as resolved.
/// # Safety
/// - `spending_key_bytes` must point to exactly 32 valid bytes.
#[no_mangle]
pub unsafe extern "C" fn dash_sdk_shielded_derive_address(
spending_key_bytes: *const [u8; 32],
diversifier_index: u32,
) -> DashSDKResult {
if spending_key_bytes.is_null() {
return DashSDKResult::error(DashSDKError::new(
DashSDKErrorCode::InvalidParameter,
"spending_key_bytes is null".to_string(),
));
}

let mut key_copy = *spending_key_bytes;

let sk = match SpendingKey::from_bytes(key_copy).into_option() {
Some(sk) => {
key_copy.zeroize();
sk
}
None => {
key_copy.zeroize();
return DashSDKResult::error(DashSDKError::new(
DashSDKErrorCode::InvalidParameter,
"Invalid spending key bytes".to_string(),
));
}
};

let fvk = FullViewingKey::from(&sk);
let payment_address = fvk.address_at(diversifier_index, Scope::External);
let raw_bytes = payment_address.to_raw_address_bytes();
let hex_str = hex::encode(raw_bytes);

match CString::new(hex_str) {
Ok(c_str) => DashSDKResult {
data_type: DashSDKResultDataType::String,
data: c_str.into_raw() as *mut c_void,
error: std::ptr::null_mut(),
},
Err(e) => DashSDKResult::error(DashSDKError::new(
DashSDKErrorCode::InternalError,
format!("Failed to create CString: {}", e),
)),
}
}
Loading
Loading