Hydrogen-mediated electrolyzer system for acid and base production from saltwater