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

Method revoke_api_key

astrbot/core/db/sqlite.py:895–906  ·  view source on GitHub ↗

Revoke an API key.

(self, key_id: str)

Source from the content-addressed store, hash-verified

893 )
894
895 async def revoke_api_key(self, key_id: str) -> bool:
896 """Revoke an API key."""
897 async with self.get_db() as session:
898 session: AsyncSession
899 async with session.begin():
900 query = (
901 update(ApiKey)
902 .where(col(ApiKey.key_id) == key_id)
903 .values(revoked_at=datetime.now(timezone.utc))
904 )
905 result = T.cast(CursorResult, await session.execute(query))
906 return result.rowcount > 0
907
908 async def delete_api_key(self, key_id: str) -> bool:
909 """Delete an API key."""

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected