[package]
name = "huskarl-core"
version = "0.1.0"
edition = "2024"
rust-version = "1.92"
description = "Base library for huskarl (OAuth2 client) ecosystem."
repository = "https://github.com/huskarl-rs/huskarl"
license = "MIT OR Apache-2.0"
keywords = ["oauth2", "security", "authentication"]
categories = ["authentication"]
readme = "README.md"

[features]
default = ["url"]

# When enabled, an EndpointUrl can be constructed from a url::Url.
url = ["dep:url"]

# When enabled, emits metrics via the `metrics` crate facade.
metrics = ["dep:metrics"]

[dependencies]
arc-swap = "1"
metrics = { workspace = true, optional = true }
base64 = { version = "0.22", default-features = false, features = ["std"] }
bon = { workspace = true }
bytes = { version = "1", default-features = false }
form_urlencoded = { workspace = true }
futures-util = { version = "0.3", default-features = false, features = ["std"] }
hex = { version = "0.4", default-features = false, features = ["std"] }
http = { version = "1", default-features = false, features = ["std"] }
rand = { workspace = true }
reqwest = { version = "0.13", default-features = false, optional = true }
secrecy = { version = "0.10", default-features = false }
serde = { workspace = true, features = ["rc"] }
serde_json = { workspace = true }
sha2 = { workspace = true, default-features = false }
snafu = { workspace = true }
tokio = { version = "1", default-features = false, features = ["sync"] }
url = { workspace = true, optional = true }

### Dependencies available on all platforms except WASM-not-WASI
[target.'cfg(not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none"))))'.dependencies]
tokio = { version = "1", default-features = false, features = ["time"] }

### Dependencies available on WASM-not-WASI
[target.'cfg(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none")))'.dependencies]
getrandom = { version = "0.4", default-features = false, features = ["wasm_js"] }
gloo-timers = { version = "0.3", default-features = false, features = ["futures"] }
web-time = { version = "1", default-features = false, features = ["serde"] }

[dev-dependencies]

[target.'cfg(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none")))'.dev-dependencies]
wasm-bindgen-test = "0.3"

[target.'cfg(not(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none"))))'.dev-dependencies]
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
reqwest = { version = "0.13", features = ["cookies", "form", "json", "query"] }
httpmock = "0.8.3"
