25#include <nlohmann/json.hpp>
30 aJson = nlohmann::json{
35 {
"scope", aTokens.
scope },
44 aJson.at(
"access_token" ).get_to( aTokens.
access_token );
46 aJson.at(
"id_token" ).get_to( aTokens.
id_token );
47 aJson.at(
"token_type" ).get_to( aTokens.
token_type );
48 aJson.at(
"scope" ).get_to( aTokens.
scope );
49 aJson.at(
"expires_at" ).get_to( aTokens.
expires_at );
54 const wxString& aSecret )
61 wxString& aSecret )
const
82 const wxString secret = wxString::FromUTF8( nlohmann::json( aTokens ).
dump().c_str() );
88 const wxString& aAccountId )
const
100 return nlohmann::json::parse( secret.ToStdString() ).get<
OAUTH_TOKEN_SET>();
117 return wxS(
"org.kicad.remote_provider." ) + aProviderId;
std::unique_ptr< OAUTH_SECRET_BACKEND > m_backend
bool DeleteTokens(const wxString &aProviderId, const wxString &aAccountId)
std::optional< OAUTH_TOKEN_SET > LoadTokens(const wxString &aProviderId, const wxString &aAccountId) const
static wxString MakeServiceName(const wxString &aProviderId)
SECURE_TOKEN_STORE(std::unique_ptr< OAUTH_SECRET_BACKEND > aBackend=std::make_unique< PLATFORM_SECRET_BACKEND >())
bool StoreTokens(const wxString &aProviderId, const wxString &aAccountId, const OAUTH_TOKEN_SET &aTokens)
void from_json(const nlohmann::json &aJson, OAUTH_TOKEN_SET &aTokens)
void to_json(nlohmann::json &aJson, const OAUTH_TOKEN_SET &aTokens)
wxString dump(const wxArrayString &aArray)
Debug helper for printing wxArrayString contents.