Skip to content

Commit e72ab3c

Browse files
committed
feat(keycardai-oauth): initial release
1 parent 2c1630d commit e72ab3c

File tree

4 files changed

+14
-76
lines changed

4 files changed

+14
-76
lines changed

packages/oauth/README.md

Lines changed: 8 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -5,77 +5,23 @@ A comprehensive Python SDK for OAuth 2.0 functionality implementing multiple OAu
55
## Installation
66

77
```bash
8-
pip install keycardai-oauth
8+
uv add keycardai-oauth
99
```
1010

1111
## Quick Start
1212

1313
```python
14-
from keycardai.oauth import *
14+
from keycardai.oauth import Client
1515

16-
# Token Exchange (RFC 8693)
17-
exchange_client = TokenExchangeClient("https://oauth.example.com/token")
18-
response = await exchange_client.exchange_token(
19-
subject_token="original_token",
20-
subject_token_type=TokenTypes.ACCESS_TOKEN,
21-
resource="https://api.example.com"
22-
)
16+
with Client("https://oauth.example.com/token") as client:
17+
response = await client.exchange_token(
18+
subject_token="original_token",
19+
subject_token_type=TokenTypes.ACCESS_TOKEN,
20+
resource="https://api.example.com"
21+
)
2322

24-
# Token Introspection (RFC 7662)
25-
introspection_client = IntrospectionClient(
26-
"https://auth.example.com/introspect",
27-
"client_id",
28-
"client_secret"
29-
)
30-
token_info = await introspection_client.introspect_token("token_to_check")
31-
32-
# Token Revocation (RFC 7009)
33-
revocation_client = RevocationClient(
34-
"https://auth.example.com/revoke",
35-
"client_id",
36-
"client_secret"
37-
)
38-
await revocation_client.revoke_token("token_to_revoke")
3923
```
4024

41-
## 🏗️ Architecture & Standards
42-
43-
This SDK implements a comprehensive set of OAuth 2.0 standards:
44-
45-
### Core Token Operations
46-
47-
| Standard | Module | Description |
48-
|----------|---------|-------------|
49-
| **[RFC 8693](https://datatracker.ietf.org/doc/html/rfc8693)** | `exchange.py` | **OAuth 2.0 Token Exchange** - Delegation and impersonation through standardized token exchange |
50-
| **[RFC 7662](https://datatracker.ietf.org/doc/html/rfc7662)** | `introspection.py` | **Token Introspection** - Validate tokens and retrieve metadata |
51-
| **[RFC 7009](https://datatracker.ietf.org/doc/html/rfc7009)** | `revocation.py` | **Token Revocation** - Invalidate access and refresh tokens |
52-
53-
### Authentication & Security
54-
55-
| Standard | Module | Description |
56-
|----------|---------|-------------|
57-
| **[RFC 7523](https://datatracker.ietf.org/doc/html/rfc7523)** | `jwt_profile.py` | **JWT Client Authentication** - Private key JWT client authentication |
58-
| **[RFC 9068](https://datatracker.ietf.org/doc/html/rfc9068)** | `jwt_profile.py` | **JWT Access Tokens** - Structured JWT access tokens |
59-
| **[RFC 6750](https://datatracker.ietf.org/doc/html/rfc6750)** | `bearer.py` | **Bearer Token Usage** - HTTP Bearer token authentication |
60-
| **[RFC 8705](https://datatracker.ietf.org/doc/html/rfc8705)** | `security.py` | **Mutual TLS** - Certificate-bound tokens and client authentication |
61-
62-
### Discovery & Extensions
63-
64-
| Standard | Module | Description |
65-
|----------|---------|-------------|
66-
| **[RFC 8414](https://datatracker.ietf.org/doc/html/rfc8414)** | `discovery.py` | **Authorization Server Metadata** - Discover OAuth endpoints and capabilities |
67-
| **[RFC 7636](https://datatracker.ietf.org/doc/html/rfc7636)** | `security.py` | **PKCE** - Proof Key for Code Exchange for public clients |
68-
| **[RFC 9126](https://datatracker.ietf.org/doc/html/rfc9126)** | `security.py` | **Pushed Authorization Requests** - Enhanced security for authorization requests |
69-
70-
## Features
71-
72-
-**Comprehensive RFC Implementation**: Full implementation of 9+ OAuth 2.0 RFCs
73-
-**Type Safe**: Full type hints with Pydantic models
74-
-**Async Support**: Native async/await support for all operations
75-
-**Enterprise Ready**: Mutual TLS, certificate binding, and advanced security features
76-
-**Extensible**: Pluggable authentication and validation components
77-
-**Well Tested**: Comprehensive test suite with >90% coverage
78-
7925
## Development
8026

8127
This package is part of the [KeycardAI Python SDK workspace](../../README.md).

packages/oauth/pyproject.toml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "keycardai-oauth"
3-
dynamic = ["version"]
3+
version = "0.1.0"
44
description = "A Python SDK for OAuth 2.0 functionality implementing multiple OAuth 2.0 standards"
55
readme = "README.md"
66
requires-python = ">=3.10"
@@ -40,12 +40,9 @@ Documentation = "https://docs.keycardai.com"
4040
Issues = "https://github.com/keycardai/python-sdk/issues"
4141

4242
[build-system]
43-
requires = ["hatchling", "uv-dynamic-versioning"]
43+
requires = ["hatchling",]
4444
build-backend = "hatchling.build"
4545

46-
[tool.hatch.version]
47-
source = "uv-dynamic-versioning"
48-
4946
[tool.hatch.build.targets.wheel]
5047
packages = ["src/keycardai"]
5148

@@ -103,11 +100,11 @@ dev = [
103100
]
104101

105102
[tool.commitizen]
106-
name = "cz_conventional_commits"
107-
version = "0.0.0"
103+
name = "cz_customize"
104+
version = "0.1.0"
108105
tag_format = "${version}-oauth"
109-
ignored_tag_formats = ["${version}-mcp*", "${version}-fastmcp*"]
106+
ignored_tag_formats = ["${version}-*"]
110107
update_changelog_on_bump = true
111108

112109
[tool.commitizen.customize]
113-
changelog_pattern = "^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)\\(oauth\\)(!)?:"
110+
changelog_pattern = "^(feat|fix|refactor|perf|test|build|ci|revert)\\(keycardai-oauth\\)(!)?:"
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
"""KeyCard AI SDK
22
"""
33

4-
__version__ = "0.0.1"
5-
64
# This makes keycardai a namespace package
75
__path__ = __import__("pkgutil").extend_path(__path__, __name__)

packages/oauth/src/keycardai/oauth/__init__.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,7 @@
6262
)
6363
from .utils.bearer import extract_bearer_token, validate_bearer_format
6464

65-
__version__ = "0.0.1"
66-
6765
__all__ = [
68-
"__version__",
6966
# Core clients
7067
"AsyncClient",
7168
"Client",

0 commit comments

Comments
 (0)