add ed25519 private key deserializer
This commit is contained in:
parent
bbd8279811
commit
487c923791
|
@ -47,6 +47,11 @@ class Ed25519PrivateKey(PrivateKey):
|
||||||
def to_bytes(self) -> bytes:
|
def to_bytes(self) -> bytes:
|
||||||
return bytes(self.impl)
|
return bytes(self.impl)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_bytes(cls, data: bytes) -> "Ed25519PrivateKey":
|
||||||
|
impl = PrivateKeyImpl(data)
|
||||||
|
return cls(impl)
|
||||||
|
|
||||||
def get_type(self) -> KeyType:
|
def get_type(self) -> KeyType:
|
||||||
return KeyType.Ed25519
|
return KeyType.Ed25519
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from libp2p.crypto.ed25519 import Ed25519PublicKey
|
from libp2p.crypto.ed25519 import Ed25519PrivateKey, Ed25519PublicKey
|
||||||
from libp2p.crypto.exceptions import MissingDeserializerError
|
from libp2p.crypto.exceptions import MissingDeserializerError
|
||||||
from libp2p.crypto.keys import KeyType, PrivateKey, PublicKey
|
from libp2p.crypto.keys import KeyType, PrivateKey, PublicKey
|
||||||
from libp2p.crypto.rsa import RSAPublicKey
|
from libp2p.crypto.rsa import RSAPublicKey
|
||||||
|
@ -11,7 +11,8 @@ key_type_to_public_key_deserializer = {
|
||||||
}
|
}
|
||||||
|
|
||||||
key_type_to_private_key_deserializer = {
|
key_type_to_private_key_deserializer = {
|
||||||
KeyType.Secp256k1.value: Secp256k1PrivateKey.from_bytes
|
KeyType.Secp256k1.value: Secp256k1PrivateKey.from_bytes,
|
||||||
|
KeyType.Ed25519.value: Ed25519PrivateKey.from_bytes,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user