move GetPublicKey out from data_getter to be a separate helper function