nexus6 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- nexus6-0.1.0/PKG-INFO +110 -0
- nexus6-0.1.0/README.md +85 -0
- nexus6-0.1.0/nexus6/__init__.py +24 -0
- nexus6-0.1.0/nexus6/client.py +87 -0
- nexus6-0.1.0/nexus6/middleware.py +85 -0
- nexus6-0.1.0/nexus6.egg-info/PKG-INFO +110 -0
- nexus6-0.1.0/nexus6.egg-info/SOURCES.txt +10 -0
- nexus6-0.1.0/nexus6.egg-info/dependency_links.txt +1 -0
- nexus6-0.1.0/nexus6.egg-info/requires.txt +2 -0
- nexus6-0.1.0/nexus6.egg-info/top_level.txt +1 -0
- nexus6-0.1.0/pyproject.toml +37 -0
- nexus6-0.1.0/setup.cfg +4 -0
nexus6-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: nexus6
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Nexus6 AI Identity SDK — universal identity verification for AI agents
|
|
5
|
+
Author: Nexus6
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Marsssssssssssdsss/nexus6-sdk
|
|
8
|
+
Project-URL: Documentation, https://nexus-7xp6n.ondigitalocean.app
|
|
9
|
+
Project-URL: Source, https://github.com/Marsssssssssssdsss/nexus6-sdk
|
|
10
|
+
Keywords: ai,identity,verification,authentication,agent
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
+
Classifier: Topic :: Security
|
|
21
|
+
Requires-Python: >=3.9
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
Requires-Dist: httpx>=0.24.0
|
|
24
|
+
Requires-Dist: starlette>=0.27.0
|
|
25
|
+
|
|
26
|
+
# Nexus6 Python SDK
|
|
27
|
+
|
|
28
|
+
Universal AI identity verification in 3 lines of code.
|
|
29
|
+
|
|
30
|
+
[](https://opensource.org/licenses/MIT)
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pip install git+https://github.com/Marsssssssssssdsss/nexus6-sdk.git#subdirectory=python
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Quick Start
|
|
39
|
+
|
|
40
|
+
### For AI Agents
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
from nexus6 import Nexus6Client
|
|
44
|
+
|
|
45
|
+
client = Nexus6Client()
|
|
46
|
+
|
|
47
|
+
result = client.register(
|
|
48
|
+
name="My AI Agent",
|
|
49
|
+
title="Customer Support Bot",
|
|
50
|
+
ai_type="assistant",
|
|
51
|
+
description="Handles tier-1 customer queries",
|
|
52
|
+
developer_email="dev@mycompany.com",
|
|
53
|
+
developer_name="Your Name"
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
print(result)
|
|
57
|
+
# {'success': True, 'agent_id': 'ai_xxx', 'api_key': 'nxs6_xxx'}
|
|
58
|
+
|
|
59
|
+
verified = client.verify(result["api_key"])
|
|
60
|
+
print(verified)
|
|
61
|
+
# {'verified': True, 'id': 'ai_xxx', 'name': 'My AI Agent'}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### For Platforms (FastAPI)
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
from fastapi import FastAPI
|
|
68
|
+
from nexus6.middleware import Nexus6Middleware
|
|
69
|
+
|
|
70
|
+
app = FastAPI()
|
|
71
|
+
app.add_middleware(Nexus6Middleware)
|
|
72
|
+
|
|
73
|
+
# That's it. Any request with X-API-Key header will be auto-verified.
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### For Flask
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
from flask import Flask, request, jsonify
|
|
80
|
+
from nexus6 import Nexus6Client
|
|
81
|
+
|
|
82
|
+
app = Flask(__name__)
|
|
83
|
+
nexus6 = Nexus6Client()
|
|
84
|
+
|
|
85
|
+
@app.before_request
|
|
86
|
+
def verify_ai():
|
|
87
|
+
api_key = request.headers.get("X-API-Key")
|
|
88
|
+
if api_key:
|
|
89
|
+
result = nexus6.verify(api_key)
|
|
90
|
+
if not result.get("verified"):
|
|
91
|
+
return jsonify({"error": "Invalid identity"}), 401
|
|
92
|
+
|
|
93
|
+
@app.route("/api/chat", methods=["POST"])
|
|
94
|
+
def chat():
|
|
95
|
+
return jsonify({"message": "Hello from verified AI!"})
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## API Reference
|
|
99
|
+
|
|
100
|
+
### Nexus6Client
|
|
101
|
+
|
|
102
|
+
| Method | Description |
|
|
103
|
+
|--------|-------------|
|
|
104
|
+
| `verify(api_key)` | Verify an AI identity |
|
|
105
|
+
| `register(name, ...)` | Register a new AI identity |
|
|
106
|
+
| `create_token(api_key)` | Create a one-time identity token |
|
|
107
|
+
|
|
108
|
+
## License
|
|
109
|
+
|
|
110
|
+
MIT
|
nexus6-0.1.0/README.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Nexus6 Python SDK
|
|
2
|
+
|
|
3
|
+
Universal AI identity verification in 3 lines of code.
|
|
4
|
+
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pip install git+https://github.com/Marsssssssssssdsss/nexus6-sdk.git#subdirectory=python
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
### For AI Agents
|
|
16
|
+
|
|
17
|
+
```python
|
|
18
|
+
from nexus6 import Nexus6Client
|
|
19
|
+
|
|
20
|
+
client = Nexus6Client()
|
|
21
|
+
|
|
22
|
+
result = client.register(
|
|
23
|
+
name="My AI Agent",
|
|
24
|
+
title="Customer Support Bot",
|
|
25
|
+
ai_type="assistant",
|
|
26
|
+
description="Handles tier-1 customer queries",
|
|
27
|
+
developer_email="dev@mycompany.com",
|
|
28
|
+
developer_name="Your Name"
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
print(result)
|
|
32
|
+
# {'success': True, 'agent_id': 'ai_xxx', 'api_key': 'nxs6_xxx'}
|
|
33
|
+
|
|
34
|
+
verified = client.verify(result["api_key"])
|
|
35
|
+
print(verified)
|
|
36
|
+
# {'verified': True, 'id': 'ai_xxx', 'name': 'My AI Agent'}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### For Platforms (FastAPI)
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
from fastapi import FastAPI
|
|
43
|
+
from nexus6.middleware import Nexus6Middleware
|
|
44
|
+
|
|
45
|
+
app = FastAPI()
|
|
46
|
+
app.add_middleware(Nexus6Middleware)
|
|
47
|
+
|
|
48
|
+
# That's it. Any request with X-API-Key header will be auto-verified.
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### For Flask
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
from flask import Flask, request, jsonify
|
|
55
|
+
from nexus6 import Nexus6Client
|
|
56
|
+
|
|
57
|
+
app = Flask(__name__)
|
|
58
|
+
nexus6 = Nexus6Client()
|
|
59
|
+
|
|
60
|
+
@app.before_request
|
|
61
|
+
def verify_ai():
|
|
62
|
+
api_key = request.headers.get("X-API-Key")
|
|
63
|
+
if api_key:
|
|
64
|
+
result = nexus6.verify(api_key)
|
|
65
|
+
if not result.get("verified"):
|
|
66
|
+
return jsonify({"error": "Invalid identity"}), 401
|
|
67
|
+
|
|
68
|
+
@app.route("/api/chat", methods=["POST"])
|
|
69
|
+
def chat():
|
|
70
|
+
return jsonify({"message": "Hello from verified AI!"})
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## API Reference
|
|
74
|
+
|
|
75
|
+
### Nexus6Client
|
|
76
|
+
|
|
77
|
+
| Method | Description |
|
|
78
|
+
|--------|-------------|
|
|
79
|
+
| `verify(api_key)` | Verify an AI identity |
|
|
80
|
+
| `register(name, ...)` | Register a new AI identity |
|
|
81
|
+
| `create_token(api_key)` | Create a one-time identity token |
|
|
82
|
+
|
|
83
|
+
## License
|
|
84
|
+
|
|
85
|
+
MIT
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"""
|
|
2
|
+
nexus6 — Nexus6 AI Identity SDK for Python.
|
|
3
|
+
|
|
4
|
+
5-minute integration for AI agents and platforms.
|
|
5
|
+
|
|
6
|
+
Usage:
|
|
7
|
+
# AI Agent side
|
|
8
|
+
from nexus6 import Nexus6Client
|
|
9
|
+
client = Nexus6Client(api_key="nxs6_xxx")
|
|
10
|
+
identity = await client.verify()
|
|
11
|
+
|
|
12
|
+
# Platform side (FastAPI middleware)
|
|
13
|
+
from nexus6.middleware import Nexus6Middleware
|
|
14
|
+
app.add_middleware(Nexus6Middleware, api_key="nxs6_xxx")
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
__version__ = "0.1.0"
|
|
18
|
+
__author__ = "Nexus6"
|
|
19
|
+
__license__ = "MIT"
|
|
20
|
+
|
|
21
|
+
from .client import Nexus6Client
|
|
22
|
+
from .middleware import Nexus6Middleware
|
|
23
|
+
|
|
24
|
+
__all__ = ["Nexus6Client", "Nexus6Middleware"]
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"""Nexus6 Client — AI identity registration and verification."""
|
|
2
|
+
|
|
3
|
+
import httpx
|
|
4
|
+
from typing import Optional, Dict, Any
|
|
5
|
+
|
|
6
|
+
DEFAULT_BASE_URL = "https://nexus-7xp6n.ondigitalocean.app"
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Nexus6Client:
|
|
10
|
+
"""Client for Nexus6 AI Identity system.
|
|
11
|
+
|
|
12
|
+
Usage:
|
|
13
|
+
client = Nexus6Client(api_key="nxs6_xxx")
|
|
14
|
+
identity = client.verify()
|
|
15
|
+
|
|
16
|
+
# Or register a new identity
|
|
17
|
+
result = client.register(name="My AI Agent")
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
def __init__(self, api_key: Optional[str] = None, base_url: str = DEFAULT_BASE_URL):
|
|
21
|
+
self.api_key = api_key
|
|
22
|
+
self.base_url = base_url.rstrip("/")
|
|
23
|
+
|
|
24
|
+
def verify(self, api_key: Optional[str] = None) -> Dict[str, Any]:
|
|
25
|
+
"""Verify an AI identity by API key.
|
|
26
|
+
|
|
27
|
+
Returns:
|
|
28
|
+
{"verified": True, "id": "ai_xxx", "name": "...", ...}
|
|
29
|
+
or {"verified": False, "error": "..."}
|
|
30
|
+
"""
|
|
31
|
+
key = api_key or self.api_key
|
|
32
|
+
if not key:
|
|
33
|
+
return {"verified": False, "error": "No API key provided. Pass api_key or set it in client."}
|
|
34
|
+
|
|
35
|
+
try:
|
|
36
|
+
with httpx.Client(timeout=10) as http:
|
|
37
|
+
resp = http.post(
|
|
38
|
+
f"{self.base_url}/api/v1/identity/verify",
|
|
39
|
+
json={"api_key": key}
|
|
40
|
+
)
|
|
41
|
+
return resp.json()
|
|
42
|
+
except Exception as e:
|
|
43
|
+
return {"verified": False, "error": f"Verification failed: {str(e)}"}
|
|
44
|
+
|
|
45
|
+
def register(self, name: str, **kwargs) -> Dict[str, Any]:
|
|
46
|
+
"""Register a new AI identity.
|
|
47
|
+
|
|
48
|
+
Args:
|
|
49
|
+
name: AI agent name
|
|
50
|
+
**kwargs: optional fields (title, description, developer_email, etc.)
|
|
51
|
+
|
|
52
|
+
Returns:
|
|
53
|
+
{"success": True, "agent_id": "...", "api_key": "nxs6_xxx", ...}
|
|
54
|
+
"""
|
|
55
|
+
payload = {"name": name, **kwargs}
|
|
56
|
+
try:
|
|
57
|
+
with httpx.Client(timeout=10) as http:
|
|
58
|
+
resp = http.post(
|
|
59
|
+
f"{self.base_url}/api/ai/register",
|
|
60
|
+
json=payload
|
|
61
|
+
)
|
|
62
|
+
result = resp.json()
|
|
63
|
+
if result.get("success") and "api_key" in result:
|
|
64
|
+
self.api_key = result["api_key"]
|
|
65
|
+
return result
|
|
66
|
+
except Exception as e:
|
|
67
|
+
return {"success": False, "error": f"Registration failed: {str(e)}"}
|
|
68
|
+
|
|
69
|
+
def create_token(self, api_key: Optional[str] = None) -> Dict[str, Any]:
|
|
70
|
+
"""Create a one-time identity token (expires in 5 min).
|
|
71
|
+
|
|
72
|
+
Returns:
|
|
73
|
+
{"token": "idt_xxx", "expires_in": 300, "usage": "single-use"}
|
|
74
|
+
"""
|
|
75
|
+
key = api_key or self.api_key
|
|
76
|
+
if not key:
|
|
77
|
+
return {"error": "No API key provided"}
|
|
78
|
+
|
|
79
|
+
try:
|
|
80
|
+
with httpx.Client(timeout=10) as http:
|
|
81
|
+
resp = http.post(
|
|
82
|
+
f"{self.base_url}/api/v1/identity/token",
|
|
83
|
+
headers={"X-API-Key": key}
|
|
84
|
+
)
|
|
85
|
+
return resp.json()
|
|
86
|
+
except Exception as e:
|
|
87
|
+
return {"error": f"Token creation failed: {str(e)}"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"""Nexus6 Middleware — drop-in AI identity verification for FastAPI/Starlette."""
|
|
2
|
+
|
|
3
|
+
from starlette.middleware.base import BaseHTTPMiddleware
|
|
4
|
+
from starlette.requests import Request
|
|
5
|
+
from starlette.responses import JSONResponse
|
|
6
|
+
import httpx
|
|
7
|
+
from typing import Optional, List, Callable
|
|
8
|
+
|
|
9
|
+
DEFAULT_BASE_URL = "https://nexus-7xp6n.ondigitalocean.app"
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class Nexus6Middleware(BaseHTTPMiddleware):
|
|
13
|
+
"""FastAPI middleware that automatically verifies AI identity on incoming requests.
|
|
14
|
+
|
|
15
|
+
Usage:
|
|
16
|
+
from fastapi import FastAPI
|
|
17
|
+
from nexus6 import Nexus6Middleware
|
|
18
|
+
|
|
19
|
+
app = FastAPI()
|
|
20
|
+
app.add_middleware(Nexus6Middleware)
|
|
21
|
+
|
|
22
|
+
# Or with custom config:
|
|
23
|
+
app.add_middleware(
|
|
24
|
+
Nexus6Middleware,
|
|
25
|
+
exclude_paths=["/health", "/docs", "/openapi.json"],
|
|
26
|
+
on_verified=lambda req, identity: print(f"Verified: {identity['name']}"),
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
How it works:
|
|
30
|
+
1. Checks for X-API-Key header in incoming requests
|
|
31
|
+
2. If present, calls Nexus6 verification endpoint
|
|
32
|
+
3. If verified, stores identity in request.state.ai_identity and continues
|
|
33
|
+
4. If not verified, returns 401 Unauthorized
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
def __init__(
|
|
37
|
+
self,
|
|
38
|
+
app,
|
|
39
|
+
base_url: str = DEFAULT_BASE_URL,
|
|
40
|
+
exclude_paths: Optional[List[str]] = None,
|
|
41
|
+
on_verified: Optional[Callable] = None,
|
|
42
|
+
header_name: str = "X-API-Key",
|
|
43
|
+
):
|
|
44
|
+
super().__init__(app)
|
|
45
|
+
self.base_url = base_url.rstrip("/")
|
|
46
|
+
self.exclude_paths = exclude_paths or ["/health", "/docs", "/openapi.json", "/favicon.ico"]
|
|
47
|
+
self.on_verified = on_verified
|
|
48
|
+
self.header_name = header_name
|
|
49
|
+
|
|
50
|
+
async def dispatch(self, request: Request, call_next):
|
|
51
|
+
path = request.url.path
|
|
52
|
+
|
|
53
|
+
if any(path.startswith(p) for p in self.exclude_paths):
|
|
54
|
+
return await call_next(request)
|
|
55
|
+
|
|
56
|
+
api_key = request.headers.get(self.header_name)
|
|
57
|
+
|
|
58
|
+
if not api_key:
|
|
59
|
+
return await call_next(request)
|
|
60
|
+
|
|
61
|
+
verified = await self._verify(api_key)
|
|
62
|
+
|
|
63
|
+
if not verified.get("verified"):
|
|
64
|
+
return JSONResponse(
|
|
65
|
+
status_code=401,
|
|
66
|
+
content={"error": "Invalid AI identity", "details": verified.get("error", "")}
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
request.state.ai_identity = verified
|
|
70
|
+
|
|
71
|
+
if self.on_verified:
|
|
72
|
+
self.on_verified(request, verified)
|
|
73
|
+
|
|
74
|
+
return await call_next(request)
|
|
75
|
+
|
|
76
|
+
async def _verify(self, api_key: str) -> dict:
|
|
77
|
+
try:
|
|
78
|
+
async with httpx.AsyncClient(timeout=10) as http:
|
|
79
|
+
resp = await http.post(
|
|
80
|
+
f"{self.base_url}/api/v1/identity/verify",
|
|
81
|
+
json={"api_key": api_key}
|
|
82
|
+
)
|
|
83
|
+
return resp.json()
|
|
84
|
+
except Exception:
|
|
85
|
+
return {"verified": False, "error": "Verification service unavailable"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: nexus6
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Nexus6 AI Identity SDK — universal identity verification for AI agents
|
|
5
|
+
Author: Nexus6
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Marsssssssssssdsss/nexus6-sdk
|
|
8
|
+
Project-URL: Documentation, https://nexus-7xp6n.ondigitalocean.app
|
|
9
|
+
Project-URL: Source, https://github.com/Marsssssssssssdsss/nexus6-sdk
|
|
10
|
+
Keywords: ai,identity,verification,authentication,agent
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
+
Classifier: Topic :: Security
|
|
21
|
+
Requires-Python: >=3.9
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
Requires-Dist: httpx>=0.24.0
|
|
24
|
+
Requires-Dist: starlette>=0.27.0
|
|
25
|
+
|
|
26
|
+
# Nexus6 Python SDK
|
|
27
|
+
|
|
28
|
+
Universal AI identity verification in 3 lines of code.
|
|
29
|
+
|
|
30
|
+
[](https://opensource.org/licenses/MIT)
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pip install git+https://github.com/Marsssssssssssdsss/nexus6-sdk.git#subdirectory=python
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Quick Start
|
|
39
|
+
|
|
40
|
+
### For AI Agents
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
from nexus6 import Nexus6Client
|
|
44
|
+
|
|
45
|
+
client = Nexus6Client()
|
|
46
|
+
|
|
47
|
+
result = client.register(
|
|
48
|
+
name="My AI Agent",
|
|
49
|
+
title="Customer Support Bot",
|
|
50
|
+
ai_type="assistant",
|
|
51
|
+
description="Handles tier-1 customer queries",
|
|
52
|
+
developer_email="dev@mycompany.com",
|
|
53
|
+
developer_name="Your Name"
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
print(result)
|
|
57
|
+
# {'success': True, 'agent_id': 'ai_xxx', 'api_key': 'nxs6_xxx'}
|
|
58
|
+
|
|
59
|
+
verified = client.verify(result["api_key"])
|
|
60
|
+
print(verified)
|
|
61
|
+
# {'verified': True, 'id': 'ai_xxx', 'name': 'My AI Agent'}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### For Platforms (FastAPI)
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
from fastapi import FastAPI
|
|
68
|
+
from nexus6.middleware import Nexus6Middleware
|
|
69
|
+
|
|
70
|
+
app = FastAPI()
|
|
71
|
+
app.add_middleware(Nexus6Middleware)
|
|
72
|
+
|
|
73
|
+
# That's it. Any request with X-API-Key header will be auto-verified.
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### For Flask
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
from flask import Flask, request, jsonify
|
|
80
|
+
from nexus6 import Nexus6Client
|
|
81
|
+
|
|
82
|
+
app = Flask(__name__)
|
|
83
|
+
nexus6 = Nexus6Client()
|
|
84
|
+
|
|
85
|
+
@app.before_request
|
|
86
|
+
def verify_ai():
|
|
87
|
+
api_key = request.headers.get("X-API-Key")
|
|
88
|
+
if api_key:
|
|
89
|
+
result = nexus6.verify(api_key)
|
|
90
|
+
if not result.get("verified"):
|
|
91
|
+
return jsonify({"error": "Invalid identity"}), 401
|
|
92
|
+
|
|
93
|
+
@app.route("/api/chat", methods=["POST"])
|
|
94
|
+
def chat():
|
|
95
|
+
return jsonify({"message": "Hello from verified AI!"})
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## API Reference
|
|
99
|
+
|
|
100
|
+
### Nexus6Client
|
|
101
|
+
|
|
102
|
+
| Method | Description |
|
|
103
|
+
|--------|-------------|
|
|
104
|
+
| `verify(api_key)` | Verify an AI identity |
|
|
105
|
+
| `register(name, ...)` | Register a new AI identity |
|
|
106
|
+
| `create_token(api_key)` | Create a one-time identity token |
|
|
107
|
+
|
|
108
|
+
## License
|
|
109
|
+
|
|
110
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
nexus6
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "nexus6"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Nexus6 AI Identity SDK — universal identity verification for AI agents"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = {text = "MIT"}
|
|
11
|
+
authors = [{name = "Nexus6"}]
|
|
12
|
+
classifiers = [
|
|
13
|
+
"Development Status :: 3 - Alpha",
|
|
14
|
+
"Intended Audience :: Developers",
|
|
15
|
+
"License :: OSI Approved :: MIT License",
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Programming Language :: Python :: 3.9",
|
|
18
|
+
"Programming Language :: Python :: 3.10",
|
|
19
|
+
"Programming Language :: Python :: 3.11",
|
|
20
|
+
"Programming Language :: Python :: 3.12",
|
|
21
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
22
|
+
"Topic :: Security",
|
|
23
|
+
]
|
|
24
|
+
keywords = ["ai", "identity", "verification", "authentication", "agent"]
|
|
25
|
+
requires-python = ">=3.9"
|
|
26
|
+
dependencies = [
|
|
27
|
+
"httpx>=0.24.0",
|
|
28
|
+
"starlette>=0.27.0",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
[project.urls]
|
|
32
|
+
Homepage = "https://github.com/Marsssssssssssdsss/nexus6-sdk"
|
|
33
|
+
Documentation = "https://nexus-7xp6n.ondigitalocean.app"
|
|
34
|
+
Source = "https://github.com/Marsssssssssssdsss/nexus6-sdk"
|
|
35
|
+
|
|
36
|
+
[tool.setuptools.packages.find]
|
|
37
|
+
include = ["nexus6*"]
|
nexus6-0.1.0/setup.cfg
ADDED