def check_basic_auth_key(self, key: str) -> bool:
        """Check if *key* matches the password configured for the REST API.

        :param key: the password received through the Basic authorization header of an HTTP request.

        :returns: ``True`` if *key* matches the password configured for the REST API.
        """
        # pyright -- ``__auth_key`` was already checked through the caller method (:func:`check_auth_header`).
        if TYPE_CHECKING:  # pragma: no cover
            assert self.__auth_key is not None
        return hmac.compare_digest(self.__auth_key, key.encode('utf-8'))
Check if *key* matches the password configured for the REST API.

        :param key: the password received through the Basic authorization header of an HTTP request.

        :returns: ``True`` if *key* matches the password configured for the REST API.
        
patroni/api.py