geopro/src/app/Credential.hpp

21 lines
760 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#pragma once
// 登录凭证安全存取(规约 §7.4:严禁明文)。基于 QtKeychain → 系统凭证库
// Windows 凭据管理器 / macOS Keychain / Linux Secret Service
// M1 用法:登录成功且勾选「记住」时存 token+时间戳;启动时若未超期则免登录。
#include <QString>
namespace geopro::app {
// 记住会话:把 token + 当前时间戳安全存入系统凭证库。token 为空则忽略。
void rememberSession(const QString& token);
// 取回有效 token已存且未超过 maxAgeDays 天 → 返回 token否则返回空串。
QString recallValidToken(int maxAgeDays = 30);
// 清除已记住的会话(未勾选记住 / 注销时调用)。
void forgetSession();
} // namespace geopro::app