diff --git a/src/sync-socket.h b/src/sync-socket.h
index f796fed..72df7ab 100644
--- a/src/sync-socket.h
+++ b/src/sync-socket.h
@@ -27,6 +27,7 @@
 
 #include "sync-logic.h"
 #include "sync-seq-no.h"
+#include "sync-validator.h"
 
 #include <utility>
 #include <map>
@@ -45,59 +46,78 @@
   typedef ndn::function< void (const std::vector<MissingDataInfo> &, SyncSocket * ) > NewDataCallback;
   typedef ndn::function< void (const std::string &/*prefix*/ ) > RemoveCallback;
 
-  /**
-   * @brief the constructor for SyncAppSocket; the parameter syncPrefix
-   * should be passed to the constructor of m_syncAppWrapper; the other
-   * parameter should be passed to the constructor of m_fetcher; furthermore,
-   * the fetch function of m_fetcher should be a second paramter passed to
-   * the constructor of m_syncAppWrapper, so that m_syncAppWrapper can tell
-   * m_fetcher to fetch the actual app data after it learns the names
-   *
-   * @param syncPrefix the name prefix for Sync Interest
-   * @param dataCallback the callback to process data
-   */
   SyncSocket (const ndn::Name& syncPrefix, 
-              const ndn::Name& identity,
-              ndn::shared_ptr<ndn::Validator> validator,
+              const ndn::Name& dataPrefix,
+              uint64_t dataSession,
+              const ndn::IdentityCertificate& myCertificate,
+              ndn::shared_ptr<ndn::SecRuleRelative> dataRule,
               ndn::shared_ptr<ndn::Face> face,
               NewDataCallback dataCallback, 
               RemoveCallback rmCallback);
 
   ~SyncSocket ();
 
-  bool 
-  publishData(const ndn::Name &prefix, uint64_t session, const char *buf, size_t len, int freshness);
+  void
+  publishData(const uint8_t* buf, size_t len, int freshness, bool isCert = false);
 
   void 
   remove (const ndn::Name &prefix) 
-  { m_syncLogic.remove(prefix); }
+  { 
+    m_syncLogic.remove(prefix); 
+  }
 
   void 
   fetchData(const ndn::Name &prefix, const SeqNo &seq, const ndn::OnDataValidated& onValidated, int retry = 0);
 
   std::string 
   getRootDigest() 
-  { return m_syncLogic.getRootDigest(); }
+  { 
+    return m_syncLogic.getRootDigest(); 
+  }
 
   uint64_t
-  getNextSeq (const ndn::Name &prefix, uint64_t session);
+  getNextSeq (const ndn::Name &prefix, uint64_t session)
+  {
+    SequenceLog::iterator i = m_sequenceLog.find (prefix);
+    
+    if (i != m_sequenceLog.end ())
+      {
+        SeqNo s = i->second;
+        if (s.getSession() == session)
+          return s.getSeq();
+      }
+    return 0;
+  }
 
   SyncLogic &
   getLogic () 
-  { return m_syncLogic; }
+  { 
+    return m_syncLogic; 
+  }
 
-  // make this a static function so we don't have to create socket instance without
-  // knowing the local prefix. it's a wrong place for this function anyway
-  static std::string
-  GetLocalPrefix (); 
+  void
+  addParticipant(const ndn::IdentityCertificate& introducee)
+  {
+    ndn::shared_ptr<const IntroCertificate> introCert = m_syncValidator->addParticipant(introducee);
+  }
+
+  // // make this a static function so we don't have to create socket instance without
+  // // knowing the local prefix. it's a wrong place for this function anyway
+  // static std::string
+  // GetLocalPrefix (); 
   
 private:
   void
-  publishDataInternal(ndn::shared_ptr<ndn::Data> data, const ndn::Name &prefix, uint64_t session);
+  publishDataInternal(ndn::shared_ptr<ndn::Data> data, 
+                      const ndn::Name &prefix, 
+                      uint64_t session, 
+                      bool isCert);
 
   void 
   passCallback(const std::vector<MissingDataInfo> &v) 
-  { m_newDataCallback(v, this); }
+  { 
+    m_newDataCallback(v, this); 
+  }
 
   void
   onData(const ndn::Interest& interest, ndn::Data& data,
@@ -111,17 +131,26 @@
                 const ndn::OnDataValidationFailed& onValidationFailed);
 
   void
-  onDataValidationFailed(const ndn::shared_ptr<const ndn::Data>& data);
+  onDataValidated(const ndn::shared_ptr<const ndn::Data>& data,
+                  size_t interestNameSize,
+                  const ndn::OnDataValidated& onValidated);
+
+  void
+  onDataValidationFailed(const ndn::shared_ptr<const ndn::Data>& data,
+                         const std::string& failureInfo);
 
 private:
   typedef std::map<ndn::Name, SeqNo> SequenceLog;
+
+  ndn::Name m_dataPrefix;
+  uint64_t m_dataSession;
   NewDataCallback m_newDataCallback;
   SequenceLog m_sequenceLog;
-  ndn::Name m_identity;
-  ndn::shared_ptr<ndn::Validator> m_validator;
-  ndn::shared_ptr<ndn::KeyChain> m_keyChain;
+  ndn::IdentityCertificate m_myCertificate;
+  ndn::KeyChain m_keyChain;
   ndn::shared_ptr<ndn::Face> m_face;
   ndn::shared_ptr<boost::asio::io_service> m_ioService;
+  ndn::shared_ptr<SyncValidator> m_syncValidator;
   SyncLogic      m_syncLogic;
 };
 
