This commit is contained in:
Howard Stearns 2018-08-22 12:59:43 -07:00
parent 13629f6870
commit 88a3505b6a
6 changed files with 25 additions and 26 deletions

View file

@ -64,7 +64,7 @@ Item {
answer: "High Fidelity commerce is in open beta right now. Want more HFC? \
Get it by going to <br><br><b><font color='#0093C5'><a href='#bank'>BankOfHighFidelity.</a></font></b> and meeting with the banker!";
}
ListElement {
/* ListElement {
isExpanded: false;
question: "What are private keys and where are they stored?";
answer:
@ -74,16 +74,16 @@ After wallet setup, a hifikey file is stored on your computer in High Fidelity I
Your hifikey file contains your private key and is protected by your wallet passphrase. \
<br><br>It is very important to back up your hifikey file! \
<b><font color='#0093C5'><a href='#privateKeyPath'>Tap here to open the folder where your HifiKeys are stored on your main display.</a></font></b>"
}
ListElement {
}*/
/*ListElement {
isExpanded: false;
question: "How do I back up my private keys?";
answer: "You can back up your hifikey file (which contains your private key and is encrypted using your wallet passphrase) by copying it to a USB flash drive, or to a service like Dropbox or Google Drive. \
Restore your hifikey file by replacing the file in Interface's AppData directory with your backup copy. \
Others with access to your back up should not be able to spend your HFC without your passphrase. \
<b><font color='#0093C5'><a href='#privateKeyPath'>Tap here to open the folder where your HifiKeys are stored on your main display.</a></font></b>";
}
ListElement {
}*/
/*ListElement {
isExpanded: false;
question: "What happens if I lose my private keys?";
answer: "We cannot stress enough that you should keep a backup! For security reasons, High Fidelity does not keep a copy, and cannot restore it for you. \
@ -94,8 +94,8 @@ Here are some things to try:<ul>\
<li>If you are a developer and have installed multiple builds of High Fidelity, your hifikey file might be in another folder</li>\
</ul><br><br>As a last resort, you can set up your Wallet again and generate a new hifikey file. \
Unfortunately, this means you will start with 0 HFC and your purchased items will not be transferred over.";
}
ListElement {
}*/
/*ListElement {
isExpanded: false;
question: "What if I forget my wallet passphrase?";
answer: "Your wallet passphrase is used to encrypt your private keys. Please write it down and store it securely! \
@ -104,7 +104,7 @@ You will also no longer have access to the contents of your Wallet or My Purchas
For security reasons, High Fidelity does not keep a copy of your passphrase, and can't restore it for you. \
<br><br>If you still cannot remember your wallet passphrase, you can set up your Wallet again and generate a new hifikey file. \
Unfortunately, this means you will start with 0 HFC and your purchased items will not be transferred over.";
}
}*/
ListElement {
isExpanded: false;
question: "How do I send HFC to other people?";
@ -116,7 +116,7 @@ In your Wallet's Send Money tab, choose from your list of connections, or choose
question: "What is a Security Pic?"
answer: "Your Security Pic acts as an extra layer of Wallet security. \
When you see your Security Pic, you know that your actions and data are securely making use of your account. \
<b><font color='#0093C5'><a href='#securitypic'>Tap here to change your Security Pic.</a></font></b>";
<br><br><b><font color='#0093C5'><a href='#securitypic'>Tap here to change your Security Pic.</a></font></b>";
}
ListElement {
isExpanded: false;
@ -259,7 +259,6 @@ At the moment, there is currently no way to convert HFC to other currencies. Sta
} else if (link === "#support") {
Qt.openUrlExternally("mailto:support@highfidelity.com");
} else if (link === "#securitypic") {
console.log("HRS FIXME here");
sendSignalToWallet({method: 'walletSecurity_changeSecurityImage'});
}
}

View file

@ -88,6 +88,7 @@ Item {
color: hifi.colors.faintGray;
}
/*
Item {
id: changePassphraseContainer;
anchors.top: securityTextSeparator.bottom;
@ -154,10 +155,11 @@ Item {
// Style
color: hifi.colors.faintGray;
}
*/
Item {
id: changeSecurityImageContainer;
anchors.top: changePassphraseSeparator.bottom;
anchors.top: securityTextSeparator.bottom; // changePassphraseSeparator.bottom;
anchors.topMargin: 8;
anchors.left: parent.left;
anchors.leftMargin: 40;
@ -207,7 +209,7 @@ Item {
}
}
}
/*
Rectangle {
id: privateKeysSeparator;
// Size
@ -344,6 +346,7 @@ Item {
}
}
}
*/
}
//

View file

