wsc-cli 0.5.0

CLI tool to sign and verify WebAssembly modules
"""WebAssembly CLI component for signing and verifying WASM modules

This is a WASI-enabled command-line tool that can run hermetically in Wasmtime.
It provides the full wsc functionality including key generation, signing,
verification, signature management, and GitHub public key fetching via wasi:http.

HTTP client selection is automatic based on target:
- Native builds: uses ureq
- WASI builds: uses wasi::http/outgoing-handler
"""

load("@rules_rust//rust:defs.bzl", "rust_binary")

package(default_visibility = ["//visibility:public"])

# Version info - keep in sync with Cargo.toml
# TODO: When version changes in Cargo.toml, update these values
VERSION = "0.2.7"

rust_binary(
    name = "wasmsign_cli",
    srcs = ["main.rs"],
    crate_name = "wsc_cli",
    edition = "2024",
    rustc_env = {
        "CARGO_PKG_VERSION": VERSION,
        "CARGO_PKG_NAME": "wsc-cli",
        "CARGO_PKG_DESCRIPTION": "CLI tool to sign and verify WebAssembly modules",
        "CARGO_PKG_AUTHORS": "Frank Denis <github@pureftpd.org>",
    },
     deps = [
         "//src/lib:wsc",
         "@wsc_deps//:clap",
         "@wsc_deps//:env_logger",
         "@wsc_deps//:regex",
         "@wsc_deps//:serde_json",
         "@wsc_deps//:ureq-3.1.2",
         "@wsc_deps//:wasi",
     ],
    # No feature flags needed - HTTP client selected via #[cfg(target_os = "wasi")]
)

# WASM binary for WASI runtime (Wasmtime, etc.)
# Build this target with: bazel build //src/cli:wasmsign_cli --platforms=@rules_wasm_component//platforms:wasm32-wasip2
# The same rust_binary source works for both native and WASM thanks to #[cfg(target_os = "wasi")]
alias(
    name = "wasmsign_cli_wasm",
    actual = ":wasmsign_cli",
)