> ## Documentation Index
> Fetch the complete documentation index at: https://yieldxyz.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Shield integration

> Run Shield as a TypeScript library, a standalone binary from any language, or server-side via Defense Mode.

Shield runs wherever your signing flow lives. Pick the path that matches your stack: the TypeScript library for Node.js and browser integrations, the standalone binary for every other language and for restricted environments, or server-side enforcement inside the Yield API via Defense Mode.

## Choosing an integration path

| Path | How it runs | Recommended for |
| - | - | - |
| **TypeScript library** | `@yieldxyz/shield` npm package, in-process | Wallets, web apps, Node.js backends, hosted widget integrations |
| **Standalone binary** | Pre-built executable, JSON over stdin/stdout, callable from any language | Go/Python/Rust backends, exchanges, custodians, secure or air-gapped environments |
| **Defense Mode (server-side)** | Shield embedded in the Yield API's transaction pipeline, in Monitor or Block mode | Any integration: it requires no client-side changes |

These paths are complementary, not exclusive. Defense Mode validates transactions inside the API; client-side Shield validates them again after they reach you. Running both gives you two independent checkpoints. See [Security deployment options](/documentation/platform/shield/security-tiers) for how to combine them.

## TypeScript library

```bash theme={null}
npm install @yieldxyz/shield
```

Instantiate `Shield` and call `validate()` on every transaction before signing. The [Shield overview](/documentation/platform/shield) walks through the full quick start and API reference.

## Standalone binary

The binary embeds the full validator set and vault registry, requires no Node.js installation, and accepts JSON on stdin. Download the build for your platform from the [latest release](https://github.com/stakekit/shield/releases/latest):

| Platform | Binary |
| - | - |
| Linux x64 | `shield-linux-x64` |
| macOS ARM (Apple Silicon) | `shield-darwin-arm64` |
| macOS Intel | `shield-darwin-x64` |
| Windows x64 | `shield-windows-x64.exe` |

<Steps>
  <Step title="Download the binary">
    ```bash theme={null}
    curl -LO https://github.com/stakekit/shield/releases/latest/download/shield-darwin-arm64
    chmod +x shield-darwin-arm64
    ```
  </Step>

  <Step title="Verify integrity">
    ```bash theme={null}
    curl -LO https://github.com/stakekit/shield/releases/latest/download/shield-darwin-arm64.sha256
    shasum -a 256 -c shield-darwin-arm64.sha256  # Expected output: OK
    ```

    Every release also includes [GitHub artifact attestations](https://docs.github.com/en/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds): cryptographic proof that each binary was built by the Shield CI pipeline and not modified after the fact. Verify with the GitHub CLI:

    ```bash theme={null}
    gh attestation verify shield-darwin-arm64 --repo stakekit/shield
    ```
  </Step>

  <Step title="Send a validation request">
    Every request requires `apiVersion` and an `operation` field (`validate`, `isSupported`, or `getSupportedYieldIds`):

    ```bash theme={null}
    echo '{
      "apiVersion": "1.0",
      "operation": "validate",
      "unsignedTransaction": "0x...",
      "yieldId": "ethereum-eth-lido-staking",
      "userAddress": "0x..."
    }' | ./shield-darwin-arm64
    ```

    ```json Response theme={null}
    {
      "ok": true,
      "apiVersion": "1.0",
      "result": {
        "isValid": true,
        "detectedType": "STAKE"
      },
      "meta": {
        "requestHash": "a3f2c1..."
      }
    }
    ```
  </Step>
</Steps>

<Note>
  **Library vs binary response shapes.** The TypeScript library (`shield.validate()`) returns the unwrapped `result` object directly. The binary protocol wraps it in `{ ok, apiVersion, result, meta }` so non-TypeScript integrations can correlate requests via `meta.requestHash` and handle protocol-level errors separately from validation failures.
</Note>

### Language guides

Call the binary as a subprocess from your language of choice. Full worked examples live in the Shield repository:

* [Go integration guide](https://github.com/stakekit/shield/blob/main/docs/integration-go.md)
* [Python integration guide](https://github.com/stakekit/shield/blob/main/docs/integration-python.md)
* [Rust integration guide](https://github.com/stakekit/shield/blob/main/docs/integration-rust.md)

### Restricted and on-premises environments

Because the binary is self-contained and validation is fully local (the embedded vault registry means no network calls), you can run Shield inside your own infrastructure: compiled backends, locked-down hosts, or air-gapped signing environments. Institutional partners with requirements beyond the standalone binary, such as dedicated deployments with custom policy control, should [contact the yield.xyz team](mailto:hello@yield.xyz) to scope a setup.

## Server-side enforcement: Defense Mode

Shield also runs inside the Yield API itself, validating every constructed transaction before it is returned. It runs in Monitor mode (validate and log) by default; in Block mode, enabled per project, transactions that fail validation are rejected server-side.

This path requires no code changes on your end. See [Defense Mode](/documentation/platform/shield/defense-mode) for the modes and threat model.

## Redundancy and failover

* **Client-side independence**: because the Shield library and binary validate locally with an embedded registry, client-side validation keeps working even during an upstream outage.

## Next steps

<CardGroup cols={2}>
  <Card title="Shield overview" icon="shield-check" href="/documentation/platform/shield">
    Quick start and API reference
  </Card>

  <Card title="Defense Mode" icon="shield-halved" href="/documentation/platform/shield/defense-mode">
    Server-side enforcement, rollout, and rollback
  </Card>

  <Card title="Shield features" icon="list-check" href="/documentation/platform/shield/features">
    Coverage matrix and validation errors
  </Card>

  <Card title="Security deployment options" icon="layer-group" href="/documentation/platform/shield/security-tiers">
    Combine client-side and server-side enforcement
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.