__init__.py 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # -*- coding: utf-8 -*-
  2. # Copyright 2014 OpenMarket Ltd
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. class ValidationSession:
  16. # how long a user can wait before validating a session after starting it
  17. THREEPID_SESSION_VALIDATION_TIMEOUT_MS = 24 * 60 * 60 * 1000
  18. # how long we keep sessions for after they've been validated
  19. THREEPID_SESSION_VALID_LIFETIME_MS = 24 * 60 * 60 * 1000
  20. def __init__(self, _id, _medium, _address, _clientSecret, _validated, _mtime):
  21. self.id = _id
  22. self.medium = _medium
  23. self.address = _address
  24. self.clientSecret = _clientSecret
  25. self.validated = _validated
  26. self.mtime = _mtime
  27. class IncorrectClientSecretException(Exception):
  28. pass
  29. class SessionExpiredException(Exception):
  30. pass
  31. class InvalidSessionIdException(Exception):
  32. pass
  33. class SessionNotValidatedException(Exception):
  34. pass