MCPcopy Index your code
hub / github.com/AstrBotDevs/AstrBot / touch_api_key

Method touch_api_key

astrbot/core/db/sqlite.py:884–893  ·  view source on GitHub ↗

Update last_used_at of an API key.

(self, key_id: str)

Source from the content-addressed store, hash-verified

882 return result.scalar_one_or_none()
883
884 async def touch_api_key(self, key_id: str) -> None:
885 """Update last_used_at of an API key."""
886 async with self.get_db() as session:
887 session: AsyncSession
888 async with session.begin():
889 await session.execute(
890 update(ApiKey)
891 .where(col(ApiKey.key_id) == key_id)
892 .values(last_used_at=datetime.now(timezone.utc)),
893 )
894
895 async def revoke_api_key(self, key_id: str) -> bool:
896 """Revoke an API key."""

Callers

nothing calls this directly

Calls 5

nowMethod · 0.80
updateFunction · 0.50
get_dbMethod · 0.45
executeMethod · 0.45
valuesMethod · 0.45

Tested by

no test coverage detected