mirror of
https://github.com/matrix-construct/construct
synced 2024-12-25 23:14:13 +01:00
ircd::ed25519: Add create option to ctor; remove reference to global.
This commit is contained in:
parent
1668bee2e5
commit
772022a74e
3 changed files with 5 additions and 4 deletions
|
@ -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} {}
|
||||
};
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue