|
@ -14,7 +14,6 @@ |
|
|
</h1> |
|
|
</h1> |
|
|
</div> |
|
|
</div> |
|
|
<!-- Import Account Form --> |
|
|
<!-- Import Account Form --> |
|
|
<form> |
|
|
|
|
|
<p class="text-center text-xl mb-4 font-light"> |
|
|
<p class="text-center text-xl mb-4 font-light"> |
|
|
Enter your seed phrase below to import your identity on this device. |
|
|
Enter your seed phrase below to import your identity on this device. |
|
|
</p> |
|
|
</p> |
|
@ -22,14 +21,15 @@ |
|
|
type="text" |
|
|
type="text" |
|
|
placeholder="Seed Phrase" |
|
|
placeholder="Seed Phrase" |
|
|
class="block w-full rounded border border-slate-400 mb-4 px-3 py-2" |
|
|
class="block w-full rounded border border-slate-400 mb-4 px-3 py-2" |
|
|
value="{{ mnemonic }}" |
|
|
v-bind="mnemonic" |
|
|
/> |
|
|
/> |
|
|
<div class="mt-8"> |
|
|
<div class="mt-8"> |
|
|
<button` |
|
|
<button |
|
|
@click="import(mnemonic)" |
|
|
@click="from_mnemonic()" |
|
|
class="block w-full text-center text-lg font-bold uppercase bg-blue-600 text-white px-2 py-3 rounded-md mb-2" |
|
|
class="block w-full text-center text-lg font-bold uppercase bg-blue-600 text-white px-2 py-3 rounded-md mb-2" |
|
|
value="Import Identity" |
|
|
> |
|
|
/> |
|
|
Import |
|
|
|
|
|
</button> |
|
|
<button |
|
|
<button |
|
|
@click="onCancelClick()" |
|
|
@click="onCancelClick()" |
|
|
type="button" |
|
|
type="button" |
|
@ -38,25 +38,35 @@ |
|
|
Cancel |
|
|
Cancel |
|
|
</button> |
|
|
</button> |
|
|
</div> |
|
|
</div> |
|
|
</form> |
|
|
|
|
|
</section> |
|
|
</section> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script lang="ts"> |
|
|
<script lang="ts"> |
|
|
import { Options, Vue } from "vue-class-component"; |
|
|
import { Options, Vue } from "vue-class-component"; |
|
|
|
|
|
import { deriveAddress } from "../libs/crypto"; |
|
|
|
|
|
|
|
|
@Options({ |
|
|
@Options({ |
|
|
components: {}, |
|
|
components: {}, |
|
|
}) |
|
|
}) |
|
|
export default class ImportAccountView extends Vue { |
|
|
export default class ImportAccountView extends Vue { |
|
|
mnemonic = ""; |
|
|
mnemonic = ""; |
|
|
|
|
|
address = ""; |
|
|
|
|
|
privateHex = ""; |
|
|
|
|
|
publicHex = ""; |
|
|
|
|
|
UPORT_ROOT_DERIVATION_PATH = ""; |
|
|
|
|
|
|
|
|
public onCancelClick() { |
|
|
public onCancelClick() { |
|
|
this.$router.back(); |
|
|
this.$router.back(); |
|
|
} |
|
|
} |
|
|
public import() { |
|
|
public from_mnemonic() { |
|
|
// just to get rid of variability that might cause an error |
|
|
|
|
|
if (this.mnemonic.trim().length > 0) { |
|
|
if (this.mnemonic.trim().length > 0) { |
|
|
this.mnemonic = this.mnemonic.trim().toLowerCase(); |
|
|
this.mnemonic = this.mnemonic.trim().toLowerCase(); |
|
|
|
|
|
[ |
|
|
|
|
|
this.address, |
|
|
|
|
|
this.privateHex, |
|
|
|
|
|
this.publicHex, |
|
|
|
|
|
this.UPORT_ROOT_DERIVATION_PATH, |
|
|
|
|
|
] = deriveAddress(this.mnemonic); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|