|
|
@ -175,8 +175,6 @@ |
|
|
|
import { Options, Vue } from "vue-class-component"; |
|
|
|
import { useClipboard } from "@vueuse/core"; |
|
|
|
import { createIdentifier, deriveAddress, newIdentifier } from "../libs/crypto"; |
|
|
|
import { IIdentifier } from "@veramo/core"; |
|
|
|
import * as R from "ramda"; |
|
|
|
import { db } from "../db"; |
|
|
|
import { useAppStore } from "@/store/app"; |
|
|
|
import { ref } from "vue"; |
|
|
@ -193,10 +191,8 @@ export default class AccountViewView extends Vue { |
|
|
|
source = ref("Hello"); |
|
|
|
copy = useClipboard().copy; |
|
|
|
|
|
|
|
// 'created' hook runs when the Vue instance is first created |
|
|
|
async created() { |
|
|
|
const previousIdentifiers: Array<IIdentifier> = []; |
|
|
|
const toLowercase = true; |
|
|
|
|
|
|
|
const appCondition = useAppStore().condition; |
|
|
|
if (appCondition == "uninitialized") { |
|
|
|
this.mnemonic = createIdentifier(); |
|
|
@ -207,27 +203,6 @@ export default class AccountViewView extends Vue { |
|
|
|
this.UPORT_ROOT_DERIVATION_PATH, |
|
|
|
] = deriveAddress(this.mnemonic); |
|
|
|
|
|
|
|
const prevIds = previousIdentifiers || []; |
|
|
|
if (toLowercase) { |
|
|
|
const foundEqual = |
|
|
|
R.find( |
|
|
|
(id: IIdentifier) => id.did.split(":")[2] === this.address, |
|
|
|
prevIds |
|
|
|
) || false; |
|
|
|
if (foundEqual === false) { |
|
|
|
this.address = this.address.toLowerCase(); |
|
|
|
} |
|
|
|
} else { |
|
|
|
const foundLower = R.find( |
|
|
|
(id: IIdentifier) => |
|
|
|
id.did.split(":")[2] === this.address.toLowerCase(), |
|
|
|
prevIds |
|
|
|
); |
|
|
|
if (foundLower) { |
|
|
|
this.address = this.address.toLowerCase(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const newId = newIdentifier( |
|
|
|
this.address, |
|
|
|
this.publicHex, |
|
|
|