ServiceAccountAuth signs an RS256 JWT with wolfCrypt from the key file in GOOGLE_APPLICATION_CREDENTIALS and exchanges it for a self-refreshing bearer token. GoogleClient holds a key and an OAuth credential and uses OAuth everywhere except express endpoints, which only accept the key. Signing is tested with generated RSA keys and public-key verification. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
29 lines
794 B
C++
29 lines
794 B
C++
#pragma once
|
|
|
|
// A Google service is a name plus a base URL (host and version prefix).
|
|
// New Google APIs are one constant here and one Service subclass.
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace molo::google {
|
|
|
|
struct ServiceEndpoint {
|
|
std::string name;
|
|
std::string base_url; // No trailing slash.
|
|
// Express-mode endpoints accept only an API key: never send OAuth there.
|
|
bool prefer_key = false;
|
|
};
|
|
|
|
namespace endpoints {
|
|
ServiceEndpoint text_to_speech();
|
|
ServiceEndpoint speech_to_text();
|
|
ServiceEndpoint generative();
|
|
// Gemini through Vertex AI (express-mode API keys start with "AQ.").
|
|
ServiceEndpoint vertex_generative();
|
|
// Every endpoint this build knows, for status pages.
|
|
std::vector<ServiceEndpoint> catalog();
|
|
} // namespace endpoints
|
|
|
|
} // namespace molo::google
|