@ -257,9 +257,9 @@ Rectangle {
Connections {
onSendSignalToWallet: {
if (msg.method === 'walletSecurity_changeSecurityImageCancelled') {
root.activeView = "walletHome"; // was "security";
root.activeView = "security";
} else if (msg.method === 'walletSecurity_changeSecurityImageSuccess') {
root.activeView = "walletHome"; // was "security";
root.activeView = "security";
} else {
sendToScript(msg);
}
@ -610,7 +610,7 @@ Rectangle {
}
RalewaySemiBold {
text: "PURCHASES"; // was "SECURITY";
text: "SECURITY";
// Text size
size: 16;
// Anchors
@ -632,11 +632,8 @@ Rectangle {
anchors.fill: parent;
hoverEnabled: enabled;
onClicked: {
sendToScript({method: 'goToPurchases_fromWalletHome'});
/* was
root.activeView = "security";
tabButtonsContainer.resetTabButtonColors();
*/
}
onEntered: parent.color = hifi.colors.blueHighlight;
onExited: parent.color = root.activeView === "security" ? hifi.colors.blueAccent : hifi.colors.black;

View file

@ -31,7 +31,9 @@
QJsonObject Ledger::apiResponse(const QString& label, QNetworkReply* reply) {
QByteArray response = reply->readAll();
QJsonObject data = QJsonDocument::fromJson(response).object();
#if defined(DEV_BUILD) // Don't expose user's personal data in the wild. But during development this can be handy.
qInfo(commerce) << label << "response" << QJsonDocument(data).toJson(QJsonDocument::Compact);
#endif
return data;
}
// Non-200 responses are not json:
@ -69,7 +71,9 @@ void Ledger::send(const QString& endpoint, const QString& success, const QString
auto accountManager = DependencyManager::get<AccountManager>();
const QString URL = "/api/v1/commerce/";
JSONCallbackParameters callbackParams(this, success, fail);
#if defined(DEV_BUILD) // Don't expose user's personal data in the wild. But during development this can be handy.
qCInfo(commerce) << "Sending" << endpoint << QJsonDocument(request).toJson(QJsonDocument::Compact);
#endif
accountManager->sendRequest(URL + endpoint,
authType,
method,
@ -130,7 +134,6 @@ bool Ledger::receiveAt(const QString& hfc_key, const QString& signing_key, const
transaction["locker"] = QString::fromUtf8(locker);
QJsonDocument transactionDoc{ transaction };
auto transactionString = transactionDoc.toJson(QJsonDocument::Compact);
qCDebug(commerce) << "FIXME transactionString" << transactionString;
signedSend("text", transactionString, signing_key, "receive_at", "receiveAtSuccess", "receiveAtFailure");
return true; // Note that there may still be an asynchronous signal of failure that callers might be interested in.
}
@ -292,7 +295,6 @@ void Ledger::accountSuccess(QNetworkReply* reply) {
// lets set the appropriate stuff in the wallet now
auto wallet = DependencyManager::get<Wallet>();
QByteArray response = reply->readAll();
qCDebug(commerce) << "FIXME accountSuccess got" << response;
QJsonObject data = QJsonDocument::fromJson(response).object()["data"].toObject();
auto salt = QByteArray::fromBase64(data["salt"].toString().toUtf8());

View file

@ -201,7 +201,6 @@ bool Wallet::setWallet(const QByteArray& wallet) {
return false;
}
file.close();
qCDebug(commerce) << "FIXME wrote" << wallet.count() << "to" << keyFilePath();
return true;
}
QByteArray Wallet::getWallet() {
@ -212,7 +211,6 @@ QByteArray Wallet::getWallet() {
}
QByteArray wallet = file.readAll();
file.close();
qCDebug(commerce) << "FIXME read" << wallet.count() << "from" << keyFilePath();
return wallet;
}

View file

@ -44,10 +44,6 @@ public:
void setCKey(const QByteArray& ckey) { _ckey = ckey; }
QByteArray getCKey() { return _ckey; }
// FIXME protect more
bool setWallet(const QByteArray& wallet);
QByteArray getWallet();
bool setPassphrase(const QString& passphrase);
QString* getPassphrase() { return _passphrase; }
bool getPassphraseIsCached() { return !(_passphrase->isEmpty()); }
@ -77,6 +73,7 @@ private slots:
void handleChallengeOwnershipPacket(QSharedPointer<ReceivedMessage> packet, SharedNodePointer sendingNode);
private:
friend class Ledger;
QStringList _publicKeys{};
QPixmap* _securityImage { nullptr };
QByteArray _salt;
@ -91,6 +88,9 @@ private:
bool readSecurityImage(const QString& inputFilePath, unsigned char** outputBufferPtr, int* outputBufferLen);
bool writeBackupInstructions();
bool setWallet(const QByteArray& wallet);
QByteArray getWallet();
void account();
};