MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / key

Method key

app/src/AI/KeyVault.cpp:74–90  ·  view source on GitHub ↗

* @brief Decrypts and returns the plaintext key for the given provider. */

Source from the content-addressed store, hash-verified

72 * @brief Decrypts and returns the plaintext key for the given provider.
73 */
74QString AI::KeyVault::key(ProviderId provider) const
75{
76 m_settings.beginGroup(QStringLiteral("ai/keys"));
77 const auto cipher = m_settings.value(settingsKey(provider)).toString();
78 m_settings.endGroup();
79
80 if (cipher.isEmpty())
81 return {};
82
83 auto plaintext = m_simpleCrypt.decryptToString(cipher);
84 if (m_simpleCrypt.lastError() != Licensing::SimpleCrypt::ErrorNoError) {
85 qCWarning(serialStudioAI) << "Key decrypt failed for" << settingsKey(provider);
86 return {};
87 }
88
89 return plaintext;
90}
91
92//--------------------------------------------------------------------------------------------------
93// Mutations

Callers 15

proceedCompleterBeginMethod · 0.80
proceedCompleterEndMethod · 0.80
keyPressEventMethod · 0.80
Checksum.cppFile · 0.80
MQTT.cppFile · 0.80
getAvailableCommandsMethod · 0.80
runningProcessesMethod · 0.80
cleanupMethod · 0.80

Calls 4

isEmptyMethod · 0.80
decryptToStringMethod · 0.80
valueMethod · 0.45
lastErrorMethod · 0.45

Tested by

no test coverage detected