Thanks to visit codestin.com
Credit goes to lib.rs

#payment #noah #sdk #cryptography

noah-sdk

A modern, type-safe Rust SDK for the Noah Business API

6 stable releases

1.1.0 Nov 26, 2025
1.0.4 Nov 13, 2025
1.0.3 Nov 12, 2025

#655 in Web programming

MIT/Apache

270KB
6K SLoC

Noah SDK

Noah SDK

Documentation Crates.io License Rust Documentation CI dependency status


A modern, type-safe Rust SDK for the Noah Business API.

Features

  • Type Safety: Strongly typed models generated from OpenAPI schema
  • Async Support: Built on async/await with reqwest
  • Dual Authentication: Support for both JWT signing (Api-Signature) and API key (X-Api-Key) authentication
  • Comprehensive Error Handling: Detailed error types with context
  • Production Ready: Well-tested and documented

Installation

Add this to your Cargo.toml:

[dependencies]
noah-sdk = { version = "1.0", features = ["rustls-tls"] }

For native TLS:

[dependencies]
noah-sdk = { version = "1.0", features = ["native-tls"] }

Quick Start

Basic Example

use noah_sdk::apis::configuration::{ApiKey, Configuration};
use noah_sdk::apis::utilities_api;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Create configuration for sandbox environment
    let mut config = Configuration::default();
    config.base_path = "https://api.sandbox.noah.com/v1".to_string();
    config.api_key = Some(ApiKey {
        prefix: None,
        key: "your-api-key-here".to_string(),
    });

    // Get balances
    let balances = utilities_api::balances_get(&config, None, None, None).await?;
    println!("Found {} balances", balances.items.len());

    Ok(())
}

Authentication

The SDK supports two authentication methods:

API Key Authentication

use noah_sdk::apis::configuration::{ApiKey, Configuration};

let mut config = Configuration::default();
config.api_key = Some(ApiKey {
    prefix: None,
    key: "your-api-key".to_string(),
});

JWT Signature Authentication

let mut config = Configuration::default();
config.bearer_access_token = Some("your-jwt-token".to_string());
// Or pass api_signature parameter to API calls

Both Methods

You can use both by setting both api_key and passing api_signature to individual API calls.

Examples

See the examples directory for more detailed examples:

Run an example:

cargo run --example basic_client

API Coverage

The SDK provides typed methods for all major Noah API endpoints:

  • Balances: Get account balances (utilities_api::balances_get)
  • Channels: List and get channel information (utilities_api::channels_sell_get, utilities_api::channels_channel_id_get)
  • Customers: Create, update, and retrieve customers (onboarding_api::customers_customer_id_put, utilities_api::customers_customer_id_get)
  • Transactions: Prepare and execute sell transactions (payout_api::transactions_sell_prepare_post, payout_api::transactions_sell_post)
  • Checkout: Create payin and payout checkout sessions (payin_api::checkout_payin_crypto_post, payout_api::checkout_payout_fiat_post)
  • Onboarding: Create onboarding sessions and prefill customer data (onboarding_api::onboarding_customer_id_post)
  • Payment Methods: List customer payment methods (utilities_api::payment_methods_get)
  • Workflows: Create automated workflows (payin_api::workflows_bank_deposit_to_onchain_address_post)

Error Handling

The SDK uses comprehensive error types for each API endpoint:

use noah_sdk::apis::utilities_api;

match utilities_api::balances_get(&config, None, None, None).await {
    Ok(balances) => println!("Success: {:?}", balances),
    Err(noah_sdk::apis::Error::ResponseError(err)) => {
        println!("API error: status={}, content={}", err.status, err.content);
    }
    Err(noah_sdk::apis::Error::Reqwest(err)) => println!("HTTP error: {}", err),
    Err(noah_sdk::apis::Error::Serde(err)) => println!("Serialization error: {}", err),
    Err(e) => println!("Other error: {}", e),
}

Configuration

Environment Selection

use noah_sdk::apis::configuration::Configuration;

// Sandbox (default)
let mut config = Configuration::default();
config.base_path = "https://api.sandbox.noah.com/v1".to_string();

// Production
let mut config = Configuration::default();
config.base_path = "https://api.noah.com/v1".to_string();

// Custom URL
let mut config = Configuration::default();
config.base_path = "https://api.custom.com/v1".to_string();

Custom Configuration

let mut config = Configuration::default();
config.base_path = "https://api.sandbox.noah.com/v1".to_string();
config.user_agent = Some("my-app/1.0".to_string());
config.api_key = Some(ApiKey {
    prefix: None,
    key: "your-api-key".to_string(),
});

Features

  • default: Enables native-tls
  • rustls-tls: Use rustls for TLS
  • native-tls: Use native TLS implementation (default)

License

Licensed under the MIT license (LICENSE).

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Dependencies

~5–21MB
~224K SLoC