| Crates.io | lit-rust-sdk |
| lib.rs | lit-rust-sdk |
| version | 0.3.0 |
| created_at | 2025-08-18 22:21:48.898479+00 |
| updated_at | 2025-09-10 23:11:33.626592+00 |
| description | Native Rust SDK for Lit Protocol - distributed key management and programmable signing |
| homepage | https://litprotocol.com |
| repository | https://github.com/LIT-Protocol/lit-rust-sdk |
| max_upload_size | |
| id | 1801135 |
| size | 467,199 |
A native Rust implementation of the Lit Protocol SDK, providing programmatic access to the Lit Network for distributed key management, conditional access control, and programmable signing.
Currently in Beta and only supports Datil, DatilDev, and DatilTest networks.
Add this to your Cargo.toml:
[dependencies]
lit-rust-sdk = "0.1.0"
tokio = { version = "1.40", features = ["full"] }
Execute a Lit Action using only your Ethereum wallet (no PKP required):
use lit_rust_sdk::{
auth::load_wallet_from_env,
types::{LitAbility, LitResourceAbilityRequest, LitResourceAbilityRequestResource},
ExecuteJsParams, LitNetwork, LitNodeClient, LitNodeClientConfig,
};
use std::time::Duration;
#[tokio::main]
async fn main() {
// Load wallet from environment variable
let wallet = load_wallet_from_env()
.expect("Set ETHEREUM_PRIVATE_KEY environment variable");
// Configure and connect to Lit Network
let config = LitNodeClientConfig {
lit_network: LitNetwork::DatilDev,
alert_when_unauthorized: true,
debug: true,
connect_timeout: Duration::from_secs(30),
check_node_attestation: false,
};
let mut client = LitNodeClient::new(config)
.await
.expect("Failed to create client");
client.connect().await.expect("Failed to connect");
// Create session signatures without PKP
let resource_ability_requests = vec![LitResourceAbilityRequest {
resource: LitResourceAbilityRequestResource {
resource: "*".to_string(),
resource_prefix: "lit-litaction".to_string(),
},
ability: LitAbility::LitActionExecution.to_string(),
}];
let expiration = (chrono::Utc::now() + chrono::Duration::minutes(10)).to_rfc3339();
let session_sigs = client
.get_local_session_sigs(&wallet, resource_ability_requests, &expiration)
.await
.expect("Failed to create session signatures");
// Execute Lit Action
let execute_params = ExecuteJsParams {
code: Some(r#"
const go = async () => {
console.log("Hello from Lit Action!");
Lit.Actions.setResponse({ response: "Hello World!" });
};
go();
"#.to_string()),
ipfs_id: None,
session_sigs,
auth_methods: None,
js_params: None,
};
let response = client.execute_js(execute_params).await
.expect("Failed to execute Lit Action");
println!("Response: {:?}", response.response);
}
For comprehensive documentation, examples, and guides, please visit:
See LICENSE file in the repository root.