Skip to content

Commit d572533

Browse files
committed
Move signPathInfo to Store
Motivation is the same for moving `signRealisation` in db8439c.
1 parent 1bff2ae commit d572533

File tree

4 files changed

+21
-20
lines changed

4 files changed

+21
-20
lines changed

src/libstore/local-store.cc

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1585,20 +1585,6 @@ void LocalStore::addSignatures(const StorePath & storePath, const StringSet & si
15851585
}
15861586

15871587

1588-
void LocalStore::signPathInfo(ValidPathInfo & info)
1589-
{
1590-
// FIXME: keep secret keys in memory.
1591-
1592-
auto secretKeyFiles = settings.secretKeyFiles;
1593-
1594-
for (auto & secretKeyFile : secretKeyFiles.get()) {
1595-
SecretKey secretKey(readFile(secretKeyFile));
1596-
LocalSigner signer(std::move(secretKey));
1597-
info.sign(*this, signer);
1598-
}
1599-
}
1600-
1601-
16021588
std::optional<std::pair<int64_t, Realisation>> LocalStore::queryRealisationCore_(
16031589
LocalStore::State & state,
16041590
const DrvOutput & id)

src/libstore/local-store.hh

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -396,12 +396,6 @@ private:
396396
bool isValidPath_(State & state, const StorePath & path);
397397
void queryReferrers(State & state, const StorePath & path, StorePathSet & referrers);
398398

399-
/**
400-
* Add signatures to a ValidPathInfo or Realisation using the secret keys
401-
* specified by the ‘secret-key-files’ option.
402-
*/
403-
void signPathInfo(ValidPathInfo & info);
404-
405399
void addBuildLog(const StorePath & drvPath, std::string_view log) override;
406400

407401
friend struct LocalDerivationGoal;

src/libstore/store-api.cc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,6 +1274,21 @@ Derivation Store::readDerivation(const StorePath & drvPath)
12741274
Derivation Store::readInvalidDerivation(const StorePath & drvPath)
12751275
{ return readDerivationCommon(*this, drvPath, false); }
12761276

1277+
1278+
void Store::signPathInfo(ValidPathInfo & info)
1279+
{
1280+
// FIXME: keep secret keys in memory.
1281+
1282+
auto secretKeyFiles = settings.secretKeyFiles;
1283+
1284+
for (auto & secretKeyFile : secretKeyFiles.get()) {
1285+
SecretKey secretKey(readFile(secretKeyFile));
1286+
LocalSigner signer(std::move(secretKey));
1287+
info.sign(*this, signer);
1288+
}
1289+
}
1290+
1291+
12771292
void Store::signRealisation(Realisation & realisation)
12781293
{
12791294
// FIXME: keep secret keys in memory.

src/libstore/store-api.hh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,12 @@ public:
622622
virtual void addSignatures(const StorePath & storePath, const StringSet & sigs)
623623
{ unsupported("addSignatures"); }
624624

625+
/**
626+
* Add signatures to a ValidPathInfo or Realisation using the secret keys
627+
* specified by the ‘secret-key-files’ option.
628+
*/
629+
void signPathInfo(ValidPathInfo & info);
630+
625631
void signRealisation(Realisation &);
626632

627633
/* Utility functions. */

0 commit comments

Comments
 (0)