def checkAllContactsKeys(): for c in DbClient.getMessageableContacts(): torId = c.get("torid", None) if c else None if torId: keyId = c.get("keyid", None) if not keyId: print("No keyid found for torid", torId) elif not CryptoClient.getPublicKey(keyId): print("CryptoClient hasn't got a public key for torid", torId) if not keyId or not CryptoClient.getPublicKey(keyId): # We haven't got their key in our keyring! DbClient.updateContact(torId, {"status":"requested"})
def getPublicKey(self, torid): '''Use the keyid stored in mongo, and get the corresponding public key from the Crypto module''' profile = DbClient.getProfile(torid) if profile is not None: keyid = profile.get('keyid', None) if keyid is not None: return CryptoClient.getPublicKey(keyid)
def checkAllContactsKeys(): '''Return a list of names for which the key can't be found''' nameList = [] for c in DbI.getMessageableProfiles(): torId = c['torid'] if c else None if torId: keyId = c['keyid'] if not keyId: print("No keyid found for torid", torId) nameList.append(c['displayName']) elif not CryptoClient.getPublicKey(keyId): print("CryptoClient hasn't got a public key for torid", torId) nameList.append(c['displayName']) if not keyId or not CryptoClient.getPublicKey(keyId): # We haven't got their key in our keyring! DbI.updateProfile(torId, {"status": "requested"}) return nameList
def getPublicKey(self, torid): '''Use the keyid stored in the db, and get the corresponding public key from the Crypto module''' profile = DbI.getProfile(torid) keyid = profile.get('keyid', None) if profile else None if keyid: return CryptoClient.getPublicKey(keyid)