mirror of https://github.com/nucypher/nucypher.git
Per our discussion last night, moving TLSHostingPower to network.server and beginning the 'Kirby' pattern.
parent
7bf42d8990
commit
79c062599b
|
@ -37,7 +37,7 @@ from nucypher.crypto.signing import signature_splitter, StrangerStamp, Signature
|
||||||
from nucypher.network.middleware import RestMiddleware
|
from nucypher.network.middleware import RestMiddleware
|
||||||
from nucypher.network.nodes import VerifiableNode
|
from nucypher.network.nodes import VerifiableNode
|
||||||
from nucypher.network.protocols import InterfaceInfo
|
from nucypher.network.protocols import InterfaceInfo
|
||||||
from nucypher.network.server import NucypherDHTServer, NucypherSeedOnlyDHTServer, ProxyRESTServer
|
from nucypher.network.server import NucypherDHTServer, NucypherSeedOnlyDHTServer
|
||||||
|
|
||||||
|
|
||||||
class Character:
|
class Character:
|
||||||
|
@ -1015,7 +1015,7 @@ class Bob(Character):
|
||||||
return cleartexts
|
return cleartexts
|
||||||
|
|
||||||
|
|
||||||
class Ursula(Character, VerifiableNode, ProxyRESTServer, Miner):
|
class Ursula(Character, VerifiableNode, Miner):
|
||||||
_internal_splitter = BytestringSplitter(Signature,
|
_internal_splitter = BytestringSplitter(Signature,
|
||||||
VariableLengthBytestring,
|
VariableLengthBytestring,
|
||||||
(UmbralPublicKey, PUBLIC_KEY_LENGTH),
|
(UmbralPublicKey, PUBLIC_KEY_LENGTH),
|
||||||
|
|
|
@ -136,7 +136,7 @@ class KeyPairBasedPower(CryptoPowerUp):
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
pubkey: UmbralPublicKey = None,
|
pubkey: UmbralPublicKey = None,
|
||||||
keypair: keypairs.Keypair = None,
|
keypair: keypairs.Keypair = None,
|
||||||
generate_keys_if_needed=True) -> None:
|
) -> None:
|
||||||
if keypair and pubkey:
|
if keypair and pubkey:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"Pass keypair or pubkey_bytes (or neither), but not both.")
|
"Pass keypair or pubkey_bytes (or neither), but not both.")
|
||||||
|
@ -194,14 +194,6 @@ class EncryptingPower(KeyPairBasedPower):
|
||||||
provides = ("decrypt",)
|
provides = ("decrypt",)
|
||||||
|
|
||||||
|
|
||||||
class TLSHostingPower(KeyPairBasedPower):
|
|
||||||
_keypair_class = HostingKeypair
|
|
||||||
provides = ("get_deployer",)
|
|
||||||
|
|
||||||
def public_material(self):
|
|
||||||
return self.keypair.certificate, self.keypair.pubkey
|
|
||||||
|
|
||||||
|
|
||||||
class DelegatingPower(DerivedKeyBasedPower):
|
class DelegatingPower(DerivedKeyBasedPower):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
|
@ -16,7 +16,7 @@ from umbral import pre
|
||||||
from umbral.fragments import KFrag
|
from umbral.fragments import KFrag
|
||||||
|
|
||||||
from nucypher.crypto.kits import UmbralMessageKit
|
from nucypher.crypto.kits import UmbralMessageKit
|
||||||
from nucypher.crypto.powers import SigningPower, TLSHostingPower
|
from nucypher.crypto.powers import SigningPower, KeyPairBasedPower
|
||||||
from nucypher.keystore.keypairs import HostingKeypair
|
from nucypher.keystore.keypairs import HostingKeypair
|
||||||
from nucypher.keystore.threading import ThreadedSession
|
from nucypher.keystore.threading import ThreadedSession
|
||||||
from nucypher.network.protocols import NucypherSeedOnlyProtocol, NucypherHashProtocol, InterfaceInfo
|
from nucypher.network.protocols import NucypherSeedOnlyProtocol, NucypherHashProtocol, InterfaceInfo
|
||||||
|
@ -341,3 +341,11 @@ class ProxyRESTServer:
|
||||||
deployer = self._crypto_power.power_ups(TLSHostingPower).get_deployer(rest_app=self._rest_app,
|
deployer = self._crypto_power.power_ups(TLSHostingPower).get_deployer(rest_app=self._rest_app,
|
||||||
port=self.rest_interface.port)
|
port=self.rest_interface.port)
|
||||||
return deployer
|
return deployer
|
||||||
|
|
||||||
|
|
||||||
|
class TLSHostingPower(KeyPairBasedPower):
|
||||||
|
_keypair_class = HostingKeypair
|
||||||
|
provides = ("get_deployer",)
|
||||||
|
|
||||||
|
def public_material(self):
|
||||||
|
return self.keypair.certificate, self.keypair.pubkey
|
||||||
|
|
Loading…
Reference in New Issue