ASGI middleware for XRPL-backed MPP HTTP payments
Project description
xrpl-mpp-middleware
ASGI middleware for XRPL-backed MPP HTTP payments.
Install
pip install xrpl-mpp-middleware
Main APIs
PaymentMiddlewareASGIrequire_payment(...)require_session(...)XRPLFacilitatorClient
The middleware emits MPP challenges, validates paid retries through the facilitator, injects request.state.mpp_payment, and adds Payment-Receipt on success.
Example
from fastapi import FastAPI
from xrpl_mpp_middleware import PaymentMiddlewareASGI, require_payment
app = FastAPI()
app.add_middleware(
PaymentMiddlewareASGI,
route_configs={
"GET /premium": require_payment(
facilitator_url="http://127.0.0.1:8000",
bearer_token="replace-with-your-facilitator-token",
pay_to="rPT1Sjq2YGrBMTttX4GZHjKu9dyfzbpAYe",
network="xrpl:1",
xrp_drops=1000,
description="One premium request",
)
},
challenge_secret="replace-with-a-shared-secret",
)
WWW-Authenticate and Authorization scheme matching is case-insensitive, though examples keep the canonical Payment casing.
Protected routes enforce a request body limit of 32768 bytes by default. Override it with PaymentMiddlewareASGI(..., max_request_body_bytes=...); oversized protected requests return 413 {"detail":"Request body too large"} before facilitator or app processing.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file xrpl_mpp_middleware-0.1.4.tar.gz.
File metadata
- Download URL: xrpl_mpp_middleware-0.1.4.tar.gz
- Upload date:
- Size: 9.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2981011297a9c07e4a5d56c129e69728d17c0c5276c0c0e2a23c92b9812d7a5b
|
|
| MD5 |
f8a51bdc21b16116d2854fb02d2231e9
|
|
| BLAKE2b-256 |
2d8a4741e0696f0917e4e3360be34e2212bf0c1289825a1103c81e437a50d042
|
Provenance
The following attestation bundles were made for xrpl_mpp_middleware-0.1.4.tar.gz:
Publisher:
publish-package.yml on lgcarrier/xrpl-mpp-stack
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xrpl_mpp_middleware-0.1.4.tar.gz -
Subject digest:
2981011297a9c07e4a5d56c129e69728d17c0c5276c0c0e2a23c92b9812d7a5b - Sigstore transparency entry: 1367575151
- Sigstore integration time:
-
Permalink:
lgcarrier/xrpl-mpp-stack@c95536e21796ac027f1dd0f684a17fcabda594c2 -
Branch / Tag:
refs/tags/middleware-v0.1.4 - Owner: https://github.com/lgcarrier
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-package.yml@c95536e21796ac027f1dd0f684a17fcabda594c2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file xrpl_mpp_middleware-0.1.4-py3-none-any.whl.
File metadata
- Download URL: xrpl_mpp_middleware-0.1.4-py3-none-any.whl
- Upload date:
- Size: 11.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a94b34a2f48d2146572ac3ebacad4034c03668db3b567f9fd4019eb81647df6d
|
|
| MD5 |
bd8b0a311084be93ae94c82ca876f45d
|
|
| BLAKE2b-256 |
03dfffa94c1b757c4925a096c66b14b26568482e2b84c51abec779fbfdd73757
|
Provenance
The following attestation bundles were made for xrpl_mpp_middleware-0.1.4-py3-none-any.whl:
Publisher:
publish-package.yml on lgcarrier/xrpl-mpp-stack
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xrpl_mpp_middleware-0.1.4-py3-none-any.whl -
Subject digest:
a94b34a2f48d2146572ac3ebacad4034c03668db3b567f9fd4019eb81647df6d - Sigstore transparency entry: 1367575178
- Sigstore integration time:
-
Permalink:
lgcarrier/xrpl-mpp-stack@c95536e21796ac027f1dd0f684a17fcabda594c2 -
Branch / Tag:
refs/tags/middleware-v0.1.4 - Owner: https://github.com/lgcarrier
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-package.yml@c95536e21796ac027f1dd0f684a17fcabda594c2 -
Trigger Event:
push
-
Statement type: