summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/keymanager/nicknym.py
diff options
context:
space:
mode:
authorKali Kaneko (leap communications) <kali@leap.se>2016-11-30 10:20:08 +0100
committerKali Kaneko (leap communications) <kali@leap.se>2016-11-30 10:34:20 +0100
commit7e7e54c5ef5a53e66e4bd0578b24bb1fc62db797 (patch)
tree3bed438067025f6c7bb79713598b3ad959c45456 /src/leap/bitmask/keymanager/nicknym.py
parent2d700b6785d583782bbb3d76690866b64b969f52 (diff)
[bug] make srp token changes propagate to nicknym object
the token is set when we get the srp token in the keymanager service, but it wasn't been propagated properly to the internal nicknym object that was refactored recently. here I make the setter write the same token to both keymanager itself and the nicknym. some little additional refactors: - move gpg initialization to a helper method in this way it becomes easier to stub the soledad and keymanager components, for testing. - name nicknym token as publicly visible, since i'm accessing it from the keymanager object. - Resolves: #8651
Diffstat (limited to 'src/leap/bitmask/keymanager/nicknym.py')
-rw-r--r--src/leap/bitmask/keymanager/nicknym.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/leap/bitmask/keymanager/nicknym.py b/src/leap/bitmask/keymanager/nicknym.py
index 5fe9992..7c738da 100644
--- a/src/leap/bitmask/keymanager/nicknym.py
+++ b/src/leap/bitmask/keymanager/nicknym.py
@@ -43,7 +43,7 @@ class Nicknym(object):
def __init__(self, nickserver_uri, ca_cert_path, token):
self._nickserver_uri = nickserver_uri
self._async_client_pinned = HTTPClient(ca_cert_path)
- self._token = token
+ self.token = token
@defer.inlineCallbacks
def put_key(self, uid, key_data, api_uri, api_version):
@@ -72,11 +72,11 @@ class Nicknym(object):
uid)
leap_assert(
- self._token is not None,
+ self.token is not None,
'We need a token to interact with webapp!')
if type(data) == dict:
data = urllib.urlencode(data)
- headers = {'Authorization': [str('Token token=%s' % self._token)]}
+ headers = {'Authorization': [str('Token token=%s' % self.token)]}
headers['Content-Type'] = ['application/x-www-form-urlencoded']
try:
res = yield self._async_client_pinned.request(str(uri), 'PUT',