[package]
name = "ic-agent"
version.workspace = true
authors.workspace = true
edition.workspace = true
repository.workspace = true
license.workspace = true
rust-version.workspace = true
description = "Agent library to communicate with the Internet Computer, following the Public Specification."
homepage = "https://docs.rs/ic-agent"
documentation = "https://docs.rs/ic-agent"
readme = "README.md"
categories = ["api-bindings", "data-structures", "no-std"]
keywords = ["internet-computer", "agent", "icp", "dfinity"]
include = ["src", "Cargo.toml", "../LICENSE", "README.md"]

[dependencies]
arc-swap = "1.7"
async-channel = "1.9"
async-lock = "3.3"
async-trait = "0.1"
async-watch = "0.3"
backoff = "0.4.0"
cached = { version = "0.52", features = ["ahash"], default-features = false }
candid = { workspace = true }
der = "0.7"
ecdsa = "0.16"
ed25519-consensus = { workspace = true }
elliptic-curve = "0.13"
futures-util = { workspace = true }
hex = { workspace = true }
http = "1.0.0"
http-body = "1.0.0"
ic-certification = { workspace = true }
ic-transport-types = { workspace = true }
ic-verify-bls-signature = "0.5"
k256 = { workspace = true, features = ["pem"] }
p256 = { workspace = true, features = ["pem"] }
leb128 = { workspace = true }
pkcs8 = { version = "0.10.2", features = ["std"] }
sec1 = { version = "0.7.2", features = ["pem"] }
rand = { workspace = true }
rangemap = "1.4"
ring = { version = "0.17", optional = true }
serde = { workspace = true, features = ["derive"] }
serde_bytes = { workspace = true }
serde_cbor = { workspace = true }
serde_repr = { workspace = true }
sha2 = { workspace = true }
simple_asn1 = "0.6.1"
stop-token = "0.7"
thiserror = { workspace = true }
time = { workspace = true }
tower-service = "0.3"
tracing = { version = "0.1", optional = true }
url = "2.1.0"

[dependencies.reqwest]
workspace = true
default-features = false
features = ["blocking", "json", "rustls-tls-webpki-roots", "stream"]

[dependencies.pem]
version = "3"
optional = true

[target.'cfg(not(target_family = "wasm"))'.dependencies]
tokio = { version = "1.24.2", features = ["time"] }

[target.'cfg(target_family = "wasm")'.dependencies]
getrandom = { version = "0.2", features = ["js"], optional = true }
js-sys = { version = "0.3", optional = true }
wasm-bindgen = { version = "0.2", optional = true }
wasm-bindgen-futures = { version = "0.4", optional = true }
web-sys = { version = "0.3", features = ["Window"], optional = true }

[dev-dependencies]
serde_json.workspace = true
tracing-subscriber = "0.3"
tracing = "0.1"

[target.'cfg(not(target_family = "wasm"))'.dev-dependencies]
tokio = { workspace = true, features = ["full"] }
mockito = "1.0.2"

[target.'cfg(target_family = "wasm")'.dev-dependencies]
wasm-bindgen-test = "0.3.34"
web-sys = { version = "0.3", features = [
    "Navigator",
    "ServiceWorkerContainer",
    "ServiceWorker",
    "ServiceWorkerRegistration",
    "ServiceWorkerState",
] }

[features]
default = ["pem"]
pem = ["dep:pem"]
ring = ["dep:ring"]
ic_ref_tests = [
    "default",
] # Used to separate integration tests for ic-ref which need a server running.
wasm-bindgen = [
    "dep:js-sys",
    "dep:wasm-bindgen",
    "dep:wasm-bindgen-futures",
    "dep:getrandom",
    "dep:web-sys",
    "time/wasm-bindgen",
    "backoff/wasm-bindgen",
    "cached/wasm",
]
_internal_dynamic-routing = []
tracing = ["dep:tracing"] # Does very little right now.

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu", "wasm32-unknown-unknown"]
rustdoc-args = ["--cfg=docsrs"]
features = []