Introducing Character.generate_self_signed_cert() and updated docstrings to match.

pull/178/head
jMyles 2018-03-06 17:49:18 -08:00
parent 189326b0ec
commit 06c515c4bb
1 changed files with 10 additions and 2 deletions

View File

@ -243,8 +243,8 @@ class Character(object):
return is_valid, cleartext
"""
Next we have decrypt() and sign() - these two functions use the private keys of their respective powers;
any character who has these powers can use these functions.
Next we have decrypt(), sign(), and generate_self_signed_certificate() - these use the private
keys of their respective powers; any character who has these powers can use these functions.
If they don't have the correct Power, the appropriate PowerUpError is raised.
"""
@ -255,6 +255,14 @@ class Character(object):
def sign(self, message):
return self._crypto_power.power_ups(SigningPower).sign(message)
def generate_self_signed_certificate(self):
signing_power = self._crypto_power.power_ups(SigningPower)
return signing_power.generate_self_signed_cert(self.stamp.fingerprint().decode())
"""
And finally, some miscellaneous but generally-applicable abilities:
"""
def public_key(self, power_up_class):
"""
Pass a power_up_class, get the public key for this Character which corresponds to that