Rust and WASM did-method-plc tools and structures
1[package]
2name = "atproto-plc"
3version = "0.2.0"
4authors = ["Nick Gerakines <nick.gerakines@gmail.com>"]
5edition = "2024"
6rust-version = "1.90.0"
7license = "MIT OR Apache-2.0"
8description = "did-method-plc implementation for ATProto with WASM support"
9repository = "https://tangled.org/@smokesignal.events/atproto-plc"
10keywords = ["atprotocol", "did", "did-method-plc", "wasm"]
11categories = ["cryptography", "web-programming", "wasm"]
12
13[package.metadata.wasm-pack.profile.release]
14wasm-opt = ["-O", "--enable-bulk-memory"]
15
16[lib]
17crate-type = ["cdylib", "rlib"]
18
19[dependencies]
20# Cryptographic dependencies
21p256 = { version = "0.13", features = ["ecdsa", "std"] }
22k256 = { version = "0.13", features = ["ecdsa", "sha256", "std"] }
23sha2 = "0.10"
24signature = "2.2"
25rand = "0.8"
26
27# Encoding dependencies
28base64 = "0.22"
29data-encoding = "2.5"
30bs58 = "0.5"
31
32# Serialization
33serde = { version = "1.0", features = ["derive"] }
34serde_json = "1.0"
35serde_bytes = "0.11"
36
37# DAG-CBOR support
38ipld-core = "0.4"
39serde_ipld_dagcbor = "0.6"
40cid = "0.11"
41multihash = "0.19"
42
43# Error handling
44thiserror = "2.0"
45anyhow = "1.0"
46
47# Utilities
48chrono = { version = "0.4", features = ["serde"] }
49zeroize = { version = "1.7", features = ["derive"] }
50subtle = "2.5"
51
52# Optional: async support
53async-trait = { version = "0.1", optional = true }
54tokio = { version = "1.35", optional = true, features = ["macros", "rt-multi-thread"] }
55
56# Binary dependencies (for plc-audit)
57reqwest = { version = "0.12", features = ["json", "blocking"], optional = true }
58clap = { version = "4.5", features = ["derive"], optional = true }
59
60[target.'cfg(target_arch = "wasm32")'.dependencies]
61# getrandom is a transitive dependency of rand, and needs "js" feature for wasm32
62getrandom = { version = "0.2", features = ["js"]}
63# Optional WASM-specific dependencies
64wasm-bindgen = { version = "0.2", features = ["serde-serialize"], optional = true }
65wasm-bindgen-futures = { version = "0.4", optional = true }
66serde-wasm-bindgen = { version = "0.6", optional = true }
67web-sys = { version = "0.3", features = ["console"], optional = true }
68js-sys = { version = "0.3", optional = true }
69
70[dev-dependencies]
71hex = "0.4"
72pretty_assertions = "1.4"
73criterion = { version = "0.7", features = ["html_reports"] }
74proptest = "1.4"
75
76[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
77wasm-bindgen-test = "0.3"
78
79[features]
80default = []
81wasm = ["wasm-bindgen", "wasm-bindgen-futures", "serde-wasm-bindgen", "web-sys", "js-sys"]
82async = ["async-trait", "tokio"]
83cli = ["reqwest", "clap"]
84
85[[bin]]
86name = "plc-audit"
87path = "src/bin/plc-audit.rs"
88required-features = ["cli"]
89
90[[bin]]
91name = "plc-fork-viz"
92path = "src/bin/plc-fork-viz.rs"
93required-features = ["cli"]
94
95[profile.release]
96opt-level = "z" # Optimize for size
97lto = true # Enable Link Time Optimization
98codegen-units = 1 # Single codegen unit for better optimization
99strip = true # Strip symbols
100panic = "abort" # Smaller panic handler
101
102[profile.wasm]
103inherits = "release"
104opt-level = "z"
105lto = "fat"
106
107[[bench]]
108name = "validation"
109harness = false