Skip to content

genesis_tool/LocalTrustAdmin.hpp

Explicit, process-local trusted-peer policy administration.

Namespaces

Name
sgns
sgns::trustedpeer

Classes

Name
class sgns::trustedpeer::LocalTrustAdmin
struct sgns::trustedpeer::LocalTrustAdmin::CandidateSummary

Source code

#ifndef SGNS_TRUSTEDPEER_GENESIS_TOOL_LOCAL_TRUST_ADMIN_HPP
#define SGNS_TRUSTEDPEER_GENESIS_TOOL_LOCAL_TRUST_ADMIN_HPP

#include <cstdint>
#include <memory>
#include <string>
#include <vector>

#include "account/BurnConfig.hpp"
#include "outcome/outcome.hpp"
#include "securecrdt/SecureCrdtCandidate.hpp"
#include "trustedpeer/QuorumPolicy.hpp"
#include "trustedpeer/TrustedPeerRegistry.hpp"

namespace sgns::trustedpeer
{
    class LocalTrustAdmin
    {
    public:
        enum class CandidateType : uint8_t
        {
            Policy,
            Burn,
        };

        struct CandidateSummary
        {
            CandidateType type = CandidateType::Policy;
            sgns::securecrdt::CandidateId id;
        };

        LocalTrustAdmin( std::shared_ptr<TrustedPeerRegistry> registry,
                         std::shared_ptr<sgns::account::BurnConfig> burn_config,
                         std::string policy_domain = "trusted-peer",
                         std::string burn_domain = "burn-config" );

        outcome::result<std::vector<CandidateSummary>> ListCandidates() const;

        outcome::result<sgns::securecrdt::CandidateId> ProposePolicy( const QuorumPolicyState &candidate );

        outcome::result<sgns::securecrdt::CandidateId> ProposeBurn( uint64_t basis_points );

        outcome::result<sgns::securecrdt::CandidateId> Approve(
            const sgns::securecrdt::CandidateId &candidate_id );

    private:
        std::shared_ptr<TrustedPeerRegistry> registry_;
        std::shared_ptr<sgns::account::BurnConfig> burn_config_;
        std::string policy_domain_;
        std::string burn_domain_;
    };
} // namespace sgns::trustedpeer

#endif // SGNS_TRUSTEDPEER_GENESIS_TOOL_LOCAL_TRUST_ADMIN_HPP

Updated on 2026-09-25 at 15:46:12 +0000