Review and changes from Jocelyn Fiat

probably we could merge is_valid_basic_credential and is_valid_digest_credential