Flexible entanglement-based secure communication with an AlGaAs chip for quantum networks