[package]
name = "bwx-cli"
version = "2.1.0"
authors = ["Drew Carlson <its@drews.website>", "Jesse Luehrs <doy@tozt.net>"]
edition = "2021"
rust-version = "1.82.0"

description = "Unofficial Bitwarden CLI with first-class macOS support"
repository = "https://github.com/drewcarlson/bwx-cli"
readme = "README.md"
keywords = ["bitwarden"]
categories = ["command-line-utilities", "cryptography"]
license = "MIT"
include = ["src/**/*", "bin/**/*", "LICENSE", "README.md", "CHANGELOG.md"]

[lib]
name = "bwx"
path = "src/lib.rs"

[[bin]]
name = "bwx"
path = "src/bin/bwx/main.rs"

[[bin]]
name = "bwx-agent"
path = "src/bin/bwx-agent/main.rs"

[dependencies]
aes = "0.8.4"
argon2 = "0.5.3"
base64 = "0.22.1"
cbc = { version = "0.1.2", features = ["alloc", "std"] }
clap_complete = "4.5.62"
clap = { version = "4.5.53", features = ["wrap_help", "derive"] }
futures-util = "0.3.31"
hmac = { version = "0.12.1", features = ["std"] }
libc = "0.2.178"
log = "0.4.29"
open = { version = "5.3.3", optional = true }
pbkdf2 = "0.12.2"
pkcs8 = "0.10.2"
# TODO: necessary because some packages still depend on old rand
rand_8 = { package = "rand", version = "0.8.5" }
rand = "0.9.2"
regex = "1.12.2"
reqwest = { version = "0.12.28", default-features = false, features = [
    "blocking",
    "json",
    "rustls-tls-native-roots",
] }
rmpv = "1.3.0"
rsa = "0.9.9"
rustix = { version = "1.1.3", features = [
    "termios",
    "process",
    "pipe",
    "mm",
] }
serde_json = "1.0.147"
serde = { version = "1.0.228", features = ["derive"] }
sha1 = "0.10.6"
sha2 = "0.10.9"
signature = "2.2.0"
ssh-agent-lib = "0.5.1"
tempfile = "3.24.0"
thiserror = "2.0.17"
tokio-stream = { version = "0.1.17", features = ["net"] }
tokio-tungstenite = { version = "0.28", features = [
    "rustls-tls-native-roots",
    "url",
] }
tokio = { version = "1.48.0", features = [
    "macros",
    "rt-multi-thread",
    "sync",
    "net",
    "fs",
    "time",
    "io-util",
    "process",
    "signal",
] }
url = "2.5.7"
urlencoding = "2.1.3"
zeroize = "1.8.2"

arboard = { version = "3.6.1", default-features = false, features = [
    "wayland-data-control",
], optional = true }

# Integration tests (`tests/e2e.rs`) only use crates already present in
# `[dependencies]`. The entries below exist so the test binary links
# against them explicitly rather than relying on transitive re-exports
# from the `bwx` library crate.
[dev-dependencies]
tempfile = "3.24.0"
reqwest = { version = "0.12.28", default-features = false, features = [
    "blocking",
    "json",
    "rustls-tls-native-roots",
] }
rsa = "0.9.9"
# `rsa` 0.9 pulls in rand_core 0.6, which is compatible with the older
# `rand` 0.8 shim kept in the main dep tree as `rand_8`. Re-declared
# here so the test binary links against it without relying on
# transitive resolve.
rand_8 = { package = "rand", version = "0.8.5" }
base64 = "0.22.1"
serde_json = "1.0.147"

[target.'cfg(target_os = "macos")'.dependencies]
objc2 = "0.6"
objc2-foundation = { version = "0.3", features = ["NSError", "NSString"] }
objc2-local-authentication = { version = "0.3", features = [
    "LAContext",
    "block2",
] }
block2 = "0.6"
core-foundation = "0.10"
core-foundation-sys = "0.8"
security-framework = "3"
security-framework-sys = { version = "2", features = ["OSX_10_13"] }

[features]
default = ["clipboard", "sso-browser"]
clipboard = ["arboard"]
sso-browser = ["open"]

[lints.clippy]
cargo = { level = "warn", priority = -1 }
pedantic = { level = "warn", priority = -1 }
nursery = { level = "warn", priority = -1 }
as_conversions = "warn"
get_unwrap = "warn"
cognitive_complexity = "allow"
missing_const_for_fn = "allow"
similar_names = "allow"
struct_excessive_bools = "allow"
fn_params_excessive_bools = "allow"
too_many_arguments = "allow"
too_many_lines = "allow"
type_complexity = "allow"
multiple_crate_versions = "allow"
large_enum_variant = "allow"
must_use_candidate = "allow"
missing_errors_doc = "allow"
missing_panics_doc = "allow"
significant_drop_tightening = "allow"
struct_field_names = "allow"

[package.metadata.deb]
depends = "pinentry"
license-file = ["LICENSE"]
assets = [
    [
        "target/release/bwx",
        "usr/bin/",
        "755",
    ],
    [
        "target/release/bwx-agent",
        "usr/bin/",
        "755",
    ],
    [
        "target/release/completion/bash",
        "usr/share/bash-completion/completions/bwx",
        "644",
    ],
    [
        "target/release/completion/zsh",
        "usr/share/zsh/vendor-completions/_bwx",
        "644",
    ],
    [
        "target/release/completion/fish",
        "usr/share/fish/completions/bwx.fish",
        "644",
    ],
    [
        "README.md",
        "usr/share/doc/bwx/README",
        "644",
    ],
]

# `cargo generate-rpm` reads this section. Mirrors the deb layout so
# `dnf install ./bwx-cli-*.rpm` lands the same files as the Debian
# package. `pinentry` is the Fedora package name as well.
[package.metadata.generate-rpm]
license = "MIT"
requires = { pinentry = "*" }
assets = [
    { source = "target/release/bwx",       dest = "/usr/bin/bwx",       mode = "755" },
    { source = "target/release/bwx-agent", dest = "/usr/bin/bwx-agent", mode = "755" },
    { source = "target/release/completion/bash", dest = "/usr/share/bash-completion/completions/bwx",     mode = "644" },
    { source = "target/release/completion/zsh",  dest = "/usr/share/zsh/site-functions/_bwx",             mode = "644" },
    { source = "target/release/completion/fish", dest = "/usr/share/fish/vendor_completions.d/bwx.fish",  mode = "644" },
    { source = "LICENSE",   dest = "/usr/share/licenses/bwx-cli/LICENSE", mode = "644", doc = true },
    { source = "README.md", dest = "/usr/share/doc/bwx-cli/README.md",    mode = "644", doc = true },
]
