Initial authentication setup - creates user, encrypts DB, generates recovery codes.
()
| 4585 | return True |
| 4586 | |
| 4587 | normalized = timestamp.replace('Z', '+00:00') |
| 4588 | try: |
| 4589 | parsed = datetime.fromisoformat(normalized) |
| 4590 | except ValueError: |
| 4591 | logger.debug(f"Unable to parse Pwnagotchi installer timestamp: {timestamp}") |
| 4592 | return True |
| 4593 | |
| 4594 | age = datetime.now(timezone.utc) - parsed |
| 4595 | return age.total_seconds() > max_age_seconds |
| 4596 | |
| 4597 | |
| 4598 | def _read_pwn_log_chunk(cursor: Optional[int] = None, tail_bytes: int = 4096, max_bytes: int = 8192): |
| 4599 | """Return a slice of the installer log starting at cursor or tail bytes from end.""" |
| 4600 | status = _build_pwnagotchi_status(persist=False) |
| 4601 | log_file = status.get('log_file') |
| 4602 | |
| 4603 | if not log_file or not os.path.exists(log_file): |
| 4604 | return status, None, 0, [] |
| 4605 | |
| 4606 | try: |
| 4607 | file_size = os.path.getsize(log_file) |
| 4608 | except OSError: |
| 4609 | return status, None, 0, [] |
| 4610 | |
| 4611 | if cursor is None or cursor < 0: |
| 4612 | tail_bytes = max(0, min(tail_bytes, 65536)) |
| 4613 | start = max(file_size - tail_bytes, 0) |
| 4614 | else: |
| 4615 | start = max(0, min(cursor, file_size)) |
nothing calls this directly
no test coverage detected