only compute shared secret when its safe to do so