MOSS cryptographic signing integration for Google Gemini
Project description
moss-google
MOSS signing integration for Google GenAI SDK (Gemini). Unsigned output is broken output.
Installation
pip install moss-google
Quick Start
Sign function calls, responses, and content from Gemini:
import google.generativeai as genai
from moss_google import sign_function_call, sign_response, sign_content
genai.configure(api_key="...")
model = genai.GenerativeModel("gemini-pro")
# Get a response with function calling
response = model.generate_content(
"What's the weather in NYC?",
tools=[get_weather_tool]
)
# Sign the full response
result = sign_response(response, agent_id="weather-bot")
print(f"Signed: {result.signature[:20]}...")
# Sign individual function calls
for part in response.candidates[0].content.parts:
if hasattr(part, "function_call"):
result = sign_function_call(part.function_call, agent_id="weather-bot")
Enterprise Mode
Set MOSS_API_KEY for automatic policy evaluation:
import os
os.environ["MOSS_API_KEY"] = "your-api-key"
from moss_google import sign_function_call, enterprise_enabled
print(f"Enterprise: {enterprise_enabled()}") # True
result = sign_function_call(
function_call,
agent_id="finance-bot",
context={"user_id": "u123"}
)
if result.blocked:
print(f"Blocked by policy: {result.policy.reason}")
Verification
from moss_google import verify_envelope
verify_result = verify_envelope(result.envelope)
if verify_result.valid:
print(f"Signed by: {verify_result.subject}")
All Functions
| Function | Description |
|---|---|
sign_function_call() |
Sign a function call |
sign_function_call_async() |
Async version |
sign_response() |
Sign a GenerateContentResponse |
sign_response_async() |
Async version |
sign_content() |
Sign a Content object |
sign_content_async() |
Async version |
sign_part() |
Sign a Part (text or function call) |
sign_part_async() |
Async version |
verify_envelope() |
Verify a signed envelope |
Enterprise Features
| Feature | Free | Enterprise |
|---|---|---|
| Local signing | ✓ | ✓ |
| Offline verification | ✓ | ✓ |
| Policy evaluation | - | ✓ |
| Evidence retention | - | ✓ |
| Audit exports | - | ✓ |
Links
- moss-sdk - Core MOSS SDK
- mosscomputing.com - Project site
License
This package is licensed under the Business Source License 1.1.
- Free for evaluation, testing, and development
- Free for non-production use
- Production use requires a MOSS subscription
- Converts to Apache 2.0 on January 25, 2030
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file moss_google-1.0.0.tar.gz.
File metadata
- Download URL: moss_google-1.0.0.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1daf823aa1819ce398b05eaa11c572caea3e33aa5342f4d8bf3be1b860eb5e7d
|
|
| MD5 |
6cd025f7bbc277038bcfe28650fb9c3c
|
|
| BLAKE2b-256 |
262402adc0adcfe0d48f0232c11a71fd5347c6889649aa7b7fc65d82c2d7d28e
|
Provenance
The following attestation bundles were made for moss_google-1.0.0.tar.gz:
Publisher:
publish.yml on mosscomputing/moss-google
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
moss_google-1.0.0.tar.gz -
Subject digest:
1daf823aa1819ce398b05eaa11c572caea3e33aa5342f4d8bf3be1b860eb5e7d - Sigstore transparency entry: 854528061
- Sigstore integration time:
-
Permalink:
mosscomputing/moss-google@ec6e4e85beb300e7937518fb33a39fe048e0dd20 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/mosscomputing
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ec6e4e85beb300e7937518fb33a39fe048e0dd20 -
Trigger Event:
release
-
Statement type:
File details
Details for the file moss_google-1.0.0-py3-none-any.whl.
File metadata
- Download URL: moss_google-1.0.0-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab5453a858f78bb8b12ec1a5986bcc09148dbbdfef2f7f3418c1ce24a0e9bcfe
|
|
| MD5 |
93336feade8a917d39bbeebed6700fc7
|
|
| BLAKE2b-256 |
3503dae082b59c2411f7b0e2a9a5ef65935cee05e1cb04ed8e11113823a9f816
|
Provenance
The following attestation bundles were made for moss_google-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on mosscomputing/moss-google
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
moss_google-1.0.0-py3-none-any.whl -
Subject digest:
ab5453a858f78bb8b12ec1a5986bcc09148dbbdfef2f7f3418c1ce24a0e9bcfe - Sigstore transparency entry: 854528065
- Sigstore integration time:
-
Permalink:
mosscomputing/moss-google@ec6e4e85beb300e7937518fb33a39fe048e0dd20 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/mosscomputing
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ec6e4e85beb300e7937518fb33a39fe048e0dd20 -
Trigger Event:
release
-
Statement type: