[package]
name = "kbs"
version.workspace = true
authors.workspace = true
description.workspace = true
documentation.workspace = true
edition.workspace = true

[features]
default = ["coco-as-builtin", "coco-as-grpc"]

# Support a backend attestation service for KBS
as = []

# Use CoCo-AS as backend attestation service
coco-as = ["as"]

# Use built-in CoCo-AS as backend attestation service
coco-as-builtin = ["coco-as", "attestation-service/default"]

# Use built-in CoCo-AS as backend attestation service without verifier
coco-as-builtin-no-verifier = ["coco-as"]

# Use remote gRPC CoCo-AS as backend attestation service
coco-as-grpc = ["coco-as", "mobc", "tonic", "tonic-build", "prost"]

# Use aliyun KMS as KBS backend
aliyun = ["confidential-data-hub/aliyun"]

# Use pkcs11 plugin
pkcs11 = ["cryptoki"]

# Use Nebula Certificate Authority plugin to provide CA services to nodes
# that want to join a Nebula overlay network
nebula-ca-plugin = []

# Use TPM CA plugin to provide CA services to EK/AIK of TPM instance
tpm-pca = []

[dependencies]
actix = "0.13.5"
actix-web = { workspace = true, features = ["openssl"] }
actix-web-httpauth.workspace = true
aes-gcm = "0.10.1"
anyhow.workspace = true
async-trait.workspace = true
base64.workspace = true
cfg-if.workspace = true
clap = { workspace = true, features = ["derive", "env"] }
config.workspace = true
cryptoki = { version = "0.8.0", optional = true }
env_logger.workspace = true
jsonwebtoken = { workspace = true, default-features = false }
jwt-simple.workspace = true
kbs-types.workspace = true
confidential-data-hub = { workspace = true, default-features = false }
lazy_static = "1.4.0"
log.workspace = true
mobc = { version = "0.8.3", optional = true }
prost = { workspace = true, optional = true }
rand = "0.8.5"
regex = "1.11.1"
regorus.workspace = true
reqwest = { workspace = true, features = ["json"] }
rsa = { version = "0.9.2", features = ["sha2"] }
scc = "2"
serde_qs.workspace = true
semver = "1.0.16"
serde = { workspace = true, features = ["derive"] }
serde_json.workspace = true
strum.workspace = true
tempfile.workspace = true
thiserror.workspace = true
time = { version = "0.3.23", features = ["std"] }
tokio.workspace = true
tonic = { workspace = true, optional = true }
uuid = { version = "1.2.2", features = ["serde", "v4"] }
openssl.workspace = true
derivative = "2.2.0"

[target.'cfg(not(any(target_arch = "s390x", target_arch = "aarch64")))'.dependencies]
attestation-service = { path = "../attestation-service", default-features = false, features = [
    "all-verifier",
], optional = true }

[target.'cfg(target_arch = "s390x")'.dependencies]
attestation-service = { path = "../attestation-service", default-features = false, features = [
    "se-verifier",
], optional = true }

[target.'cfg(target_arch = "aarch64")'.dependencies]
attestation-service = { path = "../attestation-service", default-features = false, features = [
    "cca-verifier",
], optional = true }


[dev-dependencies]
rstest.workspace = true
reference-value-provider-service.path = "../rvps"
serial_test = "3.0"

[build-dependencies]
tonic-build = { workspace = true, optional = true }
