Skip to content

Commit dbd1613

Browse files
committed
feat: WIP, add dummy implementations for SecretStorage on platforms, where this is still WIP
1 parent 8dd8456 commit dbd1613

File tree

1 file changed

+48
-4
lines changed

1 file changed

+48
-4
lines changed

src/lobby/credentials/secret.cpp

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,14 +147,58 @@ secret::SecretStorage::store(const std::string& key, const std::string& value, b
147147
}
148148

149149

150+
#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
151+
152+
153+
//TODO: use https://learn.microsoft.com/en-us/windows/win32/seccng/cng-key-storage-functions
154+
155+
secret::SecretStorage::SecretStorage(KeyringType type) : m_type{ type } { }
156+
157+
158+
[[nodiscard]] helper::expected<std::string, std::string> secret::SecretStorage::load(const std::string& key) const {
159+
return result_string;
160+
}
161+
162+
[[nodiscard]] std::optional<std::string>
163+
secret::SecretStorage::store(const std::string& key, const std::string& value, bool update) const {
164+
return std::nullopt;
165+
}
166+
167+
168+
[[nodiscard]] std::optional<std::string> secret::SecretStorage::remove(const std::string& key) const {
169+
return std::nullopt;
170+
}
171+
172+
150173
#elif defined(__ANDROID__)
151-
#error "CURRENTLY Unsupported platform"
174+
//TODO: use https://developer.android.com/privacy-and-security/keystore
175+
176+
secret::SecretStorage::SecretStorage(KeyringType type) : m_type{ type } { }
177+
178+
179+
[[nodiscard]] helper::expected<std::string, std::string> secret::SecretStorage::load(const std::string& key) const {
180+
return result_string;
181+
}
182+
183+
[[nodiscard]] std::optional<std::string>
184+
secret::SecretStorage::store(const std::string& key, const std::string& value, bool update) const {
185+
return std::nullopt;
186+
}
187+
188+
189+
[[nodiscard]] std::optional<std::string> secret::SecretStorage::remove(const std::string& key) const {
190+
return std::nullopt;
191+
}
192+
152193
#elif defined(__CONSOLE__)
194+
195+
//TODO: fall back to just store it in a file, that is json
153196
#error "CURRENTLY Unsupported platform"
154-
#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
155-
#error "CURRENTLY Unsupported platform"
197+
156198
#elif defined(__APPLE__)
199+
200+
//TODO: fall back to just store it in a file, that is json
157201
#error "CURRENTLY Unsupported platform"
158202
#else
159-
#error "CURRENTLY Unsupported platform"
203+
#error "Unsupported platform"
160204
#endif

0 commit comments

Comments
 (0)