glacis 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.
- glacis-0.1.0/.gitignore +85 -0
- glacis-0.1.0/LICENSE +190 -0
- glacis-0.1.0/PKG-INFO +324 -0
- glacis-0.1.0/README.md +275 -0
- glacis-0.1.0/glacis/__init__.py +88 -0
- glacis-0.1.0/glacis/__main__.py +76 -0
- glacis-0.1.0/glacis/client.py +847 -0
- glacis-0.1.0/glacis/crypto.py +121 -0
- glacis-0.1.0/glacis/integrations/__init__.py +12 -0
- glacis-0.1.0/glacis/integrations/anthropic.py +222 -0
- glacis-0.1.0/glacis/integrations/openai.py +208 -0
- glacis-0.1.0/glacis/models.py +293 -0
- glacis-0.1.0/glacis/storage.py +331 -0
- glacis-0.1.0/glacis/streaming.py +363 -0
- glacis-0.1.0/glacis/wasm/s3p_core_wasi.wasm +0 -0
- glacis-0.1.0/glacis/wasm_runtime.py +519 -0
- glacis-0.1.0/pyproject.toml +95 -0
glacis-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
*.egg-info/
|
|
24
|
+
.installed.cfg
|
|
25
|
+
*.egg
|
|
26
|
+
|
|
27
|
+
# PyInstaller
|
|
28
|
+
*.manifest
|
|
29
|
+
*.spec
|
|
30
|
+
|
|
31
|
+
# Installer logs
|
|
32
|
+
pip-log.txt
|
|
33
|
+
pip-delete-this-directory.txt
|
|
34
|
+
|
|
35
|
+
# Unit test / coverage reports
|
|
36
|
+
htmlcov/
|
|
37
|
+
.tox/
|
|
38
|
+
.nox/
|
|
39
|
+
.coverage
|
|
40
|
+
.coverage.*
|
|
41
|
+
.cache
|
|
42
|
+
nosetests.xml
|
|
43
|
+
coverage.xml
|
|
44
|
+
*.cover
|
|
45
|
+
*.py,cover
|
|
46
|
+
.hypothesis/
|
|
47
|
+
.pytest_cache/
|
|
48
|
+
|
|
49
|
+
# Translations
|
|
50
|
+
*.mo
|
|
51
|
+
*.pot
|
|
52
|
+
|
|
53
|
+
# Environments
|
|
54
|
+
.env
|
|
55
|
+
.venv
|
|
56
|
+
env/
|
|
57
|
+
venv/
|
|
58
|
+
ENV/
|
|
59
|
+
env.bak/
|
|
60
|
+
venv.bak/
|
|
61
|
+
|
|
62
|
+
# IDE
|
|
63
|
+
.idea/
|
|
64
|
+
.vscode/
|
|
65
|
+
*.swp
|
|
66
|
+
*.swo
|
|
67
|
+
*~
|
|
68
|
+
|
|
69
|
+
# mypy
|
|
70
|
+
.mypy_cache/
|
|
71
|
+
.dmypy.json
|
|
72
|
+
dmypy.json
|
|
73
|
+
|
|
74
|
+
# ruff
|
|
75
|
+
.ruff_cache/
|
|
76
|
+
|
|
77
|
+
# Local development
|
|
78
|
+
.DS_Store
|
|
79
|
+
*.local
|
|
80
|
+
|
|
81
|
+
# Secrets (never commit)
|
|
82
|
+
*.key
|
|
83
|
+
*.pem
|
|
84
|
+
.env.local
|
|
85
|
+
.env.*.local
|
glacis-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2024-2025 Glacis, Inc.
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
glacis-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: glacis
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: GLACIS SDK for Python - AI Compliance Attestation
|
|
5
|
+
Project-URL: Homepage, https://glacis.io
|
|
6
|
+
Project-URL: Documentation, https://docs.glacis.io/sdk/python
|
|
7
|
+
Project-URL: Repository, https://github.com/Glacis-io/glacis-python
|
|
8
|
+
Project-URL: Issues, https://github.com/Glacis-io/glacis-python/issues
|
|
9
|
+
Author-email: GLACIS <sdk@glacis.io>
|
|
10
|
+
License-Expression: Apache-2.0
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: ai,attestation,compliance,logging,transparency
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Topic :: Security :: Cryptography
|
|
22
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
|
+
Requires-Python: >=3.9
|
|
24
|
+
Requires-Dist: httpx>=0.25.0
|
|
25
|
+
Requires-Dist: pydantic>=2.0.0
|
|
26
|
+
Requires-Dist: pynacl>=1.5.0
|
|
27
|
+
Provides-Extra: all
|
|
28
|
+
Requires-Dist: anthropic>=0.20.0; extra == 'all'
|
|
29
|
+
Requires-Dist: mypy>=1.0.0; extra == 'all'
|
|
30
|
+
Requires-Dist: openai>=1.0.0; extra == 'all'
|
|
31
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'all'
|
|
32
|
+
Requires-Dist: pytest-httpx>=0.22.0; extra == 'all'
|
|
33
|
+
Requires-Dist: pytest>=7.0.0; extra == 'all'
|
|
34
|
+
Requires-Dist: ruff>=0.1.0; extra == 'all'
|
|
35
|
+
Requires-Dist: wasmtime>=18.0.0; extra == 'all'
|
|
36
|
+
Provides-Extra: anthropic
|
|
37
|
+
Requires-Dist: anthropic>=0.20.0; extra == 'anthropic'
|
|
38
|
+
Provides-Extra: dev
|
|
39
|
+
Requires-Dist: mypy>=1.0.0; extra == 'dev'
|
|
40
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
|
|
41
|
+
Requires-Dist: pytest-httpx>=0.22.0; extra == 'dev'
|
|
42
|
+
Requires-Dist: pytest>=7.0.0; extra == 'dev'
|
|
43
|
+
Requires-Dist: ruff>=0.1.0; extra == 'dev'
|
|
44
|
+
Provides-Extra: openai
|
|
45
|
+
Requires-Dist: openai>=1.0.0; extra == 'openai'
|
|
46
|
+
Provides-Extra: wasm
|
|
47
|
+
Requires-Dist: wasmtime>=18.0.0; extra == 'wasm'
|
|
48
|
+
Description-Content-Type: text/markdown
|
|
49
|
+
|
|
50
|
+
# Glacis Python SDK
|
|
51
|
+
|
|
52
|
+
[](https://badge.fury.io/py/glacis)
|
|
53
|
+
[](https://github.com/Glacis-io/glacis-python/actions/workflows/test.yml)
|
|
54
|
+
[](https://www.python.org/downloads/)
|
|
55
|
+
[](https://opensource.org/licenses/Apache-2.0)
|
|
56
|
+
|
|
57
|
+
**Cryptographic attestation for AI systems.** Prove what your AI did, what data it saw, and what controls were active - without sensitive data leaving your environment.
|
|
58
|
+
|
|
59
|
+
## Installation
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
pip install glacis
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
With provider integrations:
|
|
66
|
+
```bash
|
|
67
|
+
pip install glacis[openai] # OpenAI auto-attestation
|
|
68
|
+
pip install glacis[anthropic] # Anthropic auto-attestation
|
|
69
|
+
pip install glacis[all] # Everything
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Quick Start
|
|
73
|
+
|
|
74
|
+
### Offline Mode (No API Key Required)
|
|
75
|
+
|
|
76
|
+
Works immediately. Receipts are self-signed and marked "UNVERIFIED."
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
from glacis import Glacis
|
|
80
|
+
|
|
81
|
+
glacis = Glacis(mode="offline")
|
|
82
|
+
|
|
83
|
+
# Attest an AI interaction
|
|
84
|
+
receipt = glacis.attest(
|
|
85
|
+
service_id="my-ai-app",
|
|
86
|
+
operation_type="inference",
|
|
87
|
+
input={"prompt": "Summarize this document..."}, # Hashed locally
|
|
88
|
+
output={"response": "The document discusses..."}, # Never sent
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
print(f"Receipt ID: {receipt.attestation_id}")
|
|
92
|
+
print(f"Witness status: {receipt.witness_status}") # "UNVERIFIED"
|
|
93
|
+
|
|
94
|
+
# Verify locally
|
|
95
|
+
result = glacis.verify(receipt)
|
|
96
|
+
print(f"Signature valid: {result.signature_valid}")
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Online Mode (Witnessed Attestation)
|
|
100
|
+
|
|
101
|
+
Add an API key for cryptographically witnessed receipts with Merkle proofs.
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
from glacis import Glacis
|
|
105
|
+
|
|
106
|
+
glacis = Glacis(api_key="glsk_live_...") # Get yours at glacis.io
|
|
107
|
+
|
|
108
|
+
receipt = glacis.attest(
|
|
109
|
+
service_id="my-ai-app",
|
|
110
|
+
operation_type="inference",
|
|
111
|
+
input={"prompt": "..."},
|
|
112
|
+
output={"response": "..."},
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
print(f"Leaf index: {receipt.leaf_index}")
|
|
116
|
+
print(f"Merkle root: {receipt.signed_tree_head.root_hash}")
|
|
117
|
+
print(f"Badge URL: {receipt.badge_url}") # Shareable verification link
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Auto-Attesting OpenAI
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
from glacis.integrations.openai import attested_openai, get_last_receipt
|
|
124
|
+
|
|
125
|
+
client = attested_openai(
|
|
126
|
+
glacis_api_key="glsk_live_...",
|
|
127
|
+
openai_api_key="sk-..."
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
response = client.chat.completions.create(
|
|
131
|
+
model="gpt-4",
|
|
132
|
+
messages=[{"role": "user", "content": "Hello!"}]
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
# Receipt is automatically created
|
|
136
|
+
receipt = get_last_receipt()
|
|
137
|
+
print(f"Attested: {receipt.badge_url}")
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Auto-Attesting Anthropic
|
|
141
|
+
|
|
142
|
+
```python
|
|
143
|
+
from glacis.integrations.anthropic import attested_anthropic, get_last_receipt
|
|
144
|
+
|
|
145
|
+
client = attested_anthropic(
|
|
146
|
+
glacis_api_key="glsk_live_...",
|
|
147
|
+
anthropic_api_key="sk-..."
|
|
148
|
+
)
|
|
149
|
+
|
|
150
|
+
response = client.messages.create(
|
|
151
|
+
model="claude-3-opus-20240229",
|
|
152
|
+
max_tokens=1024,
|
|
153
|
+
messages=[{"role": "user", "content": "Hello!"}]
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
receipt = get_last_receipt()
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## What Data Leaves Your Environment?
|
|
160
|
+
|
|
161
|
+
**Only hashes. Never payloads.**
|
|
162
|
+
|
|
163
|
+
| What | Sent to Glacis? |
|
|
164
|
+
|------|-----------------|
|
|
165
|
+
| Your prompts | No - SHA-256 hash only |
|
|
166
|
+
| Model responses | No - SHA-256 hash only |
|
|
167
|
+
| API keys | No |
|
|
168
|
+
| Metadata (service_id, operation_type) | Yes |
|
|
169
|
+
| Timestamps | Yes |
|
|
170
|
+
|
|
171
|
+
This is the "zero-egress" design. Your sensitive data stays local; only cryptographic commitments are transmitted for witnessing.
|
|
172
|
+
|
|
173
|
+
## Offline vs Online Mode
|
|
174
|
+
|
|
175
|
+
| Feature | Offline | Online |
|
|
176
|
+
|---------|---------|--------|
|
|
177
|
+
| API key required | No | Yes |
|
|
178
|
+
| Signing | Local Ed25519 | Glacis witness network |
|
|
179
|
+
| Merkle proofs | No | Yes |
|
|
180
|
+
| Transparency log | No | Yes |
|
|
181
|
+
| Verification URL | No | Yes |
|
|
182
|
+
| Witness status | "UNVERIFIED" | "VERIFIED" |
|
|
183
|
+
|
|
184
|
+
**Offline mode is fully functional** - correct crypto, local verification, production-grade Ed25519. The only difference is the absence of an independent witness anchor.
|
|
185
|
+
|
|
186
|
+
Use offline for development. Upgrade to online when you need third-party verifiability (audits, papers, customer due diligence).
|
|
187
|
+
|
|
188
|
+
## CLI
|
|
189
|
+
|
|
190
|
+
Verify a receipt:
|
|
191
|
+
```bash
|
|
192
|
+
python -m glacis verify receipt.json
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## Async Support
|
|
196
|
+
|
|
197
|
+
```python
|
|
198
|
+
from glacis import AsyncGlacis
|
|
199
|
+
|
|
200
|
+
async with AsyncGlacis(api_key="glsk_live_...") as glacis:
|
|
201
|
+
receipt = await glacis.attest(
|
|
202
|
+
service_id="my-service",
|
|
203
|
+
operation_type="inference",
|
|
204
|
+
input={"prompt": "Hello"},
|
|
205
|
+
output={"response": "Hi!"},
|
|
206
|
+
)
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## Query the Transparency Log
|
|
210
|
+
|
|
211
|
+
```python
|
|
212
|
+
# Browse public attestations (no auth required)
|
|
213
|
+
result = glacis.query_log(
|
|
214
|
+
org_id="org_xxx",
|
|
215
|
+
service_id="my-service",
|
|
216
|
+
start="2024-01-01T00:00:00Z",
|
|
217
|
+
limit=100,
|
|
218
|
+
)
|
|
219
|
+
|
|
220
|
+
for entry in result.entries:
|
|
221
|
+
print(f"{entry.timestamp}: {entry.operation_type}")
|
|
222
|
+
|
|
223
|
+
# Get current tree state
|
|
224
|
+
tree = glacis.get_tree_head()
|
|
225
|
+
print(f"Tree size: {tree.size}")
|
|
226
|
+
print(f"Root hash: {tree.root_hash}")
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
## Cross-Runtime Hash Compatibility
|
|
230
|
+
|
|
231
|
+
The Python SDK produces identical hashes to the TypeScript and Rust SDKs:
|
|
232
|
+
|
|
233
|
+
```python
|
|
234
|
+
from glacis.crypto import hash_payload
|
|
235
|
+
|
|
236
|
+
# These all produce the same hash across Python, TypeScript, and Rust
|
|
237
|
+
hash1 = hash_payload({"b": 2, "a": 1})
|
|
238
|
+
hash2 = hash_payload({"a": 1, "b": 2})
|
|
239
|
+
assert hash1 == hash2 # Keys are sorted per RFC 8785
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
## Security & Trust
|
|
243
|
+
|
|
244
|
+
- **Cryptography**: Ed25519 signatures via PyNaCl (libsodium) or WASM
|
|
245
|
+
- **Hashing**: SHA-256 with RFC 8785 canonical JSON (cross-runtime compatible)
|
|
246
|
+
- **Transparency**: Online receipts are included in an append-only Merkle tree (RFC 6962)
|
|
247
|
+
|
|
248
|
+
### Threat Model
|
|
249
|
+
|
|
250
|
+
Glacis provides cryptographic evidence that a specific operation occurred on a specific input/output pair at a specific time. It does not:
|
|
251
|
+
- Prevent AI from misbehaving (it attests, not enforces)
|
|
252
|
+
- Hide that an AI system exists (receipts are evidence of operation)
|
|
253
|
+
- Guarantee the AI output was correct (only that it was attested)
|
|
254
|
+
|
|
255
|
+
### Security Disclosure
|
|
256
|
+
|
|
257
|
+
Report vulnerabilities to security@glacis.io
|
|
258
|
+
|
|
259
|
+
## API Reference
|
|
260
|
+
|
|
261
|
+
### Glacis
|
|
262
|
+
|
|
263
|
+
```python
|
|
264
|
+
from glacis import Glacis
|
|
265
|
+
|
|
266
|
+
# Online mode (default)
|
|
267
|
+
glacis = Glacis(api_key="glsk_live_...")
|
|
268
|
+
|
|
269
|
+
# Offline mode
|
|
270
|
+
glacis = Glacis(mode="offline")
|
|
271
|
+
glacis = Glacis(mode="offline", signing_seed=os.urandom(32))
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### glacis.attest()
|
|
275
|
+
|
|
276
|
+
```python
|
|
277
|
+
receipt = glacis.attest(
|
|
278
|
+
service_id="my-service", # Required
|
|
279
|
+
operation_type="inference", # Required
|
|
280
|
+
input={"prompt": "..."}, # Hashed, not sent
|
|
281
|
+
output={"response": "..."}, # Hashed, not sent
|
|
282
|
+
metadata={"model": "gpt-4"}, # Optional, sent as-is
|
|
283
|
+
)
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### glacis.verify()
|
|
287
|
+
|
|
288
|
+
```python
|
|
289
|
+
result = glacis.verify(receipt)
|
|
290
|
+
print(result.valid) # Overall validity
|
|
291
|
+
print(result.signature_valid) # Signature check
|
|
292
|
+
print(result.proof_valid) # Merkle proof check (online only)
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
### AttestReceipt
|
|
296
|
+
|
|
297
|
+
| Field | Description |
|
|
298
|
+
|-------|-------------|
|
|
299
|
+
| `attestation_id` | Unique attestation ID |
|
|
300
|
+
| `timestamp` | ISO 8601 timestamp |
|
|
301
|
+
| `leaf_index` | Merkle tree leaf index |
|
|
302
|
+
| `merkle_proof` | Inclusion proof |
|
|
303
|
+
| `signed_tree_head` | Signed tree state |
|
|
304
|
+
| `badge_url` | Verification badge URL |
|
|
305
|
+
| `verify_url` | Verification endpoint |
|
|
306
|
+
|
|
307
|
+
## Pricing
|
|
308
|
+
|
|
309
|
+
| Tier | Price | Includes |
|
|
310
|
+
|------|-------|----------|
|
|
311
|
+
| Offline | Free | Local signing, "UNVERIFIED" status |
|
|
312
|
+
| Starter | Contact us | Witnessed attestation, Merkle proofs |
|
|
313
|
+
| Enterprise | Custom | SLA, compliance exports, dedicated support |
|
|
314
|
+
|
|
315
|
+
Get started at [glacis.io](https://glacis.io)
|
|
316
|
+
|
|
317
|
+
## License
|
|
318
|
+
|
|
319
|
+
Apache 2.0. See [LICENSE](LICENSE).
|
|
320
|
+
|
|
321
|
+
## Links
|
|
322
|
+
|
|
323
|
+
- [Documentation](https://docs.glacis.io)
|
|
324
|
+
- [Changelog](CHANGELOG.md)
|