INNER CODE UNIT · Python

pad

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

    pad = 4 - len(s) % 4
    return base64.urlsafe_b64decode(s + ("=" * (pad % 4)))


def _get_or_create_instance_id() -> str:
    DATA_DIR.mkdir(parents=True, exist_ok=True)
    if INSTANCE_FILE.exists():
        return INSTANCE_FILE.read_text().strip()
    # Generate: BKMR- + 8 hex chars (readable for copy-paste)
    instance_id = "BKMR-" + secrets.token_hex(4).upper()
    INSTANCE_FILE.write_text(instance_id)
    logger.info(f"Generated instance ID: {instance_id}")
    return instance_id


def _verify_key(key: str, instance_id: str) -> dict | None:
    """Verify a BKMR- prefixed license key. Returns payload dict or None."""
    if not key.startswith("BKMR-"):

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…