Just a bit of musing, not anything that requires action:
The create functions could be:
std::unique_ptr<CookieFactory> create_from_secret(std::vector<uint8_t> const& save_secret); std::unique_ptr<CookieFactory> create_saving_secret(std::vector<uint8_t>& save_secret, unsigned secret_size = 2*minimum_secret_size);
That might be more convenient for code that doesn't care about the secret size. There could also be other variants:
std::unique_ptr<CookieFactory> create_keeping_secret(unsigned secret_size = 2*minimum_secret_size);
Which would support user code that just does:
auto const cf = CookieFactory::create_keeping_secret();
Maybe not an important use case?
~~~~
It could also be convenient to include a definition of Secret:
using Secret = std::vector<uint8_t>;
and use that in both the interface and user code.
« Back to merge proposal
Just a bit of musing, not anything that requires action:
The create functions could be:
std::unique_ ptr<CookieFacto ry> create_ from_secret( std::vector< uint8_t> const& save_secret); ptr<CookieFacto ry> create_ saving_ secret( std::vector< uint8_t> & save_secret, unsigned secret_size = 2*minimum_ secret_ size);
std::unique_
That might be more convenient for code that doesn't care about the secret size. There could also be other variants:
std::unique_ ptr<CookieFacto ry> create_ keeping_ secret( unsigned secret_size = 2*minimum_ secret_ size);
Which would support user code that just does:
auto const cf = CookieFactory: :create_ keeping_ secret( );
Maybe not an important use case?
~~~~
It could also be convenient to include a definition of Secret:
using Secret = std::vector< uint8_t> ;
and use that in both the interface and user code.