diff --git a/lix/libstore/build/derivation-goal.hh b/lix/libstore/build/derivation-goal.hh index 0fa1c634b..0ca01c070 100644 --- a/lix/libstore/build/derivation-goal.hh +++ b/lix/libstore/build/derivation-goal.hh @@ -292,11 +292,6 @@ struct DerivationGoal : public Goal */ Path openLogFile(); - /** - * Sign the newly built realisation if the store allows it - */ - virtual void signRealisation(Realisation&) {} - /** * Close the log file. */ diff --git a/lix/libstore/build/local-derivation-goal.cc b/lix/libstore/build/local-derivation-goal.cc index bb72d2c1a..28940a01c 100644 --- a/lix/libstore/build/local-derivation-goal.cc +++ b/lix/libstore/build/local-derivation-goal.cc @@ -2052,11 +2052,6 @@ try { co_return result::current_exception(); } -void LocalDerivationGoal::signRealisation(Realisation & realisation) -{ - getLocalStore().signRealisation(realisation); -} - kj::Promise> LocalDerivationGoal::checkOutputs(const std::map & newlyBuiltOutputs, const std::map & alreadyRegisteredOutputs) try { diff --git a/lix/libstore/build/local-derivation-goal.hh b/lix/libstore/build/local-derivation-goal.hh index 918893cd8..083ca2236 100644 --- a/lix/libstore/build/local-derivation-goal.hh +++ b/lix/libstore/build/local-derivation-goal.hh @@ -203,8 +203,6 @@ struct LocalDerivationGoal : public DerivationGoal */ kj::Promise> registerOutputs() override; - void signRealisation(Realisation &) override; - /** * Check that an output meets the requirements specified by the * 'outputChecks' attribute (or the legacy diff --git a/lix/libstore/local-store.cc b/lix/libstore/local-store.cc index 96b59c22f..287f9a932 100644 --- a/lix/libstore/local-store.cc +++ b/lix/libstore/local-store.cc @@ -1225,11 +1225,6 @@ bool LocalStore::pathInfoIsUntrusted(const ValidPathInfo & info) return config_.requireSigs && !info.checkSignatures(*this, getPublicKeys()); } -bool LocalStore::realisationIsUntrusted(const Realisation & realisation) -{ - return config_.requireSigs && !realisation.checkSignatures(getPublicKeys()); -} - kj::Promise> LocalStore::addToStore( const ValidPathInfo & info, AsyncInputStream & source, @@ -1816,18 +1811,6 @@ try { } -void LocalStore::signRealisation(Realisation & realisation) -{ - // FIXME: keep secret keys in memory. - - auto secretKeyFiles = settings.secretKeyFiles; - - for (auto & secretKeyFile : secretKeyFiles.get()) { - SecretKey secretKey(readFile(secretKeyFile)); - realisation.sign(secretKey); - } -} - void LocalStore::signPathInfo(ValidPathInfo & info) { // FIXME: keep secret keys in memory. diff --git a/lix/libstore/local-store.hh b/lix/libstore/local-store.hh index 07bf7e7d6..c76d49c4e 100644 --- a/lix/libstore/local-store.hh +++ b/lix/libstore/local-store.hh @@ -210,7 +210,6 @@ public: kj::Promise> querySubstitutablePaths(const StorePathSet & paths) override; bool pathInfoIsUntrusted(const ValidPathInfo &) override; - bool realisationIsUntrusted(const Realisation & ) override; kj::Promise> addToStore(const ValidPathInfo & info, AsyncInputStream & source, RepairFlag repair, CheckSigsFlag checkSigs) override; @@ -392,7 +391,6 @@ private: * specified by the ‘secret-key-files’ option. */ void signPathInfo(ValidPathInfo & info); - void signRealisation(Realisation &); // XXX: Make a generic `Store` method ContentAddress hashCAPath( diff --git a/lix/libstore/realisation.cc b/lix/libstore/realisation.cc index 0592bb89d..e4a7bf0db 100644 --- a/lix/libstore/realisation.cc +++ b/lix/libstore/realisation.cc @@ -71,36 +71,6 @@ Realisation Realisation::fromJSON( }; } -std::string Realisation::fingerprint() const -{ - auto serialized = toJSON(); - serialized.erase("signatures"); - return serialized.dump(); -} - -void Realisation::sign(const SecretKey & secretKey) -{ - signatures.insert(secretKey.signDetached(fingerprint())); -} - -bool Realisation::checkSignature(const PublicKeys & publicKeys, const std::string & sig) const -{ - return verifyDetached(fingerprint(), sig, publicKeys); -} - -size_t Realisation::checkSignatures(const PublicKeys & publicKeys) const -{ - // FIXME: Maybe we should return `maxSigs` if the realisation corresponds to - // an input-addressed one − because in that case the drv is enough to check - // it − but we can't know that here. - - size_t good = 0; - for (auto & sig : signatures) - if (checkSignature(publicKeys, sig)) - good++; - return good; -} - SingleDrvOutputs filterDrvOutputs(const OutputsSpec& wanted, SingleDrvOutputs&& outputs) { @@ -118,24 +88,6 @@ StorePath RealisedPath::path() const { return std::visit([](auto && arg) { return arg.getPath(); }, raw); } -bool Realisation::isCompatibleWith(const Realisation & other) const -{ - assert (id == other.id); - if (outPath == other.outPath) { - if (dependentRealisations.empty() != other.dependentRealisations.empty()) { - warn( - "Encountered a realisation for '%s' with an empty set of " - "dependencies. This is likely an artifact from an older Nix. " - "I’ll try to fix the realisation if I can", - id.to_string()); - return true; - } else if (dependentRealisations == other.dependentRealisations) { - return true; - } - } - return false; -} - kj::Promise> RealisedPath::closure( Store& store, const RealisedPath::Set& startPaths, diff --git a/lix/libstore/realisation.hh b/lix/libstore/realisation.hh index 17c9008ca..f263c6494 100644 --- a/lix/libstore/realisation.hh +++ b/lix/libstore/realisation.hh @@ -63,13 +63,6 @@ struct Realisation { JSON toJSON() const; static Realisation fromJSON(const JSON& json, const std::string& whence); - std::string fingerprint() const; - void sign(const SecretKey &); - bool checkSignature(const PublicKeys & publicKeys, const std::string & sig) const; - size_t checkSignatures(const PublicKeys & publicKeys) const; - - bool isCompatibleWith(const Realisation & other) const; - StorePath getPath() const { return outPath; } GENERATE_CMP(Realisation, me->id, me->outPath); diff --git a/lix/libstore/store-api.hh b/lix/libstore/store-api.hh index 39ee68d7f..07cdf68f8 100644 --- a/lix/libstore/store-api.hh +++ b/lix/libstore/store-api.hh @@ -409,11 +409,6 @@ public: return true; } - virtual bool realisationIsUntrusted(const Realisation & ) - { - return true; - } - protected: /**