Changed methods for fetch data transactions and for get passPhrase

This commit is contained in:
DwCay
2022-08-03 00:48:32 +03:00
parent f395661480
commit a86dd13e0e

View File

@@ -55,7 +55,7 @@ class Store {
fetchWrapper.postAuth('data/private', {
networkIdentifier: this.nodeInfo.networkIdentifier,
lastBlockID: this.nodeInfo.lastBlockID
}, [...this.encryptAccountData(data)])
}, [...this.encryptUserData(data)])
.then(() => this.fetchNewAccountData())
}
@@ -72,7 +72,7 @@ class Store {
}
fetchTransactionsInfo() {
fetchWrapper.get("account/transactions/71ccaeefe22050abc9b36ce0c1744316c11c49e1", {
fetchWrapper.get(`account/transactions/${this.address}`, {
networkIdentifier: this.nodeInfo.networkIdentifier,
lastBlockID: this.nodeInfo.lastBlockID
}).then((res) => this.saveInfoTransactions(res))
@@ -83,6 +83,15 @@ class Store {
sessionStorage.setItem('passPhrase', this._passPhrase);
};
savePastPassPhrase(phrase) {
this._passPhrase=phrase
sessionStorage.setItem('passPhrase', this._passPhrase);
};
fetchPassPhrase() {
this._passPhrase = sessionStorage.getItem('passPhrase')
}
fetchSharedData() {
this._keysArray.forEach((elem) => fetchWrapper.get(`data/shared/${elem}`).then((res) => this.changeSharedData(res)))
};
@@ -101,11 +110,6 @@ class Store {
})
}
savePastPassPhrase(phrase) {
this._passPhrase = phrase;
sessionStorage.setItem('passPhrase', this._passPhrase);
};
saveDataRegistration(data) {
this._accountData = data;
};
@@ -176,7 +180,7 @@ class Store {
}))
}
encryptAccountData(data) {
encryptUserData(data) {
return data.map((item) => {
let value = cryptography.encryptMessageWithPassphrase(cryptography.getRandomBytes(32).toString('hex') + ":" + item.value, this.passPhrase, this.pubKey);
return {
@@ -193,9 +197,7 @@ class Store {
}
get passPhrase() {
if(sessionStorage.getItem('passPhrase')) {
this._passPhrase = sessionStorage.getItem('passPhrase')
}
this.fetchPassPhrase()
return this._passPhrase
}