2 #include "uptane_repo.h"
4 UptaneRepo::UptaneRepo(
const boost::filesystem::path &path,
const std::string &expires,
5 const std::string &correlation_id)
6 : director_repo_(path, expires, correlation_id), image_repo_(path, expires, correlation_id) {}
8 void UptaneRepo::generateRepo(KeyType key_type) {
9 director_repo_.generateRepo(key_type);
10 image_repo_.generateRepo(key_type);
13 void UptaneRepo::addTarget(
const std::string &target_name,
const std::string &hardware_id,
14 const std::string &ecu_serial,
const std::string &url,
const std::string &expires) {
15 auto target = image_repo_.getTarget(target_name);
17 throw std::runtime_error(
"No such " + target_name +
" target in the image repository");
19 director_repo_.addTarget(target_name, target, hardware_id, ecu_serial, url, expires);
23 bool terminating, KeyType key_type) {
24 image_repo_.addDelegation(name, parent_role, path, terminating, key_type);
27 void UptaneRepo::revokeDelegation(
const Uptane::Role &name) {
28 director_repo_.revokeTargets(image_repo_.getDelegationTargets(name));
29 image_repo_.revokeDelegation(name);
32 void UptaneRepo::addImage(
const boost::filesystem::path &image_path,
const boost::filesystem::path &targetname,
33 const std::string &hardware_id,
const std::string &url,
const Delegation &delegation) {
34 image_repo_.addBinaryImage(image_path, targetname, hardware_id, url, delegation);
36 void UptaneRepo::addCustomImage(
const std::string &name,
const Hash &hash, uint64_t length,
37 const std::string &hardware_id,
const std::string &url,
const Delegation &delegation,
38 const Json::Value &custom) {
39 image_repo_.addCustomImage(name, hash, length, hardware_id, url, delegation, custom);
42 void UptaneRepo::signTargets() { director_repo_.signTargets(); }
44 void UptaneRepo::emptyTargets() { director_repo_.emptyTargets(); }
45 void UptaneRepo::oldTargets() { director_repo_.oldTargets(); }
47 void UptaneRepo::generateCampaigns() { director_repo_.generateCampaigns(); }
51 director_repo_.refresh(role);
53 image_repo_.refresh(role);