mirror of
https://github.com/romanz/amodem.git
synced 2026-04-02 01:36:49 +08:00
trezor: simplify client API
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user