diff options
| author | Osmium Sorcerer <os@sof.beauty> | 2026-03-22 18:55:26 +0000 |
|---|---|---|
| committer | Osmium Sorcerer <os@sof.beauty> | 2026-03-29 22:22:25 +0000 |
| commit | a124f46861d549ddc13485536962e34d80de939a (patch) | |
| tree | 3553849323aa70fef1e198f3476a2abcc7adfe39 /src/saved_auth.h | |
| parent | b1ad938c37f4e175e5509f727d1033b074b134d4 (diff) | |
Add authentication dialog
Introduce start_auth_flow, a function invoked by typing `/auth username`
in OOC. It sends an public-key authentication request to the server,
starting the entire flow.
The flow invoves two dialogs: to select the key, and to enter the
passphrase to unlock the key. For convenience, each successful unlock
also remembers the key for that username on the server, storing this
in `saved_auth.json` (I chose JSON because I wanted it to stay
human-editable; INI would be better, but it suffers from bad platform
quirks in Qt).
Diffstat (limited to 'src/saved_auth.h')
| -rw-r--r-- | src/saved_auth.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/saved_auth.h b/src/saved_auth.h new file mode 100644 index 0000000..d37a8fd --- /dev/null +++ b/src/saved_auth.h @@ -0,0 +1,17 @@ +#pragma once + +#include <QHash> + +class SavedAuth +{ +public: + bool load(); + QByteArray lookup(QByteArrayView host, QByteArrayView user) const; + void insert(QByteArrayView host, QByteArrayView user, QByteArrayView key); + void remove(QByteArrayView host, QByteArrayView user); + +private: + QHash<QByteArray, QByteArray> m_table; + bool save() const; + QByteArray flatten_key(QByteArrayView host, QByteArrayView user) const; +}; |
