//! WASM bindings for the `LastID` SDK.
//!
//! This module provides JavaScript-friendly wrappers for the SDK,
//! enabling browser-based applications to use `LastID` credentials.

#![cfg(target_arch = "wasm32")]
#![allow(clippy::future_not_send)]
#![allow(clippy::use_self)]

mod client;
mod config;
mod error;
mod policies;
mod utils;

pub use client::WasmClient;
pub use config::WasmConfig;
pub use error::{ErrorCode, WasmError};
pub use policies::{
    WasmAgeProofPolicy, WasmBaseCredentialPolicy, WasmEmploymentPolicy, WasmPersonaPolicy,
    WasmTrustPolicy, WasmVerifiedEmailPolicy, WasmVerifiedPersonaPolicy, WasmVerifiedPhonePolicy,
};
// Alias for tests
pub use utils::get_supported_credential_types as get_credential_types;
pub use utils::{generate_nonce, generate_state, get_supported_credential_types, get_version};
use wasm_bindgen::prelude::*;

// Re-export for JS console logging
#[wasm_bindgen]
extern "C" {
    #[wasm_bindgen(js_namespace = console)]
    fn log(s: &str);
}

/// Initialize panic hook for better error messages in browser console.
#[wasm_bindgen(start)]
pub fn init() {
    console_error_panic_hook::set_once();
}
