forked from jsnbuchanan/crowd-funder-for-time-pwa
- Restore runMigrations functionality for database schema migrations - Remove indexedDBMigrationService.ts (was for IndexedDB to SQLite migration) - Recreate migrationService.ts and db-sql/migration.ts for schema management - Add proper TypeScript error handling with type guards in AccountViewView - Fix CreateAndSubmitClaimResult property access in QuickActionBvcBeginView - Remove LeafletMouseEvent from Vue components array (it's a type, not component) - Add null check for UserNameDialog callback to prevent undefined assignment - Implement extractErrorMessage helper function for consistent error handling - Update router to remove database-migration route The migration system now properly handles database schema evolution across app versions, while the IndexedDB to SQLite migration service has been removed as it was specific to that one-time migration.
151 lines
5.1 KiB
Vue
151 lines
5.1 KiB
Vue
<template>
|
|
<section
|
|
id="Content"
|
|
class="p-6 pb-24 min-h-screen flex flex-col justify-center"
|
|
>
|
|
<!-- Breadcrumb -->
|
|
<div>
|
|
<!-- Back -->
|
|
<div class="text-lg text-center font-light relative px-7">
|
|
<h1
|
|
class="text-lg text-center px-2 py-1 absolute -left-2 -top-1"
|
|
@click="$router.back()"
|
|
>
|
|
<font-awesome icon="chevron-left" class="fa-fw"></font-awesome>
|
|
</h1>
|
|
</div>
|
|
|
|
<!-- Heading -->
|
|
<h1 id="ViewHeading" class="text-4xl text-center font-light pt-4 mb-8">
|
|
Generate an Identity
|
|
</h1>
|
|
</div>
|
|
|
|
<!-- id used by puppeteer test script -->
|
|
<div id="start-question" class="mt-8">
|
|
<div class="max-w-3xl mx-auto">
|
|
<p class="text-center text-xl font-light">
|
|
How do you want to create this identifier?
|
|
</p>
|
|
<p v-if="PASSKEYS_ENABLED" class="text-center font-light mt-6">
|
|
A <strong>passkey</strong> is easy to manage, though it is less
|
|
interoperable with other systems for advanced uses.
|
|
<a
|
|
href="https://www.perplexity.ai/search/what-are-passkeys-v2SHV3yLQlyA2CYH6.Nvhg"
|
|
target="_blank"
|
|
>
|
|
<font-awesome icon="info-circle" class="fa-fw text-blue-500" />
|
|
</a>
|
|
</p>
|
|
<p class="text-center font-light mt-4">
|
|
A <strong>new seed</strong> allows you full control over the keys,
|
|
though you are responsible for backups.
|
|
<a
|
|
href="https://www.perplexity.ai/search/what-is-a-seed-phrase-OqiP9foVRXidr_2le5OFKA"
|
|
target="_blank"
|
|
>
|
|
<font-awesome icon="info-circle" class="fa-fw text-blue-500" />
|
|
</a>
|
|
</p>
|
|
<div class="grid grid-cols-1 sm:grid-cols-2 gap-2 mt-4">
|
|
<a
|
|
v-if="PASSKEYS_ENABLED"
|
|
class="block w-full text-center text-lg uppercase bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-2 py-3 rounded-md mb-2 cursor-pointer"
|
|
@click="onClickNewPasskey()"
|
|
>
|
|
Generate one with a passkey
|
|
</a>
|
|
<a
|
|
class="block w-full text-center text-lg uppercase bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-2 py-3 rounded-md mb-2 cursor-pointer"
|
|
data-testId="newSeed"
|
|
@click="onClickNewSeed()"
|
|
>
|
|
Generate one with a new seed
|
|
</a>
|
|
</div>
|
|
<p class="text-center font-light mt-4">
|
|
You can also import an existing seed or derive a new address from an
|
|
existing seed.
|
|
</p>
|
|
<div class="grid grid-cols-1 sm:grid-cols-2 gap-2 mt-2">
|
|
<a
|
|
class="block w-full text-center text-md uppercase bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-1.5 py-2 rounded-md cursor-pointer"
|
|
@click="onClickNo()"
|
|
>
|
|
You have a seed
|
|
</a>
|
|
<a
|
|
v-if="numAccounts > 0"
|
|
class="block w-full text-center text-md uppercase bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-1.5 py-2 rounded-md cursor-pointer"
|
|
@click="onClickDerive()"
|
|
>
|
|
Derive new address from existing seed
|
|
</a>
|
|
</div>
|
|
|
|
<!-- Database Migration Section -->
|
|
<div class="mt-8 pt-6 border-t border-gray-200">
|
|
<div class="flex justify-center">
|
|
<router-link
|
|
:to="{ name: 'database-migration' }"
|
|
class="block w-fit text-center text-md bg-gradient-to-b from-slate-400 to-slate-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-4 py-2 rounded-md"
|
|
>
|
|
Migrate My Old Data
|
|
</router-link>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
import { Component, Vue } from "vue-facing-decorator";
|
|
import { Router } from "vue-router";
|
|
|
|
import { AppString, PASSKEYS_ENABLED } from "../constants/app";
|
|
import * as databaseUtil from "../db/databaseUtil";
|
|
import { retrieveSettingsForActiveAccount } from "../db/index";
|
|
import {
|
|
registerSaveAndActivatePasskey,
|
|
retrieveAccountCount,
|
|
} from "../libs/util";
|
|
|
|
@Component({
|
|
components: {},
|
|
})
|
|
export default class StartView extends Vue {
|
|
$router!: Router;
|
|
PASSKEYS_ENABLED = PASSKEYS_ENABLED;
|
|
|
|
givenName = "";
|
|
numAccounts = 0;
|
|
|
|
async mounted() {
|
|
const settings = await databaseUtil.retrieveSettingsForActiveAccount();
|
|
this.givenName = settings.firstName || "";
|
|
|
|
this.numAccounts = await retrieveAccountCount();
|
|
}
|
|
|
|
public onClickNewSeed() {
|
|
this.$router.push({ name: "new-identifier" });
|
|
}
|
|
|
|
public async onClickNewPasskey() {
|
|
const keyName =
|
|
AppString.APP_NAME + (this.givenName ? " - " + this.givenName : "");
|
|
await registerSaveAndActivatePasskey(keyName);
|
|
this.$router.push({ name: "account" });
|
|
}
|
|
|
|
public onClickNo() {
|
|
this.$router.push({ name: "import-account" });
|
|
}
|
|
|
|
public onClickDerive() {
|
|
this.$router.push({ name: "import-derive" });
|
|
}
|
|
}
|
|
</script>
|