0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-25 15:04:10 +01:00

ircd::ed25519: Add create option to ctor; remove reference to global.

This commit is contained in:
Jason Volk 2020-09-15 17:40:10 -07:00
parent 1668bee2e5
commit 772022a74e
3 changed files with 5 additions and 4 deletions

View file

@ -37,7 +37,7 @@ class ircd::ed25519::sk
sig sign(const const_buffer &msg) const;
sk(const string_view &filename, pk *const & = nullptr);
sk(const string_view &filename, pk *const & = nullptr, const bool &create = false);
sk(pk *const &, const const_buffer &seed);
sk(): key{nullptr, std::free} {}
};

View file

@ -103,7 +103,8 @@ ircd::ed25519::sk::sk(pk *const &pk_arg,
}
ircd::ed25519::sk::sk(const string_view &filename,
pk *const &pk_arg)
pk *const &pk_arg,
const bool &create)
try
:key
{
@ -131,7 +132,7 @@ try
filename && fs::exists(filename)
};
if(!exists && !ircd::write_avoid)
if(!exists && create)
{
nacl::throw_on_error
{

View file

@ -378,7 +378,7 @@ ircd::m::homeserver::key::key(const struct opts &opts)
}()}
,secret_key
{
secret_key_path, &public_key
secret_key_path, &public_key, !ircd::write_avoid
}
,public_key_b64
{