|
|
@@ -221,6 +221,12 @@ class Persona(object): |
|
|
|
|
|
|
|
return self._identity |
|
|
|
|
|
|
|
def get_pubkey(self): |
|
|
|
'''Get a printable version of the public key. This is used |
|
|
|
for importing into different programs, or for shared.''' |
|
|
|
|
|
|
|
return base58.b58encode_check(self._identity.pubkey) |
|
|
|
|
|
|
|
def new_version(self, *args): |
|
|
|
'''Update the Persona's Identity object.''' |
|
|
|
|
|
|
@@ -502,7 +508,7 @@ def main(): |
|
|
|
persona = Persona.load(identfname) |
|
|
|
|
|
|
|
if options.printpub: |
|
|
|
print base58.b58encode_check(persona.get_identity().pubkey) |
|
|
|
print persona.get_pubkey() |
|
|
|
return |
|
|
|
|
|
|
|
persona.new_version(*addprops) |
|
|
@@ -717,6 +723,9 @@ class _TestCases(unittest.TestCase): |
|
|
|
idobj = persona.get_identity() |
|
|
|
self.assertIsInstance(idobj['pubkey'], str) |
|
|
|
|
|
|
|
# that get_pubkey returns the correct thing |
|
|
|
self.assertEqual(persona.get_pubkey(), base58.b58encode_check(idobj['pubkey'])) |
|
|
|
|
|
|
|
# and that there is a signature |
|
|
|
self.assertIsInstance(idobj['sig'], str) |
|
|
|
|
|
|
@@ -917,7 +926,7 @@ class _TestCases(unittest.TestCase): |
|
|
|
|
|
|
|
# the correct key is printed |
|
|
|
self.assertEqual(stdout.getvalue(), |
|
|
|
'%s\n' % base58.b58encode_check(pident.pubkey)) |
|
|
|
'%s\n' % persona.get_pubkey()) |
|
|
|
|
|
|
|
# and looked up the correct file |
|
|
|
eu.assert_called_with('~/.medashare_identity.pasn1') |
|
|
|