web/docs/api/examples/governance-installer.examples.md

163 lines
3.4 KiB
Markdown

# Governance Installer API Examples
## Create Install Token
### Request
```http
POST /governance/install/token
Authorization: Bearer <wallet-session>
Content-Type: application/json
{
"wallet": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"org_root_id": "org.acme.root",
"principal_id": "human.joshua",
"principal_role": "org_root_owner",
"device_id": "desktop-7f6f3a9b",
"launcher_version": "0.2.0",
"platform": "macos",
"current_runtime_version": "0.0.0"
}
```
### Response
```json
{
"install_token": "git_01J9B6A97WQG8GNYM4ZBX8E2NQ",
"install_token_expires_at": "2026-02-18T01:05:00Z",
"wallet": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"entitlement_id": "ent_governance_001",
"package": {
"runtime_version": "1.0.0",
"package_url": "https://cdn.edut.ai/runtime/governance/1.0.0/macos-arm64.pkg",
"package_hash": "sha256:09f6d64f...",
"signature": "ed25519:8db9...",
"signer_key_id": "governance-signer-2026-01",
"policy_hash": "sha256:f10419ac...",
"rollout_channel": "stable"
}
}
```
## Confirm Install
### Request
```http
POST /governance/install/confirm
Authorization: Bearer <wallet-session>
Content-Type: application/json
{
"install_token": "git_01J9B6A97WQG8GNYM4ZBX8E2NQ",
"wallet": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"device_id": "desktop-7f6f3a9b",
"entitlement_id": "ent_governance_001",
"package_hash": "sha256:09f6d64f...",
"runtime_version": "1.0.0",
"installed_at": "2026-02-18T01:01:48Z",
"launcher_receipt_hash": "sha256:8102d437..."
}
```
### Response
```json
{
"status": "governance_active",
"wallet": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"device_id": "desktop-7f6f3a9b",
"entitlement_id": "ent_governance_001",
"runtime_version": "1.0.0",
"activated_at": "2026-02-18T01:01:50Z"
}
```
## Install Status
### Request
```http
GET /governance/install/status?wallet=0x742d35Cc6634C0532925a3b844Bc454e4438f44e&device_id=desktop-7f6f3a9b
Authorization: Bearer <wallet-session>
```
### Response
```json
{
"wallet": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"org_root_id": "org.acme.root",
"principal_id": "human.joshua",
"principal_role": "org_root_owner",
"membership_status": "active",
"entitlement_status": "active",
"access_class": "connected",
"availability_state": "active",
"activation_status": "active",
"latest_runtime_version": "1.0.0",
"policy_hash": "sha256:f10419ac..."
}
```
## Error: Entitlement Inactive
```json
{
"error": "entitlement_inactive",
"code": "entitlement_inactive",
"correlation_id": "req_01J9B6BJBVKY3N6WQ7TQM2R2P5"
}
```
## `POST /governance/lease/heartbeat`
Request:
```json
{
"wallet": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"org_root_id": "org.acme.root",
"principal_id": "human.joshua",
"device_id": "desktop-7f6f3a9b"
}
```
Success (`200`):
```json
{
"status": "lease_refreshed",
"availability_state": "active",
"lease_expires_at": "2026-03-19T01:05:00Z"
}
```
## `POST /governance/lease/offline-renew`
Request:
```json
{
"wallet": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
"org_root_id": "org.acme.root",
"principal_id": "human.joshua",
"renewal_bundle": {
"bundle_id": "rb_01J9B6D4R0E4W8N6H2A1Q9V7PT",
"signed_payload": "base64:ZXhhbXBsZQ=="
}
}
```
Success (`200`):
```json
{
"status": "renewal_applied",
"availability_state": "active",
"renewed_until": "2027-02-18T00:00:00Z"
}
```