INNER CODE UNIT · Python

_store_activation

bunkeriot/BunkerM · backend/app/agent-api/main.py:110

def _store_activation(key: str):
    DATA_DIR.mkdir(parents=True, exist_ok=True)
    ACTIVATION_FILE.write_text(json.dumps({"key": key}))


async def _try_auto_activate(instance_id: str) -> bool:
    """Call BunkerAI Cloud to get a license key. Returns True on success."""
    try:
        async with httpx.AsyncClient(timeout=8.0) as client:
            resp = await client.post(
                f"{CLOUD_URL}/activate",
                json={"instance_id": instance_id},
            )
            if resp.status_code == 200:
                key = resp.json().get("key", "")
                if _verify_key(key, instance_id):
                    _store_activation(key)
                    logger.info(f"Auto-activation successful for {instance_id}")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…