trezor: simplify client API

This commit is contained in:
Roman Zeyde
2015-08-19 17:40:16 +03:00
parent 5d510c4a60
commit e4a7d9aa06
3 changed files with 5 additions and 7 deletions

View File

@@ -88,7 +88,7 @@ def trezor_agent():
if command:
command = ['git'] + command
identity = client.get_identity(label=label, protocol='ssh')
identity = client.get_identity(label=label)
public_key = client.get_public_key(identity=identity)
use_shell = False
@@ -105,7 +105,7 @@ def trezor_agent():
return
def signer(label, blob):
identity = client.get_identity(label=label, protocol='ssh')
identity = client.get_identity(label=label)
return client.sign_ssh_challenge(identity=identity, blob=blob)
try:

View File

@@ -80,7 +80,7 @@ SIG = (b'\x00R\x19T\xf2\x84$\xef#\x0e\xee\x04X\xc6\xc3\x99T`\xd1\xd8\xf7!'
def test_ssh_agent():
c = client.Client(factory=FactoryMock)
ident = c.get_identity(label='localhost:22', protocol='ssh')
ident = c.get_identity(label='localhost:22')
assert ident.host == 'localhost'
assert ident.proto == 'ssh'
assert ident.port == '22'

View File

@@ -34,11 +34,9 @@ class Client(object):
self.client.clear_session() # forget PIN and shutdown screen
self.client.close()
def get_identity(self, label, protocol=None):
def get_identity(self, label):
identity = string_to_identity(label, self.factory.identity_type)
if protocol is not None:
identity.proto = protocol
identity.proto = 'ssh'
return identity
def get_public_key(self, identity):