Skip to main content

Crate kiwavi

Crate kiwavi 

Source
Expand description

§Kiwavi

A secure TOTP-based key derivation system that generates deterministic values from user salts without storing sensitive data in plaintext.

Kiwavi enhances standard TOTP by:

  • Deriving unique secrets from user-provided salts
  • Returning deterministic values only on correct TOTP validation
  • Supporting multiple app/service configurations
  • Never storing actual secrets or derived values in memory

§Usage

use kiwavi::{Kiwavi, AppConfig};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let app_config = AppConfig::new("Your App", "some_user@example.com");
    let kiwavi = Kiwavi::new("user_unique_salt_123", app_config)?;

    // Get QR code URL
    let qr_url = kiwavi.get_setup_qr();
    println!("Scan QR: {}", qr_url);

     // Get QR code URL
     let totp_secret = kiwavi.get_totp_secret();
     println!("TOTP: {}", totp_secret);



    // Validate TOTP and derive value
    let derived_value = kiwavi.validate_and_derive("123456");
    println!("Derived Value (Hex): {}", derived_value.hex());

    Ok(())
}

Structs§

AppConfig
Configuration for the application/service using Kiwavi
Kiwavi
Main Kiwavi instance for TOTP-based key derivation

Enums§

KiwaviError
Errors that can occur when using Kiwavi
ValidationResult
Result returned by Kiwavi validation

Traits§

SaltInput
Supported salt input types for Kiwavi