vouch-langchain 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.
- vouch_langchain-0.1.0/PKG-INFO +67 -0
- vouch_langchain-0.1.0/README.md +52 -0
- vouch_langchain-0.1.0/pyproject.toml +24 -0
- vouch_langchain-0.1.0/setup.cfg +4 -0
- vouch_langchain-0.1.0/src/vouch_langchain/__init__.py +11 -0
- vouch_langchain-0.1.0/src/vouch_langchain.egg-info/PKG-INFO +67 -0
- vouch_langchain-0.1.0/src/vouch_langchain.egg-info/SOURCES.txt +9 -0
- vouch_langchain-0.1.0/src/vouch_langchain.egg-info/dependency_links.txt +1 -0
- vouch_langchain-0.1.0/src/vouch_langchain.egg-info/requires.txt +4 -0
- vouch_langchain-0.1.0/src/vouch_langchain.egg-info/top_level.txt +1 -0
- vouch_langchain-0.1.0/tests/test_smoke.py +32 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: vouch-langchain
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: LangChain tool that issues Vouch Credentials to authorize AI agent tool calls.
|
|
5
|
+
Author: Ramprasad Gaddam
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://vouch-protocol.com
|
|
8
|
+
Project-URL: Source, https://github.com/vouch-protocol/vouch
|
|
9
|
+
Keywords: langchain,vouch,ai-agents,verifiable-credentials,identity
|
|
10
|
+
Requires-Python: >=3.9
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
Requires-Dist: vouch-protocol[langchain]>=1.6.0
|
|
13
|
+
Provides-Extra: dev
|
|
14
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
15
|
+
|
|
16
|
+
# vouch-langchain
|
|
17
|
+
|
|
18
|
+
A [LangChain](https://www.langchain.com/) tool that issues
|
|
19
|
+
[Vouch](https://vouch-protocol.com) Credentials, so a LangChain agent can
|
|
20
|
+
cryptographically authorize the tool calls it makes.
|
|
21
|
+
|
|
22
|
+
Each signed call carries a W3C Verifiable Credential with an `eddsa-jcs-2022`
|
|
23
|
+
Data Integrity proof, and optionally a delegation chain back to an accountable
|
|
24
|
+
human principal.
|
|
25
|
+
|
|
26
|
+
## Install
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pip install vouch-langchain
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
This pulls in `vouch-protocol[langchain]`.
|
|
33
|
+
|
|
34
|
+
## Configure
|
|
35
|
+
|
|
36
|
+
The tool reads two environment variables:
|
|
37
|
+
|
|
38
|
+
- `VOUCH_PRIVATE_KEY` the agent's private key (JWK JSON string).
|
|
39
|
+
- `VOUCH_DID` the agent's DID, e.g. `did:web:agent.example.com`.
|
|
40
|
+
|
|
41
|
+
## Use
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
from vouch_langchain import VouchSignerTool
|
|
45
|
+
|
|
46
|
+
tool = VouchSignerTool() # reads VOUCH_PRIVATE_KEY / VOUCH_DID
|
|
47
|
+
credential_json = tool._run(
|
|
48
|
+
action="read",
|
|
49
|
+
target="https://api.example.com",
|
|
50
|
+
resource="customer:123",
|
|
51
|
+
)
|
|
52
|
+
# Attach credential_json as a 'Vouch-Credential' header on your request.
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Add `tool` to any LangChain agent's tool list. The agent calls it before an
|
|
56
|
+
authenticated request and forwards the credential to your service.
|
|
57
|
+
|
|
58
|
+
## Verify on the receiving side
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
from vouch import Verifier
|
|
62
|
+
ok, passport = Verifier.verify_credential(received_json, public_key=agent_pubkey)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## License
|
|
66
|
+
|
|
67
|
+
Apache-2.0.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# vouch-langchain
|
|
2
|
+
|
|
3
|
+
A [LangChain](https://www.langchain.com/) tool that issues
|
|
4
|
+
[Vouch](https://vouch-protocol.com) Credentials, so a LangChain agent can
|
|
5
|
+
cryptographically authorize the tool calls it makes.
|
|
6
|
+
|
|
7
|
+
Each signed call carries a W3C Verifiable Credential with an `eddsa-jcs-2022`
|
|
8
|
+
Data Integrity proof, and optionally a delegation chain back to an accountable
|
|
9
|
+
human principal.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pip install vouch-langchain
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
This pulls in `vouch-protocol[langchain]`.
|
|
18
|
+
|
|
19
|
+
## Configure
|
|
20
|
+
|
|
21
|
+
The tool reads two environment variables:
|
|
22
|
+
|
|
23
|
+
- `VOUCH_PRIVATE_KEY` the agent's private key (JWK JSON string).
|
|
24
|
+
- `VOUCH_DID` the agent's DID, e.g. `did:web:agent.example.com`.
|
|
25
|
+
|
|
26
|
+
## Use
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
from vouch_langchain import VouchSignerTool
|
|
30
|
+
|
|
31
|
+
tool = VouchSignerTool() # reads VOUCH_PRIVATE_KEY / VOUCH_DID
|
|
32
|
+
credential_json = tool._run(
|
|
33
|
+
action="read",
|
|
34
|
+
target="https://api.example.com",
|
|
35
|
+
resource="customer:123",
|
|
36
|
+
)
|
|
37
|
+
# Attach credential_json as a 'Vouch-Credential' header on your request.
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Add `tool` to any LangChain agent's tool list. The agent calls it before an
|
|
41
|
+
authenticated request and forwards the credential to your service.
|
|
42
|
+
|
|
43
|
+
## Verify on the receiving side
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
from vouch import Verifier
|
|
47
|
+
ok, passport = Verifier.verify_credential(received_json, public_key=agent_pubkey)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## License
|
|
51
|
+
|
|
52
|
+
Apache-2.0.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "vouch-langchain"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "LangChain tool that issues Vouch Credentials to authorize AI agent tool calls."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = { text = "Apache-2.0" }
|
|
12
|
+
authors = [{ name = "Ramprasad Gaddam" }]
|
|
13
|
+
keywords = ["langchain", "vouch", "ai-agents", "verifiable-credentials", "identity"]
|
|
14
|
+
dependencies = ["vouch-protocol[langchain]>=1.6.0"]
|
|
15
|
+
|
|
16
|
+
[project.optional-dependencies]
|
|
17
|
+
dev = ["pytest>=7.0"]
|
|
18
|
+
|
|
19
|
+
[project.urls]
|
|
20
|
+
Homepage = "https://vouch-protocol.com"
|
|
21
|
+
Source = "https://github.com/vouch-protocol/vouch"
|
|
22
|
+
|
|
23
|
+
[tool.setuptools.packages.find]
|
|
24
|
+
where = ["src"]
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"""vouch-langchain: a LangChain tool that issues Vouch Credentials.
|
|
2
|
+
|
|
3
|
+
Thin distribution wrapping vouch.integrations.langchain. It exists so the tool
|
|
4
|
+
can be installed and listed on its own while the implementation stays
|
|
5
|
+
single-sourced in the vouch-protocol package.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from vouch.integrations.langchain.tool import VouchSignerInput, VouchSignerTool
|
|
9
|
+
|
|
10
|
+
__all__ = ["VouchSignerTool", "VouchSignerInput"]
|
|
11
|
+
__version__ = "0.1.0"
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: vouch-langchain
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: LangChain tool that issues Vouch Credentials to authorize AI agent tool calls.
|
|
5
|
+
Author: Ramprasad Gaddam
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://vouch-protocol.com
|
|
8
|
+
Project-URL: Source, https://github.com/vouch-protocol/vouch
|
|
9
|
+
Keywords: langchain,vouch,ai-agents,verifiable-credentials,identity
|
|
10
|
+
Requires-Python: >=3.9
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
Requires-Dist: vouch-protocol[langchain]>=1.6.0
|
|
13
|
+
Provides-Extra: dev
|
|
14
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
15
|
+
|
|
16
|
+
# vouch-langchain
|
|
17
|
+
|
|
18
|
+
A [LangChain](https://www.langchain.com/) tool that issues
|
|
19
|
+
[Vouch](https://vouch-protocol.com) Credentials, so a LangChain agent can
|
|
20
|
+
cryptographically authorize the tool calls it makes.
|
|
21
|
+
|
|
22
|
+
Each signed call carries a W3C Verifiable Credential with an `eddsa-jcs-2022`
|
|
23
|
+
Data Integrity proof, and optionally a delegation chain back to an accountable
|
|
24
|
+
human principal.
|
|
25
|
+
|
|
26
|
+
## Install
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pip install vouch-langchain
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
This pulls in `vouch-protocol[langchain]`.
|
|
33
|
+
|
|
34
|
+
## Configure
|
|
35
|
+
|
|
36
|
+
The tool reads two environment variables:
|
|
37
|
+
|
|
38
|
+
- `VOUCH_PRIVATE_KEY` the agent's private key (JWK JSON string).
|
|
39
|
+
- `VOUCH_DID` the agent's DID, e.g. `did:web:agent.example.com`.
|
|
40
|
+
|
|
41
|
+
## Use
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
from vouch_langchain import VouchSignerTool
|
|
45
|
+
|
|
46
|
+
tool = VouchSignerTool() # reads VOUCH_PRIVATE_KEY / VOUCH_DID
|
|
47
|
+
credential_json = tool._run(
|
|
48
|
+
action="read",
|
|
49
|
+
target="https://api.example.com",
|
|
50
|
+
resource="customer:123",
|
|
51
|
+
)
|
|
52
|
+
# Attach credential_json as a 'Vouch-Credential' header on your request.
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Add `tool` to any LangChain agent's tool list. The agent calls it before an
|
|
56
|
+
authenticated request and forwards the credential to your service.
|
|
57
|
+
|
|
58
|
+
## Verify on the receiving side
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
from vouch import Verifier
|
|
62
|
+
ok, passport = Verifier.verify_credential(received_json, public_key=agent_pubkey)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## License
|
|
66
|
+
|
|
67
|
+
Apache-2.0.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
src/vouch_langchain/__init__.py
|
|
4
|
+
src/vouch_langchain.egg-info/PKG-INFO
|
|
5
|
+
src/vouch_langchain.egg-info/SOURCES.txt
|
|
6
|
+
src/vouch_langchain.egg-info/dependency_links.txt
|
|
7
|
+
src/vouch_langchain.egg-info/requires.txt
|
|
8
|
+
src/vouch_langchain.egg-info/top_level.txt
|
|
9
|
+
tests/test_smoke.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
vouch_langchain
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"""Smoke tests for the vouch-langchain package."""
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
import os
|
|
5
|
+
|
|
6
|
+
from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PublicKey
|
|
7
|
+
from jwcrypto.common import base64url_decode
|
|
8
|
+
|
|
9
|
+
from vouch import Verifier, generate_identity
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def test_package_exports():
|
|
13
|
+
import vouch_langchain
|
|
14
|
+
|
|
15
|
+
assert vouch_langchain.VouchSignerTool is not None
|
|
16
|
+
assert vouch_langchain.VouchSignerInput is not None
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def test_tool_issues_verifying_credential():
|
|
20
|
+
kp = generate_identity()
|
|
21
|
+
os.environ["VOUCH_PRIVATE_KEY"] = kp.private_key_jwk
|
|
22
|
+
os.environ["VOUCH_DID"] = "did:web:agent.example.com"
|
|
23
|
+
|
|
24
|
+
from vouch_langchain import VouchSignerTool
|
|
25
|
+
|
|
26
|
+
out = VouchSignerTool()._run("read", "https://api.example.com", "customer:123")
|
|
27
|
+
cred = json.loads(out)
|
|
28
|
+
assert cred["proof"]["cryptosuite"] == "eddsa-jcs-2022"
|
|
29
|
+
|
|
30
|
+
pub = Ed25519PublicKey.from_public_bytes(base64url_decode(json.loads(kp.public_key_jwk)["x"]))
|
|
31
|
+
ok, _ = Verifier.verify_credential(cred, public_key=pub)
|
|
32
|
+
assert ok is True
|