Merge branch 'github-ci'

This commit is contained in:
Roman Zeyde
2021-05-22 22:04:00 +03:00
23 changed files with 56 additions and 58 deletions

24
.github/workflows/ci.yml vendored Normal file
View File

@@ -0,0 +1,24 @@
name: Python package
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip tox
- name: Build and test
run: |
tox

View File

@@ -1,5 +1,5 @@
[MESSAGES CONTROL]
disable=invalid-name, missing-docstring, locally-disabled, unbalanced-tuple-unpacking,no-else-return,fixme,duplicate-code,cyclic-import,import-outside-toplevel
disable=invalid-name, missing-docstring, locally-disabled, unbalanced-tuple-unpacking,no-else-return,fixme,duplicate-code,cyclic-import,import-outside-toplevel,consider-using-with
[SIMILARITIES]
min-similarity-lines=5

View File

@@ -1,29 +0,0 @@
sudo: false
language: python
python:
- "3.6"
- "3.7"
- "3.8"
- "3.9"
cache:
directories:
- $HOME/.cache/pip
before_install:
- pip install -U pip wheel
- pip install -U setuptools
- pip install -U pylint coverage pycodestyle pydocstyle
install:
- pip install -U -e .
script:
- pycodestyle libagent
- pylint --reports=no --rcfile .pylintrc libagent
- pydocstyle libagent
- coverage run --source libagent/ -m py.test -v
after_success:
- coverage report

View File

@@ -1,6 +1,5 @@
# Hardware-based SSH/GPG agent
[![Build Status](https://travis-ci.org/romanz/trezor-agent.svg?branch=master)](https://travis-ci.org/romanz/trezor-agent)
[![Chat](https://badges.gitter.im/romanz/trezor-agent.svg)](https://gitter.im/romanz/trezor-agent)
This project allows you to use various hardware security devices to operate GPG and SSH. Instead of keeping your key on your computer and decrypting it with a passphrase when you want to use it, the key is generated and stored on the device and never reaches your computer. Read more about the design [here](doc/DESIGN.md).

View File

@@ -5,8 +5,8 @@ import logging
import ecdsa
from . import interface
from .. import formats
from . import interface
log = logging.getLogger(__name__)

View File

@@ -1,7 +1,7 @@
"""KeepKey-related code (see https://www.keepkey.com/)."""
from . import trezor
from .. import formats
from . import trezor
def _verify_support(identity, ecdh):

View File

@@ -2,8 +2,9 @@
# pylint: disable=unused-import,import-error
from keepkeylib.client import CallException, PinException
from keepkeylib.client import CallException
from keepkeylib.client import KeepKeyClient as Client
from keepkeylib.client import PinException
from keepkeylib.messages_pb2 import PassphraseAck, PinMatrixAck
from keepkeylib.transport_hid import HidTransport
from keepkeylib.transport_webusb import WebUsbTransport

View File

@@ -6,8 +6,8 @@ import struct
from ledgerblue import comm # pylint: disable=import-error
from . import interface
from .. import formats
from . import interface
log = logging.getLogger(__name__)

View File

@@ -2,10 +2,11 @@
# pylint: disable=attribute-defined-outside-init
"""OnlyKey-related code (see https://www.onlykey.io/)."""
import logging
import hashlib
import codecs
import hashlib
import logging
import time
import ecdsa
import nacl.signing
import unidecode

View File

@@ -2,4 +2,4 @@
# pylint: disable=unused-import,import-error,no-name-in-module
from onlykey import OnlyKey, Message
from onlykey import Message, OnlyKey

View File

@@ -5,8 +5,8 @@ import logging
import semver
from . import interface
from .. import formats
from . import interface
log = logging.getLogger(__name__)
@@ -71,6 +71,7 @@ class Trezor(interface.Device):
log.exception('ping failed: %s', e)
connection.close() # so the next HID open() will succeed
raise
return None
def close(self):
"""Close connection."""

View File

@@ -1,20 +1,20 @@
"""TREZOR-related definitions."""
import logging
# pylint: disable=unused-import,import-error,no-name-in-module,no-member
import os
import logging
import mnemonic
import semver
import trezorlib
from trezorlib.client import TrezorClient as Client, PASSPHRASE_TEST_PATH
from trezorlib.exceptions import TrezorFailure, PinException
from trezorlib.transport import get_transport
from trezorlib.messages import IdentityType
from trezorlib.btc import get_address, get_public_node
from trezorlib.misc import sign_identity, get_ecdh_session_key
from trezorlib.client import PASSPHRASE_TEST_PATH
from trezorlib.client import TrezorClient as Client
from trezorlib.exceptions import PinException, TrezorFailure
from trezorlib.messages import IdentityType
from trezorlib.misc import get_ecdh_session_key, sign_identity
from trezorlib.transport import get_transport
log = logging.getLogger(__name__)
@@ -28,3 +28,4 @@ def find_device():
return get_transport(os.environ.get("TREZOR_PATH"))
except Exception as e: # pylint: disable=broad-except
log.debug("Failed to find a Trezor device: %s", e)
return None

View File

@@ -5,12 +5,13 @@ import os
import subprocess
import sys
from .. import util
try:
from trezorlib.client import PASSPHRASE_ON_DEVICE
except ImportError:
PASSPHRASE_ON_DEVICE = object()
from .. import util
log = logging.getLogger(__name__)

View File

@@ -21,9 +21,8 @@ import time
import pkg_resources
import semver
from . import agent, client, encode, keyring, protocol
from .. import device, formats, server, util
from . import agent, client, encode, keyring, protocol
log = logging.getLogger(__name__)

View File

@@ -2,8 +2,8 @@
import binascii
import logging
from . import client, decode, keyring, protocol
from .. import util
from . import client, decode, keyring, protocol
log = logging.getLogger(__name__)

View File

@@ -9,8 +9,8 @@ import struct
import ecdsa
import nacl.signing
from . import protocol
from .. import util
from . import protocol
log = logging.getLogger(__name__)

View File

@@ -2,8 +2,8 @@
import io
import logging
from . import decode, keyring, protocol
from .. import util
from . import decode, keyring, protocol
log = logging.getLogger(__name__)

View File

@@ -4,6 +4,7 @@ import base64
import hashlib
import logging
import struct
import nacl.signing
from .. import formats, util

View File

@@ -4,8 +4,8 @@ import os
import pytest
from .. import decode, protocol
from ... import util
from .. import decode, protocol
def test_subpackets():

View File

@@ -2,8 +2,8 @@ import ecdsa
import nacl.signing
import pytest
from .. import protocol
from ... import formats
from .. import protocol
def test_packet():

View File

@@ -16,7 +16,6 @@ import time
import pkg_resources
import semver
from .. import formats, server, util
from ..device import interface, ui

View File

@@ -11,9 +11,9 @@ import sys
import tempfile
import threading
import pkg_resources
import configargparse
import daemon
import pkg_resources
from .. import device, formats, server, util
from . import client, protocol

View File

@@ -16,7 +16,7 @@ deps=
isort<5
commands=
pycodestyle libagent
# isort --skip-glob .tox -c -r libagent
isort --skip-glob .tox -c -rc libagent
pylint --reports=no --rcfile .pylintrc libagent
pydocstyle libagent
coverage run --source libagent -m py.test -v libagent