[package]
authors = ["Damir Jelić <poljar@termina.org.uk>"]
description = "A high level Matrix client-server library."
edition = "2021"
homepage = "https://github.com/matrix-org/matrix-rust-sdk"
keywords = ["matrix", "chat", "messaging", "ruma", "nio"]
license = "Apache-2.0"
name = "matrix-sdk"
readme = "README.md"
repository = "https://github.com/matrix-org/matrix-rust-sdk"
rust-version = { workspace = true }
version = "0.7.1"

[package.metadata.docs.rs]
features = ["docsrs"]
rustdoc-args = ["--cfg", "docsrs"]

[features]
default = ["e2e-encryption", "automatic-room-key-forwarding", "sqlite", "native-tls"]
testing = ["matrix-sdk-sqlite?/testing", "matrix-sdk-indexeddb?/testing", "matrix-sdk-base/testing"]

e2e-encryption = [
    "matrix-sdk-base/e2e-encryption",
    "matrix-sdk-base/message-ids",
    "matrix-sdk-sqlite?/crypto-store",        # activate crypto-store on sqlite if given
    "matrix-sdk-indexeddb?/e2e-encryption",   # activate on indexeddb if given
]
js = ["matrix-sdk-common/js", "matrix-sdk-base/js"]

sqlite = ["dep:matrix-sdk-sqlite", "matrix-sdk-sqlite?/state-store"]
bundled-sqlite = ["sqlite", "matrix-sdk-sqlite?/bundled"]
indexeddb = ["dep:matrix-sdk-indexeddb"]

qrcode = ["e2e-encryption", "matrix-sdk-base/qrcode"]
automatic-room-key-forwarding = ["e2e-encryption", "matrix-sdk-base/automatic-room-key-forwarding"]
markdown = ["ruma/markdown"]
native-tls = ["reqwest/native-tls"]
rustls-tls = ["reqwest/rustls-tls"]
socks = ["reqwest/socks"]
sso-login = ["dep:hyper", "dep:rand", "dep:tower"]
image-proc = ["dep:image"]
image-rayon = ["image-proc", "image?/jpeg_rayon"]

experimental-oidc = [
    "ruma/unstable-msc2967",
    "dep:chrono",
    "dep:language-tags",
    "dep:mas-oidc-client",
    "dep:rand",
    "dep:sha2",
    "dep:tower",
]
experimental-sliding-sync = [
    "matrix-sdk-base/experimental-sliding-sync",
    "reqwest/gzip",
    "dep:eyeball-im-util",
]
experimental-widgets = ["dep:language-tags", "dep:uuid"]

docsrs = ["e2e-encryption", "sqlite", "indexeddb", "sso-login", "qrcode", "image-proc"]

[dependencies]
anyhow = { workspace = true, optional = true }
anymap2 = "0.13.0"
aquamarine = "0.5.0"
as_variant = { workspace = true }
async-channel = "2.1.0"
async-stream = { workspace = true }
async-trait = { workspace = true }
bytes = "1.1.0"
bytesize = "1.1"
cfg-vis = "0.3.0"
chrono = { version = "0.4.23", optional = true }
event-listener = "4.0.0"
eyeball = { workspace = true }
eyeball-im = { workspace = true }
eyeball-im-util = { workspace = true, optional = true }
eyre = { version = "0.6.8", optional = true }
futures-core = { workspace = true }
futures-util = { workspace = true }
http = { workspace = true }
hyper = { version = "0.14.20", features = ["http1", "http2", "server"], optional = true }
imbl = { version = "2.0.0", features = ["serde"] }
indexmap = "2.0.2"
language-tags = { version = "0.3.2", optional = true }
mas-oidc-client = { version = "0.7.0", optional = true }
matrix-sdk-base = { workspace = true }
matrix-sdk-common = { workspace = true }
matrix-sdk-indexeddb = { workspace = true, optional = true }
matrix-sdk-sqlite = { workspace = true, optional = true }
mime = "0.3.16"
mime2ext = "0.1.52"
rand = { workspace = true , optional = true }
ruma = { workspace = true, features = ["rand", "unstable-msc2448", "unstable-msc2965", "unstable-msc3930", "unstable-msc3245-v1-compat"] }
serde = { workspace = true }
serde_html_form = { workspace = true }
serde_json = { workspace = true }
sha2 = { workspace = true, optional = true }
tempfile = "3.3.0"
thiserror = { workspace = true }
tokio-stream = { workspace = true, features = ["sync"] }
tower = { version = "0.4.13", features = ["make"], optional = true }
tracing = { workspace = true, features = ["attributes"] }
url = "2.2.2"
urlencoding = "2.1.3"
uuid = { version = "1.4.1", features = ["serde", "v4"], optional = true }
zeroize = { workspace = true }

[dependencies.image]
version = "0.24.2"
default-features = false
features = [
    "gif",
    "jpeg",
    "ico",
    "png",
    "pnm",
    "tga",
    "tiff",
    "webp",
    "bmp",
    "hdr",
    "dxt",
    "dds",
    "farbfeld",
]
optional = true

[target.'cfg(target_arch = "wasm32")'.dependencies]
gloo-timers = { version = "0.3.0", features = ["futures"] }
reqwest = { version = "0.11.10", default_features = false }
tokio = { workspace = true }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
backoff = { version = "0.4.0", features = ["tokio"] }
# only activate reqwest's stream feature on non-wasm, the wasm part seems to not
# support *sending* streams, which makes it useless for us.
reqwest = { version = "0.11.10", default_features = false, features = ["stream"] }
tokio = { workspace = true, features = ["fs", "rt", "macros"] }
tokio-util = "0.7.9"

[dev-dependencies]
anyhow = { workspace = true }
assert-json-diff = { workspace = true }
assert_matches = { workspace = true }
assert_matches2 = { workspace = true }
dirs = "5.0.1"
futures-executor = { workspace = true }
matrix-sdk-base = { workspace = true, features = ["testing"] }
matrix-sdk-test = { workspace = true }
once_cell = { workspace = true }
serde_urlencoded = "0.7.1"
stream_assert = { workspace = true }
tracing-subscriber = { version = "0.3.11", features = ["env-filter"] }

[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
wasm-bindgen-test = "0.3.33"

[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
tokio = { workspace = true, features = ["rt-multi-thread", "macros"] }
wiremock = "0.5.13"

[[test]]
name = "integration"
required-features = ["testing"]
