mirror of
https://github.com/NixOS/nix
synced 2025-07-05 20:41:47 +02:00
This sets up infrastructure in libutil to allow for signing other than by a secret key in memory. #9076 uses this to implement remote signing. (Split from that PR to allow reviewing in smaller chunks.) Co-Authored-By: Raito Bezarius <masterancpp@gmail.com>
23 lines
399 B
C++
23 lines
399 B
C++
#include "signature/signer.hh"
|
|
#include "error.hh"
|
|
|
|
#include <sodium.h>
|
|
|
|
namespace nix {
|
|
|
|
LocalSigner::LocalSigner(SecretKey && privateKey)
|
|
: privateKey(privateKey)
|
|
, publicKey(privateKey.toPublicKey())
|
|
{ }
|
|
|
|
std::string LocalSigner::signDetached(std::string_view s) const
|
|
{
|
|
return privateKey.signDetached(s);
|
|
}
|
|
|
|
const PublicKey & LocalSigner::getPublicKey()
|
|
{
|
|
return publicKey;
|
|
}
|
|
|
|
}
|