async def authenticate_api_key(self, api_key: str) -> User:
        """Authenticate using an API key of the form "public_key.raw_key".

        Returns a User if successful, or raises R2RException if not.
        """
        try:
            key_id, raw_key = api_key.split(".", 1)
        except ValueError as e:
            raise R2RException(
                status_code=401, message="Invalid API key format"
            ) from e

        key_record = (
            await self.database_provider.users_handler.get_api_key_record(
                key_id=key_id
            )
        )
        if not key_record:
            raise R2RException(status_code=401, message="Invalid API key")

        if not self.crypto_provider.verify_api_key(
            raw_api_key=raw_key, hashed_key=key_record["hashed_key"]
        ):
            raise R2RException(status_code=401, message="Invalid API key")

        user = await self.database_provider.users_handler.get_user_by_id(
            id=key_record["user_id"]
        )
        if not user.is_active:
            raise R2RException(
                status_code=401, message="User account is inactive"
            )

        return user
Authenticate using an API key of the form "public_key.raw_key".

        Returns a User if successful, or raises R2RException if not.
        
py/core/providers/auth/r2r_auth.py