Move client key functions into a library.