public OmemoFingerprint getFingerprintAndMaybeBuildSession ( OmemoManager . LoggedInOmemoManager managerGuard , OmemoDevice contactsDevice ) throws CannotEstablishOmemoSessionException , CorruptedOmemoKeyException , SmackException . NotConnectedException , InterruptedException , SmackException . NoResponseException { OmemoManager omemoManager = managerGuard . get ( ) ; // Load identityKey T_IdKey identityKey = loadOmemoIdentityKey ( omemoManager . getOwnDevice ( ) , contactsDevice ) ; if ( identityKey == null ) { // Key cannot be loaded. Maybe it doesn't exist. Fetch a bundle to get it... OmemoService . getInstance ( ) . buildFreshSessionWithDevice ( omemoManager . getConnection ( ) , omemoManager . getOwnDevice ( ) , contactsDevice ) ; } // Load identityKey again identityKey = loadOmemoIdentityKey ( omemoManager . getOwnDevice ( ) , contactsDevice ) ; if ( identityKey == null ) { return null ; } return keyUtil ( ) . getFingerprintOfIdentityKey ( identityKey ) ; }
Return the fingerprint of the given devices announced identityKey . If we have no local copy of the identityKey of the contact build a fresh session in order to get the key .