'Decode the given response and attempt to generate a
L{DigestedCredentials} from it.
@type response: L{bytes}
@param response: A string of comma separated key=value pairs
@type method: L{bytes}
@param method: The action requested to which this response is addressed
(GET, POST, INVITE, OPTIONS, etc).
@type host: L{bytes}
@param host: The address the request was sent from.
@raise error.LoginFailed: If the response does not contain a username,
a nonce, an opaque, or if the opaque is invalid.
@return: L{DigestedCredentials}'

def decode(self, response, method, host):

    response = '    '.join(response.splitlines())
    parts = self._parseparts.findall(response)
    auth = {}
    for (key, bare, quoted) in parts:
        value = (quoted or bare).strip()
        auth[nativeString(key.strip())] = value
    username = auth.get('username')
    if (not username):
        raise error.LoginFailed('Invalid    response,    no    username    given.')
    if ('opaque' not in auth):
        raise error.LoginFailed('Invalid    response,    no    opaque    given.')
    if ('nonce' not in auth):
        raise error.LoginFailed('Invalid    response,    no    nonce    given.')
    if self._verifyOpaque(auth.get('opaque'), auth.get('nonce'), host):
        return DigestedCredentials(username, method, self.authenticationRealm, auth)
