authentify-sdk 0.2.0__tar.gz → 0.3.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.
- {authentify_sdk-0.2.0/src/authentify_sdk.egg-info → authentify_sdk-0.3.0}/PKG-INFO +13 -1
- {authentify_sdk-0.2.0 → authentify_sdk-0.3.0}/README.md +12 -0
- {authentify_sdk-0.2.0 → authentify_sdk-0.3.0}/pyproject.toml +1 -1
- {authentify_sdk-0.2.0 → authentify_sdk-0.3.0}/src/authentify/client.py +22 -1
- {authentify_sdk-0.2.0 → authentify_sdk-0.3.0}/src/authentify/types.py +7 -0
- {authentify_sdk-0.2.0 → authentify_sdk-0.3.0/src/authentify_sdk.egg-info}/PKG-INFO +13 -1
- {authentify_sdk-0.2.0 → authentify_sdk-0.3.0}/LICENSE +0 -0
- {authentify_sdk-0.2.0 → authentify_sdk-0.3.0}/setup.cfg +0 -0
- {authentify_sdk-0.2.0 → authentify_sdk-0.3.0}/src/authentify/__init__.py +0 -0
- {authentify_sdk-0.2.0 → authentify_sdk-0.3.0}/src/authentify/errors.py +0 -0
- {authentify_sdk-0.2.0 → authentify_sdk-0.3.0}/src/authentify_sdk.egg-info/SOURCES.txt +0 -0
- {authentify_sdk-0.2.0 → authentify_sdk-0.3.0}/src/authentify_sdk.egg-info/dependency_links.txt +0 -0
- {authentify_sdk-0.2.0 → authentify_sdk-0.3.0}/src/authentify_sdk.egg-info/requires.txt +0 -0
- {authentify_sdk-0.2.0 → authentify_sdk-0.3.0}/src/authentify_sdk.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: authentify-sdk
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: Typed Python client for the Authentify API: authorize AI agent actions before they run
|
|
5
5
|
Author: 4Sure Technologies LLC
|
|
6
6
|
License-Expression: MIT
|
|
@@ -98,6 +98,18 @@ status["approvalStatus"] # "pending", "approved" or "rejected"
|
|
|
98
98
|
client.report_outcome(result["authorizationRequestId"], {"status": "succeeded"})
|
|
99
99
|
```
|
|
100
100
|
|
|
101
|
+
### Linking an agent run's requests
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
lookup = client.authorize({"action": "READ", "resource": {"id": account_id}, "session_id": f"run_{run_id}"})
|
|
105
|
+
client.authorize({
|
|
106
|
+
"action": "XFR", "resource": {"id": account_id}, "context": {"amount": amount},
|
|
107
|
+
"session_id": f"run_{run_id}", "parent_request_id": lookup["authorizationRequestId"],
|
|
108
|
+
})
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
`session_id` is your own id for the run (1-128 printable characters, no spaces, no personal data); requests sharing it are listed together in the dashboard and sealed with it. Only calls that ask Authentify appear.
|
|
112
|
+
|
|
101
113
|
### Consent sessions
|
|
102
114
|
|
|
103
115
|
```python
|
|
@@ -79,6 +79,18 @@ status["approvalStatus"] # "pending", "approved" or "rejected"
|
|
|
79
79
|
client.report_outcome(result["authorizationRequestId"], {"status": "succeeded"})
|
|
80
80
|
```
|
|
81
81
|
|
|
82
|
+
### Linking an agent run's requests
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
lookup = client.authorize({"action": "READ", "resource": {"id": account_id}, "session_id": f"run_{run_id}"})
|
|
86
|
+
client.authorize({
|
|
87
|
+
"action": "XFR", "resource": {"id": account_id}, "context": {"amount": amount},
|
|
88
|
+
"session_id": f"run_{run_id}", "parent_request_id": lookup["authorizationRequestId"],
|
|
89
|
+
})
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
`session_id` is your own id for the run (1-128 printable characters, no spaces, no personal data); requests sharing it are listed together in the dashboard and sealed with it. Only calls that ask Authentify appear.
|
|
93
|
+
|
|
82
94
|
### Consent sessions
|
|
83
95
|
|
|
84
96
|
```python
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "authentify-sdk"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.3.0"
|
|
8
8
|
description = "Typed Python client for the Authentify API: authorize AI agent actions before they run"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9"
|
|
@@ -45,6 +45,27 @@ APPROVALS_NEED_A_PERSON = (
|
|
|
45
45
|
)
|
|
46
46
|
|
|
47
47
|
|
|
48
|
+
# AuthorizeParams keys are snake_case in Python; POST /v2/authorize reads
|
|
49
|
+
# camelCase. Through 0.2.0 the dict went out as-is, so end_user_id never
|
|
50
|
+
# reached the server and the call was decided with no consent check (the
|
|
51
|
+
# server now also accepts end_user_id, for clients that haven't upgraded).
|
|
52
|
+
_AUTHORIZE_WIRE_KEYS = {
|
|
53
|
+
"end_user_id": "endUserId",
|
|
54
|
+
"session_id": "sessionId",
|
|
55
|
+
"parent_request_id": "parentRequestId",
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def _authorize_body(params: AuthorizeParams) -> Dict[str, Any]:
|
|
60
|
+
body: Dict[str, Any] = {}
|
|
61
|
+
for key, value in params.items():
|
|
62
|
+
wire = _AUTHORIZE_WIRE_KEYS.get(key, key)
|
|
63
|
+
if wire in body and body[wire] != value:
|
|
64
|
+
raise ValueError(f"{key} and {wire} are both set to different values; set one")
|
|
65
|
+
body[wire] = value
|
|
66
|
+
return body
|
|
67
|
+
|
|
68
|
+
|
|
48
69
|
class AuthentifyClient:
|
|
49
70
|
def __init__(
|
|
50
71
|
self,
|
|
@@ -106,7 +127,7 @@ class AuthentifyClient:
|
|
|
106
127
|
gate. Accepts either x-api-key or an OAuth-minted Bearer token;
|
|
107
128
|
OAuth tokens are minted/refreshed automatically when this client
|
|
108
129
|
uses OAuth mode."""
|
|
109
|
-
return self._request("POST", "/authorize", params, auth="authorize", version="v2")
|
|
130
|
+
return self._request("POST", "/authorize", _authorize_body(params), auth="authorize", version="v2")
|
|
110
131
|
|
|
111
132
|
def approve_authorization_request(
|
|
112
133
|
self, approval_request_id: str, params: Optional[ApproveRejectParams] = None
|
|
@@ -88,6 +88,13 @@ class AuthorizeParams(TypedDict, total=False):
|
|
|
88
88
|
resource: ResourceRef
|
|
89
89
|
context: Dict[str, Any]
|
|
90
90
|
end_user_id: str
|
|
91
|
+
session_id: str
|
|
92
|
+
"""Your own id for this agent run, conversation or job (1-128 printable
|
|
93
|
+
characters, no spaces). Requests sharing it are listed together and
|
|
94
|
+
sealed with it. Don't put personal data in it."""
|
|
95
|
+
parent_request_id: str
|
|
96
|
+
"""The authorizationRequestId of the earlier request this one follows
|
|
97
|
+
from; without a session_id, this request joins the parent's session."""
|
|
91
98
|
signals: Signals
|
|
92
99
|
"""Optional UTP classification evidence; never overrides authorization policy."""
|
|
93
100
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: authentify-sdk
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: Typed Python client for the Authentify API: authorize AI agent actions before they run
|
|
5
5
|
Author: 4Sure Technologies LLC
|
|
6
6
|
License-Expression: MIT
|
|
@@ -98,6 +98,18 @@ status["approvalStatus"] # "pending", "approved" or "rejected"
|
|
|
98
98
|
client.report_outcome(result["authorizationRequestId"], {"status": "succeeded"})
|
|
99
99
|
```
|
|
100
100
|
|
|
101
|
+
### Linking an agent run's requests
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
lookup = client.authorize({"action": "READ", "resource": {"id": account_id}, "session_id": f"run_{run_id}"})
|
|
105
|
+
client.authorize({
|
|
106
|
+
"action": "XFR", "resource": {"id": account_id}, "context": {"amount": amount},
|
|
107
|
+
"session_id": f"run_{run_id}", "parent_request_id": lookup["authorizationRequestId"],
|
|
108
|
+
})
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
`session_id` is your own id for the run (1-128 printable characters, no spaces, no personal data); requests sharing it are listed together in the dashboard and sealed with it. Only calls that ask Authentify appear.
|
|
112
|
+
|
|
101
113
|
### Consent sessions
|
|
102
114
|
|
|
103
115
|
```python
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{authentify_sdk-0.2.0 → authentify_sdk-0.3.0}/src/authentify_sdk.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|