Browse Source

fix: remove code for lowercase checks (that were for old uPort)

kb/add-usage-guide
Trent Larson 2 years ago
parent
commit
d2cea34242
  1. 8
      README.md
  2. 27
      src/views/AccountViewView.vue

8
README.md

@ -23,7 +23,13 @@ npm run lint
### Customize configuration ### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/). See [Configuration Reference](https://cli.vuejs.org/config/).
## Other
``` ```
// reference material from https://github.com/trentlarson/endorser-mobile/blob/8dc8e0353e0cc80ffa7ed89ded15c8b0da92726b/src/utility/idUtility.ts#L83
// Import an existing ID // Import an existing ID
export const importAndStoreIdentifier = async (mnemonic: string, mnemonicPassword: string, toLowercase: boolean, previousIdentifiers: Array<IIdentifier>) => { export const importAndStoreIdentifier = async (mnemonic: string, mnemonicPassword: string, toLowercase: boolean, previousIdentifiers: Array<IIdentifier>) => {
@ -122,4 +128,4 @@ export const createAndStoreIdentifier = async (mnemonicPassword) => {
return importAndStoreIdentifier(mnemonic, mnemonicPassword, false, []) return importAndStoreIdentifier(mnemonic, mnemonicPassword, false, [])
} }
``` ```

27
src/views/AccountViewView.vue

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

Loading…
Cancel
Save