-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.justfile
More file actions
188 lines (149 loc) · 5.51 KB
/
.justfile
File metadata and controls
188 lines (149 loc) · 5.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# List all the available commands
default:
just --list
# =============================================================================
# Formatting
# =============================================================================
# Fix Rust formatting
[group('format')]
fmt:
cargo fmt --all
# Fix TOML formatting with `taplo`
[group('format')]
toml-fmt:
taplo format
# Check Rust formatting
[group('format')]
check-fmt:
cargo fmt --all --check
# Check TOML formatting with `taplo`
[group('format')]
toml-check-fmt:
taplo format --check
# =============================================================================
# Linting
# =============================================================================
# Rust `clippy` lints (excludes WASM crate which needs wasm32 target)
[group('lint')]
clippy:
RUSTFLAGS="-D warnings" cargo clippy --workspace --exclude yubikey-evm-signer-wasm --examples --tests --benches --all-features --all-targets --locked
# Rust `clippy` lints for WASM crate (requires wasm32 target)
[group('lint')]
clippy-wasm:
RUSTFLAGS="-D warnings --cfg=web_sys_unstable_apis" cargo clippy -p yubikey-evm-signer-wasm --target wasm32-unknown-unknown --all-features --locked
# TOML lint with `taplo`
[group('lint')]
toml-lint:
taplo lint
# Run all lints and formatting checks
[group('lint')]
lints: toml-check-fmt toml-lint check-fmt clippy clippy-wasm
# =============================================================================
# Testing
# =============================================================================
# Rust unit tests with `cargo-nextest`
[group('test')]
unit-test:
cargo --locked nextest run --all-features --workspace
# Rust documentation tests
[group('test')]
doctest:
cargo test --doc --all-features --workspace
# Rust all tests
[group('test')]
test: unit-test doctest
# =============================================================================
# Publishing
# =============================================================================
# Publish crate to crates.io
[group('publish')]
publish:
cargo publish --token $CARGO_REGISTRY_TOKEN
# Publish NPM package (requires npm login)
[group('publish')]
npm-publish: wasm-build-release
cd packages/npm && npm publish --access public
# =============================================================================
# Security
# =============================================================================
# Check supply chain security analsis with `cargo-audit`
[group('security')]
audit:
cargo audit
# Check GitHub Actions security analysis with `zizmor`
[group('security')]
check-github-actions-security:
zizmor .
# =============================================================================
# WASM Build
# =============================================================================
# Build WASM package
[group('wasm')]
wasm-build:
wasm-pack build crates/signer-wasm --target web --no-opt --out-dir ../../packages/npm/dist --out-name yubikey_evm_signer_wasm
# Build WASM package in release mode
[group('wasm')]
wasm-build-release:
wasm-pack build crates/signer-wasm --target web --release --no-opt --out-dir ../../packages/npm/dist --out-name yubikey_evm_signer_wasm
# Clean WASM build artifacts
[group('wasm')]
wasm-clean:
rm -rf packages/npm/dist
# Rebuild WASM package from scratch
[group('wasm')]
wasm-rebuild: wasm-clean wasm-build
# =============================================================================
# Demo
# =============================================================================
# Build WASM for demo site
[group('demo')]
demo-build:
wasm-pack build crates/signer-wasm --target web --release --no-opt --out-dir ../../demo/wasm --out-name yubikey_evm_signer_wasm
# Clean demo WASM artifacts
[group('demo')]
demo-clean:
rm -rf demo/wasm
# Serve demo site locally (requires Python 3)
[group('demo')]
demo-serve:
@echo "Starting local server at http://localhost:8000"
@echo "Note: WebUSB requires HTTPS in production, but localhost is exempt"
python3 -m http.server 8000 --directory demo
# Build and serve demo site locally
[group('demo')]
demo: demo-build demo-serve
# =============================================================================
# Native CLI (requires YubiKey and PC/SC - works on macOS/Linux/Windows)
# =============================================================================
# Build CLI example with PCSC support
[group('cli')]
cli-build:
cargo build --example yubikey-cli -p yubikey-evm-signer-core --features pcsc
# List available YubiKey devices
[group('cli')]
cli-list:
cargo run --example yubikey-cli -p yubikey-evm-signer-core --features pcsc -- list
# Show YubiKey connection info
[group('cli')]
cli-info:
cargo run --example yubikey-cli -p yubikey-evm-signer-core --features pcsc -- info
# Get Ethereum address from slot 9a
[group('cli')]
cli-address:
cargo run --example yubikey-cli -p yubikey-evm-signer-core --features pcsc -- address
# Generate a new P-256 key in slot 9a (requires PIN, overwrites existing key!)
[group('cli')]
cli-generate:
cargo run --example yubikey-cli -p yubikey-evm-signer-core --features pcsc -- generate
# Sign a sample EIP-1559 transaction (requires PIN)
[group('cli')]
cli-sign-tx:
cargo run --example yubikey-cli -p yubikey-evm-signer-core --features pcsc -- sign-tx
# Sign a custom 32-byte hash (requires PIN)
[group('cli')]
cli-sign hash:
cargo run --example yubikey-cli -p yubikey-evm-signer-core --features pcsc -- sign {{hash}}
# Show CLI help
[group('cli')]
cli-help:
cargo run --example yubikey-cli -p yubikey-evm-signer-core --features pcsc -- --help