mirror of
https://github.com/hanzo-cpp/sdk.git
synced 2026-11-20 19:55:32 +00:00
The projection was 113 commits behind the document it claims to describe, and `generate.py --all --check` reported every one of the thirteen clients DRIFTED — the same +19 models in each, because they all fell behind the same emission. Regenerated in place from hanzo-inc/cloud openapi.yaml at 939b09d4 (sha256 087024f6…), which is the only description of this API that cannot name a route the binary does not serve. `--check` is clean across all thirteen after. .spec-lock moved with the code. The generator READS that file and never writes it — hanzoai/ci`s lane does — so a hand run leaves every lock naming the previous document. A lock that disagrees with the tree beside it is worse than no lock: the next `--check` without `--spec` fetches what production serves, compares it to a digest that was already wrong, and reports drift that is really staleness.
172 lines
11 KiB
C++
172 lines
11 KiB
C++
/**
|
|
* Hanzo Cloud API
|
|
* The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
|
|
*
|
|
* The version of the OpenAPI document: v1
|
|
*
|
|
* NOTE: This class is auto generated by OpenAPI-Generator 7.14.0.
|
|
* https://openapi-generator.tech
|
|
* Do not edit the class manually.
|
|
*/
|
|
|
|
/*
|
|
* LicensingApi.h
|
|
*
|
|
*
|
|
*/
|
|
|
|
#ifndef HANZO_API_LicensingApi_H_
|
|
#define HANZO_API_LicensingApi_H_
|
|
|
|
|
|
|
|
#include "hanzo/ApiClient.h"
|
|
|
|
#include "hanzo/model/Licensing_FingerprintRequest.h"
|
|
#include "hanzo/model/Licensing_FingerprintResponse.h"
|
|
#include "hanzo/model/Licensing_HealthView.h"
|
|
#include "hanzo/model/Licensing_IssueRequest.h"
|
|
#include "hanzo/model/Licensing_IssueResponse.h"
|
|
#include "hanzo/model/Licensing_PubkeyView.h"
|
|
#include "hanzo/model/Licensing_Release.h"
|
|
#include "hanzo/model/Licensing_ReleaseAsset.h"
|
|
#include "hanzo/model/Licensing_ReleaseList.h"
|
|
#include "hanzo/model/Licensing_RevokeRequest.h"
|
|
#include "hanzo/model/Licensing_RevokeResponse.h"
|
|
#include "hanzo/model/Licensing_VerifyRequest.h"
|
|
#include "hanzo/model/Licensing_VerifyResponse.h"
|
|
#include <cpprest/details/basic_types.h>
|
|
#include <boost/optional.hpp>
|
|
|
|
namespace hanzo {
|
|
namespace api {
|
|
|
|
using namespace hanzo::model;
|
|
|
|
|
|
|
|
class LicensingApi
|
|
{
|
|
public:
|
|
|
|
explicit LicensingApi( std::shared_ptr<const ApiClient> apiClient );
|
|
|
|
virtual ~LicensingApi();
|
|
|
|
/// <summary>
|
|
/// Download resolves a release to its artifact, gated on a valid license.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Download resolves a release to its artifact, gated on a valid license. The gate is the LICENSE token, not the IAM bearer: being signed in is not permission to download a paid binary — holding a good license for it is. The token must verify against this deployment's public key, be unrevoked, be scoped to the release's app, and carry every feature the release requires. Present it as the `X-License-Token` header (preferred, since a header does not land in proxy logs) or as `?token=`. The response pairs the artifact URL with its cosign signature so the client verifies the binary BEFORE trusting it: a signed URL alone proves where the bytes came from, not what they are. A yanked release is 410 Gone.
|
|
/// </remarks>
|
|
/// <param name="release"></param>
|
|
/// <param name="xLicenseToken"> (optional, default to utility::conversions::to_string_t(""))</param>
|
|
/// <param name="token"> (optional, default to utility::conversions::to_string_t(""))</param>
|
|
pplx::task<std::shared_ptr<Licensing_ReleaseAsset>> getLicensingDownloadByRelease(
|
|
utility::string_t release,
|
|
boost::optional<utility::string_t> xLicenseToken,
|
|
boost::optional<utility::string_t> token
|
|
) const;
|
|
/// <summary>
|
|
/// Health reports which signer this deployment mints with, and in which env.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Health reports which signer this deployment mints with, and in which env. It answers 200 whenever the process is up: there is nothing downstream to probe, since the KMS is reached only when a token is actually minted. Its value is the `signer` field — `\"signer\":\"local\"` on a production host says that deployment is signing licenses with a development key, which is a misconfiguration worth paging on rather than a healthy 200.
|
|
/// </remarks>
|
|
pplx::task<std::shared_ptr<Licensing_HealthView>> getLicensingHealthz(
|
|
) const;
|
|
/// <summary>
|
|
/// Pubkey publishes the Ed25519 PUBLIC verification key, at both /pubkey and /jwks.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Pubkey publishes the Ed25519 PUBLIC verification key, at both /pubkey and /jwks. This is the only public-safe surface here and the reason the whole scheme works offline: the engine embeds or fetches this key once and then verifies every license itself, with no call home per launch. The private half never enters this process — it lives in the KMS — so nothing served here is a secret. `provider` names the KMS holding that half; `\"local\"` means a development key, and a token signed by one is not a production credential.
|
|
/// </remarks>
|
|
pplx::task<std::shared_ptr<Licensing_PubkeyView>> getLicensingJwks(
|
|
) const;
|
|
/// <summary>
|
|
/// Pubkey publishes the Ed25519 PUBLIC verification key, at both /pubkey and /jwks.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Pubkey publishes the Ed25519 PUBLIC verification key, at both /pubkey and /jwks. This is the only public-safe surface here and the reason the whole scheme works offline: the engine embeds or fetches this key once and then verifies every license itself, with no call home per launch. The private half never enters this process — it lives in the KMS — so nothing served here is a secret. `provider` names the KMS holding that half; `\"local\"` means a development key, and a token signed by one is not a production credential.
|
|
/// </remarks>
|
|
pplx::task<std::shared_ptr<Licensing_PubkeyView>> getLicensingPubkey(
|
|
) const;
|
|
/// <summary>
|
|
/// Lists the signed binary releases this deployment can serve.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Lists the signed binary releases this deployment can serve. Metadata only, and no download URL: the artifact is behind GET /v1/licensing/download/{release}, which is gated on a valid license token. Knowing that a release exists is not permission to run it, which is why this list needs no license of its own.
|
|
/// </remarks>
|
|
pplx::task<std::shared_ptr<Licensing_ReleaseList>> getLicensingReleases(
|
|
) const;
|
|
/// <summary>
|
|
/// Reads one release's metadata: its product, version, platform and the cosign material a client verifies the binary against.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Reads one release's metadata: its product, version, platform and the cosign material a client verifies the binary against. An unknown id is 404. Like the list, this is metadata only — the bytes are behind the license-gated download.
|
|
/// </remarks>
|
|
/// <param name="release"></param>
|
|
pplx::task<std::shared_ptr<Licensing_Release>> getLicensingReleasesByRelease(
|
|
utility::string_t release
|
|
) const;
|
|
/// <summary>
|
|
/// Fingerprint turns raw device signals into the opaque value that binds a license to one machine.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Fingerprint turns raw device signals into the opaque value that binds a license to one machine. This is the anti-copy step: the value returned here is folded into the signed token, so a token minted with it runs only on the device it was bound to. The derivation is one-way and salted — the signals are never stored and never echoed back — so the response is safe to persist client-side and pass to issue. Signals too weak to identify a machine (a hostname alone) are refused rather than turned into a binding that would collide with other machines.
|
|
/// </remarks>
|
|
/// <param name="licensingFingerprintRequest"></param>
|
|
pplx::task<std::shared_ptr<Licensing_FingerprintResponse>> postLicensingFingerprint(
|
|
std::shared_ptr<Licensing_FingerprintRequest> licensingFingerprintRequest
|
|
) const;
|
|
/// <summary>
|
|
/// Issue mints a signed license token for a product the caller's org already pays for.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Issue mints a signed license token for a product the caller's org already pays for. The order is the whole security argument: the caller is an IAM-validated principal, commerce is then asked whether that principal's ORG holds an ACTIVE entitlement for the product, and only then is a token signed — by the KMS, never by key material in this process. A product the org does not own answers 403 and no token. The signed features are the plan's features verbatim, so the engine enforces exactly what was bought, and the expiry is clamped to the entitlement's so a token cannot outlive the subscription that paid for it. The token is the credential the engine runs on. Treat it as a secret.
|
|
/// </remarks>
|
|
/// <param name="licensingIssueRequest"></param>
|
|
pplx::task<std::shared_ptr<Licensing_IssueResponse>> postLicensingIssue(
|
|
std::shared_ptr<Licensing_IssueRequest> licensingIssueRequest
|
|
) const;
|
|
/// <summary>
|
|
/// Publishes a signed binary release, answering 201 Created.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Publishes a signed binary release, answering 201 Created. Outside dev a release MUST carry its cosign signature: this is how a binary becomes downloadable, so accepting an unsigned one would let an unverifiable artifact into the distribution path. Org-admin only — publishing is an operator action, not something a licensee does.
|
|
/// </remarks>
|
|
/// <param name="licensingRelease"></param>
|
|
pplx::task<std::shared_ptr<Licensing_Release>> postLicensingReleases(
|
|
std::shared_ptr<Licensing_Release> licensingRelease
|
|
) const;
|
|
/// <summary>
|
|
/// Revoke turns off tokens that have already been issued.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Revoke turns off tokens that have already been issued. A signed token cannot be un-signed, so revocation is the only way to withdraw one: this appends an entry that verify and the license-gated download both consult. It is a POST rather than a DELETE because it APPENDS a durable, attributed record — the entry names the admin who recorded it and when — rather than removing one. Org-admin only. Scope it as narrowly as the incident allows: \"nonce\" for one leaked token, \"holder\" for one compromised account, \"fingerprint\" for one stolen machine, \"release\" when a whole build is bad.
|
|
/// </remarks>
|
|
/// <param name="licensingRevokeRequest"></param>
|
|
pplx::task<std::shared_ptr<Licensing_RevokeResponse>> postLicensingRevoke(
|
|
std::shared_ptr<Licensing_RevokeRequest> licensingRevokeRequest
|
|
) const;
|
|
/// <summary>
|
|
/// Verify checks a license token online: signature, schema, expiry, app_id and the revocation list.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// Verify checks a license token online: signature, schema, expiry, app_id and the revocation list. It is UNAUTHENTICATED and always answers 200 — a bad token is `valid:false` with a reason rather than an error status, because \"is this token good\" is a question anyone may ask about a credential they already hold and the answer is the same either way. It is also OPTIONAL: the engine verifies OFFLINE against the published public key (GET /v1/licensing/pubkey) and needs this endpoint only to learn about revocation, so an outage here never stops a paid customer working.
|
|
/// </remarks>
|
|
/// <param name="licensingVerifyRequest"></param>
|
|
pplx::task<std::shared_ptr<Licensing_VerifyResponse>> postLicensingVerify(
|
|
std::shared_ptr<Licensing_VerifyRequest> licensingVerifyRequest
|
|
) const;
|
|
|
|
protected:
|
|
std::shared_ptr<const ApiClient> m_ApiClient;
|
|
};
|
|
|
|
}
|
|
}
|
|
|
|
#endif /* HANZO_API_LicensingApi_H_ */
|
|
|