Skip to main content

openkitx403-client — Python SDK

Lightweight Python client for authenticating with OpenKitx403-protected APIs using Solana wallets.


🚀 Installation

pip install openkitx403-client
# or
poetry add openkitx403-client

⚡ Quick Start

from solders.keypair import Keypair
from openkitx403_client import OpenKit403Client

# Generate or load signing key (use secure storage in production)
keypair = Keypair()
print(f"Wallet address: {keypair.pubkey()}")

# Initialize client
client = OpenKit403Client(keypair)

#Authenticate against protected API
response = client.authenticate(
    url="https://api.example.com/protected",
    method="GET",
)

if response.ok:
    data = response.json()
    print("Authenticated:", data)
else:
    print(f"Authentication failed: {response.status_code}")

---

## 🔒 With Existing Keypair
from solders.keypair import Keypair
from openkitx403_client import OpenKit403Client

# Load from secret key bytes
secret_key_bytes = bytes([...]) # Your 64-byte secret key
keypair = Keypair.from_bytes(secret_key_bytes)

client = OpenKit403Client(keypair)
response = client.authenticate("https://api.example.com/data")
print(response.json())


---

## 🧩 API Reference

### `OpenKit403Client(keypair: Keypair)`

Authenticate requests to OpenKitx403-protected APIs using a Solana keypair.

**Parameters:**
- `keypair` (Keypair): Solana keypair from `solders.keypair.Keypair`

**Methods:**

| Method | Description |
|--------|-------------|
| `authenticate(url, method='GET', headers=None, data=None, json_data=None)` | Authenticates and executes a request, returns `requests.Response` |

**authenticate() Parameters:**
- `url` (str): Full API endpoint URL
- `method` (str): HTTP method (GET, POST, PUT, DELETE, etc.)
- `headers` (dict, optional): Additional HTTP headers
- `data` (dict, optional): Form data for POST/PUT
- `json_data` (dict, optional): JSON data for POST/PUT

**Returns:** `requests.Response` object

---

## 📝 POST Request Example

from solders.keypair import Keypair
from openkitx403_client import OpenKit403Client

keypair = Keypair()
client = OpenKit403Client(keypair)

# POST with JSON data
response = client.authenticate(
    url="https://api.example.com/submit",
    method="POST",
    json_data={"message": "Hello from OpenKitx403"}
)

print(response.json())


---

## 🔐 How It Works

1. Client makes initial request to protected endpoint
2. If server returns **403 with WWW-Authenticate challenge**
3. Client signs the challenge with Solana keypair
4. Client retries request with **Authorization header**
5. Server verifies signature and grants access

---

## 🔑 Dependencies

- `solders` - Solana Python SDK
- `requests` - HTTP client
- `base58` - Base58 encoding
- `pynacl` - Ed25519 signature verification

---

## 📚 Documentation

* [OpenKitx403 Protocol Specification](https://github.com/openkitx403/openkitx403)
* [Server SDK Documentation](https://github.com/openkitx403/openkitx403/tree/main/packages/server)
* [Security Best Practices](https://github.com/openkitx403/openkitx403/blob/main/SECURITY.md)

---

## 🪪 License

[MIT](https://github.com/openkitx403/openkitx403/blob/main/LICENSE)

Metadata

Release files for openkitx403-client 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for openkitx403-client 0.1.5
File Size Uploaded Provenance Actions
openkitx403_client-0.1.5.tar.gz 4.4 kB Without provenance Details for openkitx403_client-0.1.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for openkitx403-client 0.1.5
File Interpreter ABI Platform Actions
openkitx403_client-0.1.5-py3-none-any.whl Python 3 none any Details for openkitx403_client-0.1.5-py3-none-any.whl

Total release size: 9.2 kB

Release files / openkitx403_client-0.1.5.tar.gz

Download URL openkitx403_client-0.1.5.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
13c81d0d253f2f679046302e955b8f403b8b4a7ef0df8668033c1e5139f747bf
BLAKE2b-256 checksum
How to use checksums
362cfcce5118dbbfc27c05373295aebd43132f6af4b2a29b6545101f243f20be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.13.6 Windows/11

Release files / openkitx403_client-0.1.5-py3-none-any.whl

Download URL openkitx403_client-0.1.5-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e7a22d092d79f23c11f3bcaaa823668f78fcec92359c132f5a7f459632b6b11c
BLAKE2b-256 checksum
How to use checksums
bf0801508a1f0635c5608738aa2fa5ff69d3d8bcb82b27fbcf0e2ce1e91c49af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.2.1 CPython/3.13.6 Windows/11

Security for openkitx403-client 0.1.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page