[package]
name = "cdk"
version.workspace = true
edition.workspace = true
authors = ["CDK Developers"]
description = "Core Cashu Development Kit library implementing the Cashu protocol"
homepage = "https://github.com/cashubtc/cdk"
repository = "https://github.com/cashubtc/cdk.git"
rust-version.workspace = true                                                            # MSRV
license.workspace = true


[features]
default = ["mint", "wallet", "auth", "nostr", "bip353"]
wallet = ["dep:futures", "dep:reqwest", "cdk-common/wallet", "dep:rustls"]
nostr = ["wallet", "dep:nostr-sdk", "cdk-common/nostr"]
npubcash = ["wallet", "nostr", "dep:cdk-npubcash"]
mint = ["dep:futures", "dep:reqwest", "cdk-common/mint", "cdk-signatory"]
auth = ["dep:jsonwebtoken", "cdk-common/auth", "cdk-common/auth"]
bip353 = ["dep:hickory-resolver"]
# We do not commit to a MSRV with swagger enabled
swagger = ["mint", "dep:utoipa", "cdk-common/swagger"]
bench = []
http_subscription = []
tor = [
    "wallet",
    "dep:arti-client",
    "dep:arti-hyper",
    "dep:hyper",
    "dep:http",
    "dep:rustls",
    "dep:tor-rtcompat",
    "dep:tls-api",
    "dep:tls-api-native-tls",
]
prometheus = ["dep:cdk-prometheus"]

[dependencies]
arc-swap = "1.7.1"
cdk-common.workspace = true
cbor-diag.workspace = true
async-trait.workspace = true
anyhow.workspace = true
bitcoin.workspace = true
ciborium.workspace = true
lightning.workspace = true
lightning-invoice.workspace = true
regex.workspace = true
reqwest = { workspace = true, optional = true }
serde.workspace = true
serde_json.workspace = true
serde_with.workspace = true
tracing.workspace = true
thiserror.workspace = true

futures = { workspace = true, optional = true, features = ["alloc"] }
url.workspace = true
utoipa = { workspace = true, optional = true }
uuid.workspace = true
jsonwebtoken = { workspace = true, optional = true }
nostr-sdk = { workspace = true, optional = true }
cdk-npubcash = { workspace = true, optional = true }
cdk-prometheus = {workspace = true, optional = true}
web-time.workspace = true
zeroize = "1"
tokio-util.workspace = true

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
hickory-resolver = { version = "0.25.2", optional = true, features = ["dnssec-ring"] }
tokio = { workspace = true, features = [
    "rt-multi-thread",
    "time",
    "macros",
    "sync",
] }
getrandom = { version = "0.2" }
cdk-signatory = { workspace = true, features = ["grpc"], optional = true }
tokio-tungstenite = { workspace = true, features = [
    "rustls",
    "rustls-tls-native-roots",
    "connect"
] }
# Tor dependencies (optional; enabled by feature "tor")
hyper = { version = "0.14", optional = true, features = ["client", "http1", "http2"] }
http = { version = "0.2", optional = true }
arti-client = { version = "0.19.0", optional = true, default-features = false, features = ["tokio", "rustls"] }
arti-hyper = { version = "0.19.0", optional = true }
rustls = { workspace = true, optional = true }
tor-rtcompat = { version = "0.19.0", optional = true, features = ["tokio", "rustls"] }
tls-api = { version = "0.9", optional = true }
tls-api-native-tls = { version = "0.9", optional = true }

[target.'cfg(target_arch = "wasm32")'.dependencies]
tokio = { workspace = true, features = ["rt", "macros", "sync", "time"] }
cdk-signatory = { workspace = true, default-features = false }
getrandom = { version = "0.2", features = ["js"] }
ring = { version = "0.17.14", features = ["wasm32_unknown_unknown_js"] }
rustls = { workspace = true, optional = true }

uuid = { workspace = true, features = ["js"] }
gloo-timers = { version = "0.3", features = ["futures"] }

[[example]]
name = "mint-token"
required-features = ["wallet"]

[[example]]
name = "melt-token"
required-features = ["wallet"]

[[example]]
name = "p2pk"
required-features = ["wallet"]

[[example]]
name = "wallet"
required-features = ["wallet"]

[[example]]
name = "proof-selection"
required-features = ["wallet"]

[[example]]
name = "auth_wallet"
required-features = ["wallet", "auth"]

[[example]]
name = "bip353"
required-features = ["wallet", "bip353"]

[[example]]
name = "mint-token-bolt12-with-stream"
required-features = ["wallet"]

[[example]]
name = "mint-token-bolt12-with-custom-http"
required-features = ["wallet"]

[[example]]
name = "mint-token-bolt12"
required-features = ["wallet"]

[[example]]
name = "human_readable_payment"
required-features = ["wallet", "bip353"]

[[example]]
name = "payment_request"
required-features = ["wallet", "nostr"]

[[example]]
name = "nostr_backup"
required-features = ["wallet", "nostr"]

[[example]]
name = "token-proofs"
required-features = ["wallet"]

[[example]]
name = "npubcash"
required-features = ["npubcash"]

[[example]]
name = "multimint-npubcash"
required-features = ["npubcash"]

[[example]]
name = "configure_wallet"
required-features = ["wallet"]

[dev-dependencies]
rand.workspace = true
cdk-sqlite.workspace = true
cdk-fake-wallet.workspace = true
bip39.workspace = true
tracing-subscriber.workspace = true
criterion.workspace = true
reqwest = { workspace = true }
anyhow.workspace = true
ureq = { version = "3.1.0", features = ["json"] }
tokio = { workspace = true, features = ["full"] }


[[bench]]
name = "dhke_benchmarks"
harness = false

[lints]
workspace = true
