Google Workspace Integration¶
PrimeStamp integrates with Google Workspace to provide automatic timestamping and authentication for documents stored in Google Drive, including Google Docs, Sheets, and Slides. This enables cryptographic proof of document state without leaving the Google ecosystem.
Features¶
- Automatic stamping of Google Docs, Sheets, and Slides
- Google Drive file monitoring and change detection
- Version history tracking with PrimeStamp chain proofs
- Shared Drive support for team-wide stamping
- OAuth 2.0 authentication via Google Cloud service accounts
Setup¶
1. Create a Google Cloud Service Account¶
# Configure OAuth credentials
primestamp config set google.client_id "YOUR_CLIENT_ID"
primestamp config set google.client_secret "YOUR_CLIENT_SECRET"
primestamp config set google.redirect_uri "http://localhost:8080/callback"
2. Authorize PrimeStamp¶
# Start the OAuth flow
primestamp integrations google auth
# Or provide a service account key file for server-to-server auth
primestamp config set google.service_account_key "/path/to/key.json"
3. Enable Drive Monitoring¶
# Watch a specific folder
primestamp integrations google watch --folder-id "FOLDER_ID"
# Watch an entire Shared Drive
primestamp integrations google watch --drive-id "DRIVE_ID"
Stamping Google Documents¶
CLI¶
# Stamp a specific Google Doc by ID
primestamp integrations google stamp --doc-id "DOCUMENT_ID"
# Stamp all documents in a folder
primestamp integrations google stamp --folder-id "FOLDER_ID" --preset standard
Python API¶
from primestamp.integrations.google_workspace import GoogleWorkspaceIntegration
gw = GoogleWorkspaceIntegration(
client_id="YOUR_CLIENT_ID",
client_secret="YOUR_CLIENT_SECRET",
)
# Stamp a Google Doc
result = await gw.stamp_document(
doc_id="DOCUMENT_ID",
preset="standard",
)
print(f"Stamp ID: {result['stamp_id']}")
Supported File Types¶
| Google Format | Export Format for Hashing | Notes |
|---|---|---|
| Google Docs | PDF or DOCX | Exported and hashed as a stable format |
| Google Sheets | XLSX or CSV | Each sheet can be stamped individually |
| Google Slides | PDF or PPTX | Slide deck exported as a single file |
| Uploaded files | Original format | Binary content hashed directly |
Configuration¶
[integrations.google]
client_id = "YOUR_CLIENT_ID"
client_secret = "YOUR_CLIENT_SECRET"
service_account_key = "/path/to/key.json" # optional, for server-to-server
export_format = "pdf" # pdf, docx, xlsx, csv
auto_stamp = true
watch_interval_seconds = 300
preset = "standard"
| Option | Default | Description |
|---|---|---|
export_format |
pdf |
Format used to export Google-native documents for hashing. |
auto_stamp |
true |
Automatically stamp documents when changes are detected. |
watch_interval_seconds |
300 |
Polling interval for Drive change detection. |
preset |
standard |
Default stamping preset. |
Export Format Consistency
Google Docs are converted to a static format (PDF/DOCX) before hashing. The same document may produce different export bytes at different times due to rendering changes. For maximum consistency, use pdf as the export format and pin a specific export version.
Shared Drives
For organization-wide stamping, use a Google Cloud service account with domain-wide delegation. This allows PrimeStamp to access and stamp documents across the entire organization without per-user OAuth flows.