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

Commit

Permalink
make lint and isort happy, and add a changelog entry
Browse files Browse the repository at this point in the history
  • Loading branch information
uhoreg committed Mar 29, 2019
1 parent 487e989 commit df95f2d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 16 deletions.
1 change: 1 addition & 0 deletions changelog.d/4970.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add support for cross-signing.
26 changes: 14 additions & 12 deletions synapse/handlers/e2e_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,24 @@
from six import iteritems

from canonicaljson import encode_canonical_json, json

from twisted.internet import defer

from signedjson.key import decode_verify_key_bytes, encode_verify_key_base64
from signedjson.sign import SignatureVerifyException, verify_signed_json
from unpaddedbase64 import decode_base64

from synapse.api.errors import Codes, CodeMessageException, FederationDeniedError, \
SynapseError
from twisted.internet import defer

from synapse.api.errors import (
CodeMessageException,
Codes,
FederationDeniedError,
SynapseError,
)
from synapse.types import UserID, get_domain_from_id
from synapse.util.async_helpers import Linearizer
from synapse.util.caches.expiringcache import ExpiringCache
from synapse.util.logcontext import make_deferred_yieldable, run_in_background
from synapse.util.retryutils import NotRetryingDestination

from unpaddedbase64 import decode_base64

logger = logging.getLogger(__name__)


Expand Down Expand Up @@ -199,7 +201,7 @@ def get_self_signing_key(user_id):
try:
self_signing_keys[user_id] = \
yield self.store.get_e2e_self_signing_key(user_id, from_user_id)
except Exception as e:
except Exception:
pass

yield make_deferred_yieldable(defer.gatherResults([
Expand Down Expand Up @@ -465,7 +467,7 @@ def upload_signing_keys_for_user(self, user_id, keys):
)
try:
verify_signed_json(self_signing_key, user_id, old_verify_key)
except SignatureVerifyException as e:
except SignatureVerifyException:
raise SynapseError(
400,
"Invalid signature on self-signing key",
Expand Down Expand Up @@ -499,7 +501,7 @@ def upload_signing_keys_for_user(self, user_id, keys):
)
try:
verify_signed_json(user_signing_key, user_id, verify_key)
except SignatureVerifyException as e:
except SignatureVerifyException:
raise SynapseError(
400,
"Invalid signature on user-signing key",
Expand Down Expand Up @@ -614,7 +616,7 @@ def upload_signatures_for_device_keys(self, user_id, signatures):
}
try:
verify_signed_json(key, user_id, self_signing_verify_key)
except SignatureVerifyException as e:
except SignatureVerifyException:
logger.error("invalid signature on key")
raise SynapseError(
400,
Expand Down Expand Up @@ -745,7 +747,7 @@ def upload_signatures_for_device_keys(self, user_id, signatures):
}
try:
verify_signed_json(key, user_id, user_signing_verify_key)
except SignatureVerifyException as e:
except SignatureVerifyException:
logger.error("invalid signature on key")
raise SynapseError(
400,
Expand Down
4 changes: 2 additions & 2 deletions synapse/storage/end_to_end_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import time

from six import iteritems

from canonicaljson import encode_canonical_json, json
Expand All @@ -21,8 +23,6 @@

from synapse.util.caches.descriptors import cached

import time

from ._base import SQLBaseStore, db_to_json


Expand Down
4 changes: 2 additions & 2 deletions tests/handlers/test_e2e_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@

import mock

from twisted.internet import defer

import signedjson.key as key
import signedjson.sign as sign

from twisted.internet import defer

import synapse.api.errors
import synapse.handlers.e2e_keys
import synapse.storage
Expand Down

0 comments on commit df95f2d

Please sign in to comment.