@shadowbreaker/cli 0.1.1
The command-line advisory reader for ShadowBreaker. Use shadowbreaker check to look up a maintainer warning without opening the affected site. The command checks the exact hostname against a BNB Smart Chain testnet registry and shows the finalized block behind the result.
How ShadowBreaker works · TypeScript SDK
Install
npm install --global @shadowbreaker/cli@0.1.1
shadowbreaker --version
Requires Node.js 22 or newer. To preview the command without a global install or registry configuration, run npx --package @shadowbreaker/cli@0.1.1 -- shadowbreaker --help.
BSC testnet configuration
Set BSC_REGISTRY_ADDRESS to the address of a deployed ShadowBreaker registry you trust on BSC testnet, chain ID 97. Choose two independently operated HTTPS RPC endpoints with distinct hostnames. Both must return finalized blocks and support canonical block-hash reads.
flowchart LR
RegistryEnv["Registry address from environment"] -. fallback .-> Registry["Registry selection"]
RegistryFlag["Registry flag"] --> Registry
RPCEnv["Both RPCs from environment"] -. fallback .-> RPC["RPC pair selection"]
RPCFlags["Exactly two RPC flags"] --> RPC
Registry --> Check["shadowbreaker check"]
RPC --> Check
Check a hostname
The example uses public endpoints from BNB Chain and PublicNode. Replace swap.example.com with the exact hostname you want to check. You can run the check without a wallet. The CLI accepts a DNS hostname by itself. An enrollment for example.com does not cover swap.example.com. BNB Chain endpoints · PublicNode testnet
export BSC_RPC_URL_PRIMARY=https://bsc-testnet-dataseed.bnbchain.org
export BSC_RPC_URL_SECONDARY=https://bsc-testnet-rpc.publicnode.com
shadowbreaker check swap.example.com
For a one-off check, use flags. --registry overrides BSC_REGISTRY_ADDRESS, and exactly two --rpc flags override the entire environment pair.
shadowbreaker check swap.example.com \
--registry "$BSC_REGISTRY_ADDRESS" \
--rpc "$BSC_RPC_URL_PRIMARY" \
--rpc "$BSC_RPC_URL_SECONDARY" \
--json
How verification works
The SDK picks a finalized block both endpoints can confirm. It reads the same hostname record at that block hash through each endpoint. Verification requires a fresh block and matching records.
flowchart TD
Host["Exact DNS hostname"] --> Pair["Two BSC testnet RPC endpoints"]
Pair --> Block["Match a fresh finalized block"]
Block --> Read["Read the registry at that block hash"]
Read --> Check{"Valid block and matching records?"}
Check -->|Yes| State["Evaluate warning, clearance, expiry, or suspension"]
Check -->|No| Unknown["unconfirmed · exit 2"]
State -->|Current verified state| Result["Report state and evidence · exit 0"]
State -->|Expired warning or suspended publisher| Unknown
Read the state before acting
| State |
What the registry check found |
active |
The enrolled publisher has a current warning. Keep the wallet disconnected. |
cleared |
The enrolled publisher recorded a clearance for a previous warning. |
no_advisory |
The hostname is enrolled and has no published advisory. |
not_enrolled |
The exact hostname has no enrolled publisher in this registry. |
unconfirmed |
The CLI could not verify the record, the warning expired, or the publisher is suspended. Confirm with the operator before connecting. |
An active warning exits 0. The exit code describes the lookup, and state describes the advisory. A registry result alone cannot establish whether a site or transaction is safe.
| Exit code |
Behavior for check |
0 |
A verified registry state on stdout. Inspect state before deciding what to do. |
1 |
Invalid input or configuration. The CLI prints usage on stderr. |
2 |
An unconfirmed result on stdout. If your integration has a previously verified warning, retain it for review. |
Capture evidence in scripts
With --json, a successful or unconfirmed lookup writes one JSON object to stdout. The payload always includes hostname, state, checkedAt, and reason. The publisher, advisory, and chain fields can be null. When present, chain records the network, contract address, finalized block number, hash, and time. advisory.reference is the evidence digest recorded by the publisher.
Example of a verified active warning using fixture data.
{
"hostname": "swap.example.com",
"state": "active",
"checkedAt": "2026-11-26T11:00:00.000Z",
"reason": "The enrolled publisher has an active warning. Keep your wallet disconnected.",
"publisher": "0x2222222222222222222222222222222222222222",
"advisory": {
"revision": "1",
"issuedAt": "2026-11-26T10:55:00.000Z",
"expiresAt": "2026-11-26T12:00:00.000Z",
"reference": "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
},
"chain": {
"id": 97,
"blockNumber": "17564400",
"blockHash": "0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
"blockTimestamp": "2026-11-26T10:59:54.000Z",
"contractAddress": "0x1111111111111111111111111111111111111111"
}
}
This shell script uses jq and captures the result even when the lookup exits 2.
status=0
shadowbreaker check swap.example.com --json > advisory.json || status=$?
case "$status" in
0|2) jq '{hostname, state, reason, chain}' advisory.json ;;
*) exit "$status" ;;
esac
sequenceDiagram
participant Script as Shell script
participant CLI as ShadowBreaker CLI
participant Parser as JSON parser
Script->>CLI: Check one hostname with JSON output
alt Verified or unconfirmed lookup
CLI-->>Script: Stdout contains advisory JSON
Script->>Parser: Read state and chain evidence
else Invalid usage or configuration
CLI-->>Script: Exit 1 and usage on stderr
end
MIT · Package on npm