[package]
authors = ["Damir Jelić <poljar@termina.org.uk>"]
description = "A high level Matrix client-server library."
edition = "2024"
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.16.0"

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

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

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

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

qrcode = ["e2e-encryption", "matrix-sdk-base/qrcode"]
automatic-room-key-forwarding = ["e2e-encryption", "matrix-sdk-base/automatic-room-key-forwarding"]
experimental-send-custom-to-device = ["e2e-encryption", "matrix-sdk-base/experimental-send-custom-to-device"]

# Enable experimental support for encrypting state events; see
# https://github.com/matrix-org/matrix-rust-sdk/issues/5397.
experimental-encrypted-state-events = [
    "e2e-encryption",
    "matrix-sdk-base/experimental-encrypted-state-events",
    "matrix-sdk-sqlite/experimental-encrypted-state-events",
    "matrix-sdk-test?/experimental-encrypted-state-events",
]

experimental-push-secrets = [
    "e2e-encryption",
    "matrix-sdk-base/experimental-push-secrets",
    "matrix-sdk-sqlite?/experimental-push-secrets",
    "matrix-sdk-indexeddb?/experimental-push-secrets",
    "ruma/unstable-msc4385",
]

markdown = ["ruma/markdown"]
socks = ["reqwest/socks"]
local-server = ["dep:axum", "dep:rand", "dep:tower"]
sso-login = ["local-server"]
# Enable methods that make calls to the federation API.
federation-api = ["ruma/federation-api-c"]

uniffi = ["dep:uniffi", "matrix-sdk-base/uniffi", "dep:matrix-sdk-ffi-macros"]

experimental-widgets = ["dep:uuid", "experimental-send-custom-to-device"]

docsrs = ["e2e-encryption", "sqlite", "indexeddb", "sso-login", "qrcode", "federation-api"]

# Add support for inline media galleries via msgtypes
unstable-msc4274 = ["ruma/unstable-msc4274", "matrix-sdk-base/unstable-msc4274"]

experimental-search = ["matrix-sdk-search"]

experimental-element-recent-emojis = ["matrix-sdk-base/experimental-element-recent-emojis"]

[dependencies]
anyhow = { workspace = true, optional = true }
anymap2 = { version = "0.13.0", default-features = false }
aquamarine.workspace = true
as_variant.workspace = true
assert_matches2 = { workspace = true, optional = true }
async-channel = "2.5.0"
async-stream.workspace = true
async-trait.workspace = true
async-once-cell.workspace = true
axum = { version = "0.8.4", optional = true }
bytes = { version = "1.11.1", default-features = false, features = ["std"] }
bytesize = { version = "2.3.0", default-features = false, features = ["std"] }
cfg-if.workspace = true
event-listener = "5.4.1"
eyeball.workspace = true
eyeball-im.workspace = true
eyre = { version = "0.6.12", optional = true }
futures-core.workspace = true
futures-util = { workspace = true, features = ["async-await-macro"] }
http.workspace = true
imbl = { workspace = true, features = ["serde"] }
indexmap.workspace = true
itertools.workspace = true
js_int = "0.2.2"
language-tags = { version = "0.3.2" }
matrix-sdk-base.workspace = true
matrix-sdk-common.workspace = true
matrix-sdk-ffi-macros = { workspace = true, optional = true }
matrix-sdk-indexeddb = { workspace = true, optional = true }
matrix-sdk-search = { workspace = true, optional = true }
matrix-sdk-sqlite = { workspace = true, optional = true }
matrix-sdk-test = { workspace = true, optional = true }
mime.workspace = true
mime2ext = "0.1.54"
oauth2.workspace = true
oauth2-reqwest.workspace = true
percent-encoding = "2.3.2"
pin-project-lite.workspace = true
rand = { workspace = true, optional = true }
ruma = { workspace = true, features = [
    "rand",
    "unstable-msc2448",
    "unstable-msc3930",
    "unstable-msc3245-v1-compat",
    "unstable-msc4108",
    "unstable-msc4278",
] }
serde.workspace = true
serde_html_form.workspace = true
serde_json.workspace = true
sha2.workspace = true
tempfile.workspace = true
thiserror.workspace = true
tokio-stream = { workspace = true, features = ["sync"] }
tokio-util = "0.7.17"
tower = { version = "0.5.2", features = ["util"], optional = true }
tracing = { workspace = true, features = ["attributes"] }
uniffi = { workspace = true, optional = true }
url = { workspace = true, features = ["serde"] }
urlencoding = "2.1.3"
uuid = { workspace = true, features = ["serde", "v4"], optional = true }
vodozemac.workspace = true
zeroize.workspace = true

[target.'cfg(not(target_family = "wasm"))'.dependencies]
backon = "1.6.0"
# 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 = { workspace = true, features = ["stream", "gzip", "http2", "rustls"] }
tokio = { workspace = true, features = ["fs", "rt", "macros"] }
wiremock = { workspace = true, optional = true }

[target.'cfg(target_family = "wasm")'.dependencies]
gloo-timers = { workspace = true, features = ["futures"] }
reqwest = { workspace = true, features = ["gzip", "http2", "rustls"] }
tokio = { workspace = true, features = ["macros"] }

[dev-dependencies]
anyhow.workspace = true
assert-json-diff.workspace = true
assert_matches.workspace = true
assert_matches2.workspace = true
dirs = "6.0.0"
futures-executor.workspace = true
insta.workspace = true
matrix-sdk-base = { workspace = true, features = ["testing"] }
matrix-sdk-test.workspace = true
matrix-sdk-test-utils.workspace = true
serde_urlencoded = "0.7.1"
similar-asserts.workspace = true
stream_assert.workspace = true
tokio-test = "0.4.4"
tracing-subscriber = { workspace = true, features = ["env-filter"] }

[target.'cfg(not(target_family = "wasm"))'.dev-dependencies]
ctor = "0.2.9"
proptest.workspace = true
tokio = { workspace = true, features = ["rt-multi-thread", "macros"] }
wiremock.workspace = true

[target.'cfg(target_family = "wasm")'.dev-dependencies]
wasm-bindgen-test.workspace = true

[target.'cfg(target_os = "android")'.dependencies]
rustls = "0.23.38"
rustls-pki-types = "1.14.0"
rustls-native-certs = "0.8.3"
webpki-roots = "1.0.6"

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

[lints]
workspace = true
