Commit Graph

48 Commits

Author SHA1 Message Date
Jonathan de Jong
b1248ff315 enforced f-strings everywhere, %s on logging
extended _multiaddr_from_socket to support UDP and IPv6 automatically
changed TCPListener to use _ip4_or_6_from_multiaddr to get host, and not ip4 only

enforced `from error` everywhere with raises
added call braces to exceptions
2019-12-19 17:31:18 +01:00
Jason Carver
27ecd4b0ed Mock dependencies that are excluded in readthedocs
It seems preferable to import just fastecdsa. But if you do that,
then some kind of side-effect doesn't happen, which means that `sec1` is
not available as an attribute on `fastecdsa.encoding`.

So we specifically mock the sub-modules as well.
2019-11-27 14:07:14 -08:00
Jason Carver
b8ec43a859 remove type:ignore for working pycryptodome type
I didn't dig deeper, it looks like pycryptodome must have fixed their
pkcs1_15.new andd pkcs1_15.verify type signatures.
2019-11-15 11:25:03 -08:00
Piper Merriam
ded3792924
Merge pull request #331 from dmuhs/fix/docs-format
Add automatic docstring formatting
2019-10-28 09:39:52 -06:00
Alex Stokes
f2bfc68f6d
Re-generate protobufs 2019-10-25 18:51:57 +09:00
Dominik Muhs
bafdd8512d Enforce pre-summary newline in docstrings 2019-10-24 20:10:45 +02:00
Dominik Muhs
eef505f2d9 Add automatic docstring formatter and apply 2019-10-24 08:41:10 +02:00
Alex Stokes
75ec2facce
linter fix 2019-09-24 10:07:33 -07:00
Alex Stokes
487c923791
add ed25519 private key deserializer 2019-09-24 10:06:35 -07:00
Alex Stokes
bbd8279811
Add explicit exception if we are missing a deserializer 2019-09-24 09:51:32 -07:00
Alex Stokes
6e53849604
Delete utils in favor of serialization module 2019-09-24 09:51:31 -07:00
Alex Stokes
5fdca2ffb2
Add public key implementation 2019-09-24 09:51:31 -07:00
Alex Stokes
fa7d1d66a8
Fix import path 2019-09-24 09:51:31 -07:00
Alex Stokes
b142964d31
Adds support for verifying ed25519 signatures, for secio 2019-09-24 09:51:31 -07:00
Alex Stokes
451ec2664a
Address incorrect typing in pycryptodome dependency 2019-09-04 10:19:27 -07:00
Alex Stokes
f86ba7283d
Implement signing for RSA
- mainly for use in `secio` w/ RSA-based identities b/t peers
2019-09-04 10:12:43 -07:00
Alex Stokes
25f504ad35
Allow RSA public key type when deserializing keys 2019-09-04 10:12:43 -07:00
Alex Stokes
30456f8018
Use a different ECC backend with a compatible serializer
This library has the ``SEC1`` encoder which is compatible
with the serialization of ECC keys/points used in the Go libp2p impl
2019-09-03 13:44:25 -07:00
Alex Stokes
fa0acd9fc5
Apply PR feedback 2019-08-26 10:03:12 -07:00
Alex Stokes
c1ffb03f77
Update comment to reflect correct function 2019-08-26 09:51:49 -07:00
Alex Stokes
7c004a4e14
Mypy fixes 2019-08-24 22:38:26 +02:00
Alex Stokes
b8c0ef9ebb
Fix bugs in secio implementation 2019-08-24 22:38:25 +02:00
Alex Stokes
1adef05e94
Typing and linting fixes 2019-08-24 22:37:45 +02:00
Alex Stokes
8e913a3faa
Dispatch serialization of keys based on key type
- Add some tests to check high-level roundtrip
2019-08-24 22:37:45 +02:00
Alex Stokes
af2e50aaf4
Add facility for authenticated encryption 2019-08-24 22:37:45 +02:00
Alex Stokes
228c17ae9e
Add ECDH key exchange utility 2019-08-24 22:37:44 +02:00
Alex Stokes
fb13dfa7b3
Add sign and verify operations for secp256k1 keys 2019-08-24 22:37:44 +02:00
Alex Stokes
3c97a5a0ed
Add ECC key implementation 2019-08-24 22:37:44 +02:00
mhchia
b516579256
Remove the unnecessary RSAPrivateKey.from_bytes 2019-08-22 22:54:14 +08:00
mhchia
3e04480d62
Raise HandshakeFailure in transport
Change the exception handling flow.
Raise `SecurityUpgradeFailure` in security_multistream.
2019-08-22 22:53:48 +08:00
mhchia
921bfb65cc
Verify the remote pubkey and peer_id
- Add `from_bytes` in RSAPublicKey and Secp256k1PublicKey
- Add `pubkey_from_protobuf` to parse pubkey from protobuf
- Verify key and peer_id in `InsecureSession.run_handshake`
2019-08-22 22:53:48 +08:00
mhchia
5192944724
Update pb 2019-08-22 22:53:46 +08:00
Alex Stokes
e1d3f1601f
Satisfy mypy 2019-08-20 19:28:32 +02:00
Alex Stokes
87d943aa39
Internalize the protobuf serialization to the concept of a Key
Given its use across various components of `libp2p` (not just peer IDs),
it makes the abstraction cleaner to pull the serialization into the
key class and expose the canonical serialization to bytes.
2019-08-20 19:01:36 +02:00
mhchia
8cd23abfe2 Remove the leftover merge related stuff 2019-08-16 11:03:16 +08:00
mhchia
e293b89925 Fix mypy
It seems the stub doesn't allow default value for params
2019-08-16 11:03:16 +08:00
mhchia
f2c31f6fe3 Fix isort 2019-08-16 11:03:16 +08:00
mhchia
e37b8bcf19 mypy: Add read_buffer_nonblocking in Mplex 2019-08-16 11:03:16 +08:00
Alex Stokes
9a4e23a803
mypy protobuf plugin requires keyword-based initializers 2019-08-15 16:36:32 -07:00
Alex Stokes
ff5eaf2429
Merge pull request #249 from ralexstokes/fix-mypy-protos
Add `mypy` protobufs plugin and regenerate protobufs
2019-08-15 16:15:26 -07:00
Alex Stokes
0f81ca42a6
Add mypy protobufs plugin and regenerate protobufs 2019-08-15 16:01:44 -07:00
mhchia
97308c897e
Add the missing __init__.py in pb/
Error: https://circleci.com/gh/mhchia/trinity/5342?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link
2019-08-15 21:03:45 +08:00
Alex Stokes
125c5d8e2c
Adjust inheritance so that the MRO is clear for the chain of keys 2019-08-14 09:30:23 -07:00
Alex Stokes
3b19104284
Add missing ABC declaration following PR feedback in #240. 2019-08-14 09:25:54 -07:00
Alex Stokes
08e6f2a30c
Update libp2p/crypto/secp256k1.py
pass the secret on to `coincurve` lib

Co-Authored-By: NIC Lin <twedusuck@gmail.com>
2019-08-14 09:02:06 -07:00
Alex Stokes
53e583a068
Update libp2p/crypto/secp256k1.py
Pass the secret on to `coincurve` lib

Co-Authored-By: NIC Lin <twedusuck@gmail.com>
2019-08-14 09:02:06 -07:00
Alex Stokes
ad20d8cb00
Make a KeyPair dataclass for passing around key pairs 2019-08-14 09:00:40 -07:00
Alex Stokes
61f78c8feb
Add abstraction for a cryptographic key 2019-08-14 09:00:39 -07:00