internal rename: appid -> _appid
This commit is contained in:
parent
e6d1b1fb83
commit
13dd359f90
|
@ -131,7 +131,7 @@ class Wormhole:
|
||||||
|
|
||||||
def __init__(self, appid, relay_url):
|
def __init__(self, appid, relay_url):
|
||||||
if not isinstance(appid, type(b"")): raise UsageError
|
if not isinstance(appid, type(b"")): raise UsageError
|
||||||
self.appid = appid
|
self._appid = appid
|
||||||
self._relay_url = relay_url
|
self._relay_url = relay_url
|
||||||
if not self._relay_url.endswith("/"): raise UsageError
|
if not self._relay_url.endswith("/"): raise UsageError
|
||||||
side = hexlify(os.urandom(5)).decode("ascii")
|
side = hexlify(os.urandom(5)).decode("ascii")
|
||||||
|
@ -200,7 +200,7 @@ class Wormhole:
|
||||||
def _start(self):
|
def _start(self):
|
||||||
# allocate the rest now too, so it can be serialized
|
# allocate the rest now too, so it can be serialized
|
||||||
self.sp = SPAKE2_Symmetric(self.code.encode("ascii"),
|
self.sp = SPAKE2_Symmetric(self.code.encode("ascii"),
|
||||||
idSymmetric=self.appid)
|
idSymmetric=self._appid)
|
||||||
self.msg1 = self.sp.start()
|
self.msg1 = self.sp.start()
|
||||||
|
|
||||||
def derive_key(self, purpose, length=SecretBox.KEY_SIZE):
|
def derive_key(self, purpose, length=SecretBox.KEY_SIZE):
|
||||||
|
@ -229,7 +229,7 @@ class Wormhole:
|
||||||
self.channel.send(u"pake", self.msg1)
|
self.channel.send(u"pake", self.msg1)
|
||||||
pake_msg = self.channel.get(u"pake")
|
pake_msg = self.channel.get(u"pake")
|
||||||
self.key = self.sp.finish(pake_msg)
|
self.key = self.sp.finish(pake_msg)
|
||||||
self.verifier = self.derive_key(self.appid+b":Verifier")
|
self.verifier = self.derive_key(self._appid+b":Verifier")
|
||||||
|
|
||||||
def get_verifier(self):
|
def get_verifier(self):
|
||||||
if self.code is None: raise UsageError
|
if self.code is None: raise UsageError
|
||||||
|
|
|
@ -145,7 +145,7 @@ class Wormhole:
|
||||||
|
|
||||||
def __init__(self, appid, relay_url):
|
def __init__(self, appid, relay_url):
|
||||||
if not isinstance(appid, type(b"")): raise UsageError
|
if not isinstance(appid, type(b"")): raise UsageError
|
||||||
self.appid = appid
|
self._appid = appid
|
||||||
self._relay_url = relay_url
|
self._relay_url = relay_url
|
||||||
self._set_side(hexlify(os.urandom(5)).decode("ascii"))
|
self._set_side(hexlify(os.urandom(5)).decode("ascii"))
|
||||||
self.code = None
|
self.code = None
|
||||||
|
@ -215,7 +215,7 @@ class Wormhole:
|
||||||
def _start(self):
|
def _start(self):
|
||||||
# allocate the rest now too, so it can be serialized
|
# allocate the rest now too, so it can be serialized
|
||||||
self.sp = SPAKE2_Symmetric(self.code.encode("ascii"),
|
self.sp = SPAKE2_Symmetric(self.code.encode("ascii"),
|
||||||
idSymmetric=self.appid)
|
idSymmetric=self._appid)
|
||||||
self.msg1 = self.sp.start()
|
self.msg1 = self.sp.start()
|
||||||
|
|
||||||
def serialize(self):
|
def serialize(self):
|
||||||
|
@ -226,7 +226,7 @@ class Wormhole:
|
||||||
if self._sent_data: raise UsageError
|
if self._sent_data: raise UsageError
|
||||||
if self._got_data: raise UsageError
|
if self._got_data: raise UsageError
|
||||||
data = {
|
data = {
|
||||||
"appid": self.appid,
|
"appid": self._appid,
|
||||||
"relay_url": self._relay_url,
|
"relay_url": self._relay_url,
|
||||||
"code": self.code,
|
"code": self.code,
|
||||||
"side": self._side,
|
"side": self._side,
|
||||||
|
@ -278,7 +278,7 @@ class Wormhole:
|
||||||
def _got_pake(pake_msg):
|
def _got_pake(pake_msg):
|
||||||
key = self.sp.finish(pake_msg)
|
key = self.sp.finish(pake_msg)
|
||||||
self.key = key
|
self.key = key
|
||||||
self.verifier = self.derive_key(self.appid+b":Verifier")
|
self.verifier = self.derive_key(self._appid+b":Verifier")
|
||||||
return key
|
return key
|
||||||
d.addCallback(_got_pake)
|
d.addCallback(_got_pake)
|
||||||
return d
|
return d
|
||||||
|
|
Loading…
Reference in New Issue
Block a user