git.fiddlerwoaroof.com
installer.h
7d075ab4
 /* Copyright (C) CJ Affiliate
  *
  * You may use, distribute and modify this code under  the
  * terms of the  GNU General Public License  version 2  or
  * later.
  *
  * You should have received a copy of the license with this
  * file. If not, you will find a copy in the "LICENSE" file
  * at https://github.com/cjdev/dual-control.
  */
 
66796de1
 #ifndef INSTALLER_H_
 #define INSTALLER_H_
e21fc4bc
 
66796de1
 #include <string>
bf756dea
 #include <memory>
 #include <functional>
c7bdd0eb
 #include <utility>
66796de1
 
bf756dea
 #include "token.h"
 #include "sys_unistd.h"
 #include "user.h"
f2a91ef8
 #include "generator.h"
bf756dea
 
7d075ab4
 class installer_ifc
 {
 public:
c7bdd0eb
     virtual std::pair<std::string, std::string> install_key() const
7d075ab4
     {
c7bdd0eb
         return {"AAAA", "123456"};
7d075ab4
     }
e21fc4bc
 };
66796de1
 
7d075ab4
 class installer
 {
 public:
     using delegate = std::shared_ptr<installer_ifc>;
 private:
     delegate delegate_;
 public:
     installer (const delegate &delegate = std::make_shared<installer_ifc>()) :
         delegate_ (delegate) {}
c7bdd0eb
     std::pair<std::string, std::string> install_key() const
7d075ab4
     {
3f7d4dd6
         return delegate_->install_key();
7d075ab4
     }
     static installer create (const tokens &tokens, const unistd &unistd,
75b15a68
                              const directory &directory,
194e6869
                              const totp_generator &generator);
bf756dea
 };
 
66796de1
 #endif
8c62e61c