File indexing completed on 2024-04-28 04:43:38

0001 /*
0002  Copyright (C) 2007 Justin Karneges <justin@affinix.com>
0003 
0004  Permission is hereby granted, free of charge, to any person obtaining a copy
0005  of this software and associated documentation files (the "Software"), to deal
0006  in the Software without restriction, including without limitation the rights
0007  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
0008  copies of the Software, and to permit persons to whom the Software is
0009  furnished to do so, subject to the following conditions:
0010 
0011  The above copyright notice and this permission notice shall be included in
0012  all copies or substantial portions of the Software.
0013 
0014  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0015  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0016  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
0017  AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
0018  AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
0019  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
0020 */
0021 
0022 #ifndef PROMPTER_H
0023 #define PROMPTER_H
0024 
0025 #include <QObject>
0026 
0027 namespace QCA {
0028 class SecureArray;
0029 class Event;
0030 }
0031 
0032 class Prompter : public QObject
0033 {
0034     Q_OBJECT
0035 public:
0036     Prompter(QObject *parent = nullptr);
0037     ~Prompter();
0038 
0039 protected:
0040     // called with every password event, to check for a known value.
0041     //   reimplement it to provide known/cached passwords.
0042     virtual QCA::SecureArray knownPassword(const QCA::Event &event);
0043 
0044     // called when a user-entered password is submitted.  note that this
0045     //   does not mean the password was correct.  to know if the password
0046     //   was correct, you'll have to match up the event information with
0047     //   the operation that triggered it.
0048     virtual void userSubmitted(const QCA::SecureArray &password, const QCA::Event &event);
0049 
0050 private:
0051     class Private;
0052     friend class Private;
0053     Private *d;
0054 };
0055 
0056 #endif