mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-16 03:06:17 +02:00
32 lines
704 B
C++
32 lines
704 B
C++
|
#include "file-system.hh"
|
||
|
#include "globals.hh"
|
||
|
#include "keys.hh"
|
||
|
|
||
|
namespace nix {
|
||
|
|
||
|
PublicKeys getDefaultPublicKeys()
|
||
|
{
|
||
|
PublicKeys publicKeys;
|
||
|
|
||
|
// FIXME: filter duplicates
|
||
|
|
||
|
for (auto s : settings.trustedPublicKeys.get()) {
|
||
|
PublicKey key(s);
|
||
|
publicKeys.emplace(key.name, key);
|
||
|
}
|
||
|
|
||
|
for (auto secretKeyFile : settings.secretKeyFiles.get()) {
|
||
|
try {
|
||
|
SecretKey secretKey(readFile(secretKeyFile));
|
||
|
publicKeys.emplace(secretKey.name, secretKey.toPublicKey());
|
||
|
} catch (SysError & e) {
|
||
|
/* Ignore unreadable key files. That's normal in a
|
||
|
multi-user installation. */
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return publicKeys;
|
||
|
}
|
||
|
|
||
|
}
|