|
|
@ -298,6 +298,7 @@ import { accessToken } from "@/libs/crypto"; |
|
|
|
import { AxiosError } from "axios/index"; |
|
|
|
import AlertMessage from "@/components/AlertMessage"; |
|
|
|
import QuickNav from "@/components/QuickNav"; |
|
|
|
import { IIdentifier } from "@veramo/core"; |
|
|
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-var-requires |
|
|
|
const Buffer = require("buffer/").Buffer; |
|
|
@ -336,12 +337,6 @@ export default class AccountViewView extends Vue { |
|
|
|
.equals(activeDid) |
|
|
|
.first(); |
|
|
|
const identity = JSON.parse(account?.identity || "null"); |
|
|
|
|
|
|
|
if (!identity) { |
|
|
|
throw new Error( |
|
|
|
"Attempted to load Give records with no identity available.", |
|
|
|
); |
|
|
|
} |
|
|
|
return identity; |
|
|
|
} |
|
|
|
|
|
|
@ -395,14 +390,18 @@ export default class AccountViewView extends Vue { |
|
|
|
|
|
|
|
const identity = await this.getIdentity(this.activeDid); |
|
|
|
|
|
|
|
if (identity) { |
|
|
|
this.publicHex = identity.keys[0].publicKeyHex; |
|
|
|
this.publicBase64 = Buffer.from(this.publicHex, "hex").toString("base64"); |
|
|
|
this.publicBase64 = Buffer.from(this.publicHex, "hex").toString( |
|
|
|
"base64", |
|
|
|
); |
|
|
|
this.derivationPath = identity.keys[0].meta.derivationPath; |
|
|
|
|
|
|
|
db.settings.update(MASTER_SETTINGS_KEY, { |
|
|
|
activeDid: identity.did, |
|
|
|
}); |
|
|
|
this.checkLimits(); |
|
|
|
this.checkLimitsFor(identity); |
|
|
|
} |
|
|
|
} catch (err) { |
|
|
|
if ( |
|
|
|
err.message === |
|
|
@ -461,12 +460,18 @@ export default class AccountViewView extends Vue { |
|
|
|
} |
|
|
|
|
|
|
|
async checkLimits() { |
|
|
|
const identity = await this.getIdentity(this.activeDid); |
|
|
|
if (identity) { |
|
|
|
this.checkLimitsFor(identity); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
async checkLimitsFor(identity: IIdentifier) { |
|
|
|
this.loadingLimits = true; |
|
|
|
this.limitsMessage = ""; |
|
|
|
|
|
|
|
try { |
|
|
|
const url = this.apiServer + "/api/report/rateLimits"; |
|
|
|
const identity = await this.getIdentity(this.activeDid); |
|
|
|
const headers = await this.getHeaders(identity); |
|
|
|
|
|
|
|
const resp = await this.axios.get(url, { headers }); |
|
|
|