rustzk 0.4.0

A pure Rust implementation of the ZK protocol for attendance devices.
Documentation

RustZK

A robust, pure Rust implementation of the ZK attendance device protocol (TCP/UDP).

Crates.io License

🌟 Key Features

  • Protocol Support: Full TCP and UDP implementation.
  • Biometric Data: Retrieve users, fingerprints, and face templates.
  • Timezone Aware: Automatic device timezone synchronization and ISO-8601 timestamps (e.g., 2023-10-27T10:00:00+07:00).
  • Robustness: Handles fragmented packets, connection retries, and protocol quirks.
  • Cross-Platform: Runs on Linux, macOS, and Windows with zero C dependencies.

📦 Installation

Add rustzk to your Cargo.toml:

[dependencies]
rustzk = "0.3.1"

🚀 Quick Start

use rustzk::{ZK, ZKProtocol};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    // 1. Initialize client
    let mut zk = ZK::new("192.168.1.201", 4370);
    
    // 2. Connect (Auto-detect protocol)
    zk.connect(ZKProtocol::Auto)?;
    
    // 3. Get device time (ISO-8601 with timezone)
    let time = zk.get_time()?;
    println!("Device Time: {}", time.to_rfc3339());
    
    // 4. Get attendance logs
    let logs = zk.get_attendance()?;
    for log in logs {
        println!("User: {}, Time: {}, Status: {}", 
            log.user_id, 
            log.iso_format(), 
            log.status
        );
    }

    // 5. Disconnect
    zk.disconnect()?;
    Ok(())
}

📚 Documentation

Detailed documentation is available in the documents/ directory:

Core Concepts

Business & Features

Security & Audit

🤝 Contributing

Contributions are welcome! Please check Standards for coding guidelines.

📜 License

MIT License. See LICENSE for details.

🙏 Acknowledgements

This project is inspired by the pyzk library.