Enforce signed licenses and seamless track handoff
Independent component release / publish (push) Failing after 11s
Independent component release / publish (push) Failing after 11s
This commit is contained in:
15 files changed
+1367
-98
No files matched your search
@@ -0,0 +1,60 @@
|
||||
#pragma once
|
||||
|
||||
#include <Void/Functional/Result.hpp>
|
||||
#include <Void/Update/Feed.hpp>
|
||||
|
||||
#include <chrono>
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
namespace Echoion::Core::Licensing
|
||||
{
|
||||
enum class Mode { Active, UpdateOnly };
|
||||
|
||||
struct LeaseContext {
|
||||
std::string productId;
|
||||
std::string productVersion;
|
||||
std::string deviceId;
|
||||
std::string buildSignature;
|
||||
std::string challenge;
|
||||
std::chrono::system_clock::time_point now;
|
||||
std::chrono::milliseconds maximumLeaseLifetime{
|
||||
std::chrono::hours(24)};
|
||||
std::uint64_t minimumSequence{0};
|
||||
};
|
||||
|
||||
struct LeaseStatus {
|
||||
Mode mode{Mode::UpdateOnly};
|
||||
std::string reason;
|
||||
std::string licenseId;
|
||||
std::uint64_t sequence{0};
|
||||
std::chrono::system_clock::time_point refreshAfter;
|
||||
std::chrono::system_clock::time_point expiresAt;
|
||||
std::vector<std::string> entitlements;
|
||||
};
|
||||
|
||||
/// Decode a base64/base64url Ed25519 public key and add it to a keyring.
|
||||
[[nodiscard]] Void::Result::Result<void>
|
||||
addPublicKey(Void::Update::Keyring& keyring, std::string_view keyId,
|
||||
std::string_view encodedKey);
|
||||
|
||||
/// Verify a root-signed keyset and append currently valid, non-revoked
|
||||
/// lease signing keys. The pinned root itself remains in the returned
|
||||
/// keyring so a direct emergency root-signed lease can still be accepted.
|
||||
[[nodiscard]] Void::Result::Result<Void::Update::Keyring>
|
||||
verifyKeyset(std::string_view envelopeJson,
|
||||
const Void::Update::Keyring& rootKeys,
|
||||
std::chrono::system_clock::time_point now);
|
||||
|
||||
/// Verify the signed lease and signed revocation snapshot as one decision.
|
||||
/// Any malformed, expired, replayed, mismatched, or revoked input fails
|
||||
/// closed into UpdateOnly through the returned error.
|
||||
[[nodiscard]] Void::Result::Result<LeaseStatus>
|
||||
verifyLease(std::string_view leaseEnvelopeJson,
|
||||
std::string_view revocationEnvelopeJson,
|
||||
const Void::Update::Keyring& leaseKeys,
|
||||
const LeaseContext& context);
|
||||
} // namespace Echoion::Core::Licensing
|
||||
Reference in new issue
Block a user