-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Split out static auth methods from Auth object #1810
Conversation
def check(self, event, auth_events, do_sig_check=True): | ||
class Auther(object): | ||
@staticmethod | ||
def check(event, auth_events, do_sig_check=True): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to make these top level functions rather than staticmethods?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe? Would you prefer that? I somewhat like having all the helper functions for check
bundled together
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer that. I would also prefer it we took this opportunity to move the event auth functions to a separate file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(which would go someway towards separating the code for authing CS interactions from code for authing events)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
with Measure(self.clock, "auth.check"): | ||
Auther.check(event, auth_events, do_sig_check=do_sig_check) | ||
|
||
def check_size_limits(self, event): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't check_size_limits defined as a staticmethod on the Auther class above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -975,54 +562,7 @@ def compute_auth_events(self, event, current_state_ids, for_verification=False): | |||
defer.returnValue(auth_ids) | |||
|
|||
def _get_send_level(self, etype, state_key, auth_events): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is _get_send_level called from anywhere? I can't see a reference to it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks amazing compared to the previous auth code. LGTM
Part of #1808