mirror of
https://github.com/overte-org/overte.git
synced 2025-07-15 16:16:41 +02:00
* canRez(Tmp)Certified() * CertifiedItem beginnings * Skeleton of verifyOwnerChallenge() * Controlled failure; updateLocation() skeletion * Controlled failure on checkout page with ctrl+f * Skeleton Purchases first-use tutorial * Initial progress on new setup * Security pic tip * Skeleton Certificate page * Updates to Certificate * General progress; setup is nearly complete * Better buttons; last step almost done * Initial progress on wallet home * Completed recent transactions * Security page * Scrollbar * Fix auth error text * PassphraseSelection * Change security pic * Minor layout changes; beginnings of emulated header * Various layout changes; wallet nav bar * Help screen * Quick onaccepted change * First pass at new purchases * Small style updates * Some error progress * Lightbox in purchases * Collapse other help answers when clicking on another * REZZED notif * Commerce Lightbox * Lots of new interactions in Purchases * Hook up 'view certificate' * Fix errors, fix close button on cert * Purchases timer; much faster filter * Add debugCheckout * Purchase updates * GlyphButton; separator; Checkout Success; Ledger fix; debug modes * Lock glyph below security pic should be white * Various fixes, round 1 * Circular mask * Passphrase change button fix; TextField error edge highlighting * Recent Activity fixes * Various changes * Standard Security Pic location * Color changes * Filter bar changes * Styling for multiple owned items * Minor language change * Header dropdown (harder than expected) * Small fixes * View backup instructions * marketplaces.js onCommerceScreen * Beginnign of new injection * Marketplace injection changes * Purchase button style changes * More button styling * MY PURCHASES button * marketplace onUsernameChanged * New help QA * Help text changes etc * Downscale security image, reducing filesize * Lots of bugfixes * Cleanup before PR * Only open cert during inspection if commerce switch is on * Help text changes * Purchase status incl. change to confirmed; Help text; Open Explorer to hifikey * Quick glyph change * New 'wallet not set up' flow for when entering Purchases or Checkout without set-up wallet
76 lines
2.3 KiB
C++
76 lines
2.3 KiB
C++
//
|
|
// Wallet.h
|
|
// interface/src/commerce
|
|
//
|
|
// API for secure keypair management
|
|
//
|
|
// Created by Howard Stearns on 8/4/17.
|
|
// Copyright 2017 High Fidelity, Inc.
|
|
//
|
|
// Distributed under the Apache License, Version 2.0.
|
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
|
//
|
|
|
|
#ifndef hifi_Wallet_h
|
|
#define hifi_Wallet_h
|
|
|
|
#include <DependencyManager.h>
|
|
#include <Node.h>
|
|
#include <ReceivedMessage.h>
|
|
|
|
#include <QPixmap>
|
|
|
|
class Wallet : public QObject, public Dependency {
|
|
Q_OBJECT
|
|
SINGLETON_DEPENDENCY
|
|
|
|
public:
|
|
Wallet();
|
|
~Wallet();
|
|
// These are currently blocking calls, although they might take a moment.
|
|
bool generateKeyPair();
|
|
QStringList listPublicKeys();
|
|
QString signWithKey(const QByteArray& text, const QString& key);
|
|
void chooseSecurityImage(const QString& imageFile);
|
|
void getSecurityImage();
|
|
void sendKeyFilePathIfExists();
|
|
|
|
void setSalt(const QByteArray& salt) { _salt = salt; }
|
|
QByteArray getSalt() { return _salt; }
|
|
void setIv(const QByteArray& iv) { _iv = iv; }
|
|
QByteArray getIv() { return _iv; }
|
|
void setCKey(const QByteArray& ckey) { _ckey = ckey; }
|
|
QByteArray getCKey() { return _ckey; }
|
|
|
|
void setPassphrase(const QString& passphrase);
|
|
QString* getPassphrase() { return _passphrase; }
|
|
bool getPassphraseIsCached() { return !(_passphrase->isEmpty()); }
|
|
bool walletIsAuthenticatedWithPassphrase();
|
|
bool changePassphrase(const QString& newPassphrase);
|
|
|
|
void reset();
|
|
|
|
signals:
|
|
void securityImageResult(bool exists);
|
|
void keyFilePathIfExistsResult(const QString& path);
|
|
|
|
private slots:
|
|
void handleChallengeOwnershipPacket(QSharedPointer<ReceivedMessage> packet, SharedNodePointer sendingNode);
|
|
|
|
private:
|
|
QStringList _publicKeys{};
|
|
QPixmap* _securityImage { nullptr };
|
|
QByteArray _salt;
|
|
QByteArray _iv;
|
|
QByteArray _ckey;
|
|
QString* _passphrase { new QString("") };
|
|
|
|
bool writeWallet(const QString& newPassphrase = QString(""));
|
|
void updateImageProvider();
|
|
bool writeSecurityImage(const QPixmap* pixmap, const QString& outputFilePath);
|
|
bool readSecurityImage(const QString& inputFilePath, unsigned char** outputBufferPtr, int* outputBufferLen);
|
|
|
|
bool verifyOwnerChallenge(const QByteArray& encryptedText, const QString& publicKey, QString& decryptedText);
|
|
};
|
|
|
|
#endif // hifi_Wallet_h
|