Learners get nicknames; Characters are repr'd by them.

pull/498/head
jMyles 2018-10-27 18:51:54 +02:00
parent 0ab2a67299
commit 416b5d206d
3 changed files with 7 additions and 2 deletions

View File

@ -29,6 +29,7 @@ from nucypher.crypto.kits import UmbralMessageKit
from nucypher.crypto.powers import CryptoPower, SigningPower, EncryptingPower, NoSigningPower, CryptoPowerUp
from nucypher.crypto.signing import signature_splitter, StrangerStamp, SignatureStamp
from nucypher.network.middleware import RestMiddleware
from nucypher.network.nicknames import nickname_from_seed
from nucypher.network.nodes import VerifiableNode
@ -607,6 +608,7 @@ class Character(Learner):
if not checksum_address == self.checksum_public_address:
error = "Federated-only Characters derive their address from their Signing key; got {} instead."
raise self.SuspiciousActivity(error.format(checksum_address))
self.nickname, self.nickname_metadata = nickname_from_seed(self.checksum_public_address)
def __eq__(self, other) -> bool:
return bytes(self.stamp) == bytes(other.stamp)
@ -616,8 +618,8 @@ class Character(Learner):
def __repr__(self):
class_name = self.__class__.__name__
r = "{} {}"
r = r.format(class_name, self.canonical_public_address)
r = "{} ({})"
r = r.format(self.nickname, self.checksum_public_address)
return r
@property

View File

@ -10,7 +10,9 @@ from eth_keys.datatypes import Signature as EthSignature
from nucypher.config.constants import SeednodeMetadata
from nucypher.config.keyring import _write_tls_certificate
from nucypher.crypto.api import keccak_digest
from nucypher.crypto.powers import BlockchainPower, SigningPower, EncryptingPower, NoSigningPower
from nucypher.network.nicknames import nickname_from_seed
from nucypher.network.protocols import SuspiciousActivity
from nucypher.network.server import TLSHostingPower

View File

@ -219,6 +219,7 @@ class ProxyRESTRoutes:
kfrag,
session=session)
# TODO: Sign the arrangement here. #495
return # TODO: Return A 200, with whatever policy metadata.
def reencrypt_via_rest(self, id_as_hex, request: Request):