hyperlane-plugin-idempotency 23.3.1

A production HTTP Idempotency-Key middleware plugin for the Hyperlane framework featuring XxHash3_64 request fingerprinting (422 mismatch), 64-way sharded bounded InMemoryIdempotencyStore + async IdempotencyStore trait, InFlight concurrent duplicate guard (409 Conflict), and zero-copy cached response replay with Idempotent-Replayed headers.
Documentation
<div align="center">

# hyperlane-plugin-idempotency

**HTTP `Idempotency-Key` Replay & Concurrent Duplicate Guard Plugin**

[![crates.io](https://flat.badgen.net/crates/v/hyperlane-plugin-idempotency)](https://crates.io/crates/hyperlane-plugin-idempotency)
[![docs.rs](https://img.shields.io/docsrs/hyperlane-plugin-idempotency?style=flat-square)](https://docs.rs/hyperlane-plugin-idempotency)
[![Rust 2024](https://img.shields.io/badge/edition-2024-orange.svg?style=flat-square)](https://www.rust-lang.org)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](../../LICENSE)

[Workspace Overview](../../README.md) · [Plugin Catalog](../README.md) · [API Docs](https://docs.rs/hyperlane-plugin-idempotency/latest/)

</div>

---

## Overview

Opt-in request (`-78`) and response (`-60`) middleware enforcing `Idempotency-Key` semantics for HTTP mutation methods (`POST`/`PUT`/`PATCH`/`DELETE`): single-pass `XxHash3_64` `(method, path, body)` request fingerprinting (`422 Unprocessable Entity` on payload mismatch), 64-way sharded bounded `InMemoryIdempotencyStore` plus pluggable async `IdempotencyStore` trait, atomic `InFlight` duplicate locking (`409 Conflict`) with RAII panic/drop cleanup, and zero-copy prebuilt response replay stamped with `Idempotent-Replayed: true`.

This crate is a member of the [`hyperlane`](../../README.md) unified Rust 2024 workspace. All plugin crates are opt-in and transparent (`Status::Continue`) when unconfigured.

## Responsibilities & Module Layout

- `struct` / `enum` / `trait` / `impl` — `IdempotencyConfig`, `IdempotencyStore`, `InMemoryIdempotencyStore`, `StoredIdempotentResponse`, `IdempotencyPlugin`, `IdempotencyRequestHook` (`-78`), and `IdempotencyResponseHook` (`-60`)
- `fn` — Zero-allocation `XxHash3_64` request fingerprinting, shard hashing, and wire replay construction

## Installation

```sh
cargo add hyperlane-plugin-idempotency
```

## Verification

Run crate-scoped formatting, lint, and test gates from the workspace root:

```sh
cargo run -p hyperlane-cli -- fmt --check
cargo clippy -p hyperlane-plugin-idempotency --all-features --all-targets -- -D warnings
cargo test -p hyperlane-plugin-idempotency --all-features
```

## Documentation & Governance

- Project standards and release workflows live in [`../../.agents/skills/hyperlane/SKILL.md`](../../.agents/skills/hyperlane/SKILL.md).

## License

This project is licensed under the MIT License. See the [LICENSE](../../LICENSE) file for details.

## Contact

For inquiries, please contact the author at [root@devhub.vip](mailto:root@devhub.vip).