Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Split out static auth methods from Auth object #1810

Merged
merged 3 commits into from
Jan 13, 2017

Conversation

erikjohnston
Copy link
Member

@erikjohnston erikjohnston commented Jan 13, 2017

Part of #1808

def check(self, event, auth_events, do_sig_check=True):
class Auther(object):
@staticmethod
def check(event, auth_events, do_sig_check=True):
Copy link
Contributor

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?

Copy link
Member Author

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

Copy link
Contributor

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.

Copy link
Contributor

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)

Copy link
Member Author

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):
Copy link
Contributor

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?

Copy link
Member Author

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):
Copy link
Contributor

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.

Copy link
Contributor

@NegativeMjark NegativeMjark left a 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

@erikjohnston erikjohnston merged commit 95a22ae into develop Jan 13, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants