|
|
@ -176,8 +176,8 @@ |
|
|
|
<br /> |
|
|
|
See existing passkeys in Chrome at: chrome://settings/passkeys |
|
|
|
<br /> |
|
|
|
Active DID: {{ activeDid }} |
|
|
|
{{ credIdHex ? "has passkey ID" : "has no passkey ID" }} |
|
|
|
Active DID: {{ activeDid || "nothing, which" }} |
|
|
|
{{ credIdHex ? "has a passkey ID" : "has no passkey ID" }} |
|
|
|
|
|
|
|
<div> |
|
|
|
Register Passkey |
|
|
@ -244,6 +244,7 @@ import { ref } from "vue"; |
|
|
|
import { Component, Vue } from "vue-facing-decorator"; |
|
|
|
|
|
|
|
import QuickNav from "@/components/QuickNav.vue"; |
|
|
|
import { NotificationIface } from "@/constants/app"; |
|
|
|
import { accountsDB, db } from "@/db/index"; |
|
|
|
import { |
|
|
|
createPeerDid, |
|
|
@ -269,6 +270,8 @@ const TEST_PAYLOAD = { |
|
|
|
|
|
|
|
@Component({ components: { QuickNav } }) |
|
|
|
export default class Help extends Vue { |
|
|
|
$notify!: (notification: NotificationIface, timeout?: number) => void; |
|
|
|
|
|
|
|
// for file import |
|
|
|
fileName?: string; |
|
|
|
|
|
|
@ -300,7 +303,7 @@ export default class Help extends Vue { |
|
|
|
} |
|
|
|
|
|
|
|
async uploadFile(event: Event) { |
|
|
|
inputFileNameRef.value = event.target.files[0]; |
|
|
|
inputFileNameRef.value = event.target?.["files"][0]; |
|
|
|
// https://developer.mozilla.org/en-US/docs/Web/API/File |
|
|
|
// ... plus it has a `type` property from my testing |
|
|
|
const file = inputFileNameRef.value; |
|
|
@ -330,7 +333,27 @@ export default class Help extends Vue { |
|
|
|
} |
|
|
|
|
|
|
|
public async register() { |
|
|
|
const cred = await registerCredential(this.userName); |
|
|
|
const DEFAULT_USERNAME = "Time Safari Tester"; |
|
|
|
if (!this.userName) { |
|
|
|
this.$notify( |
|
|
|
{ |
|
|
|
group: "modal", |
|
|
|
type: "confirm", |
|
|
|
title: "No Name", |
|
|
|
text: "You must have a name to attach to this passkey. Would you like to enter your own name first?", |
|
|
|
onNo: async () => { |
|
|
|
this.userName = DEFAULT_USERNAME; |
|
|
|
}, |
|
|
|
onYes: async () => { |
|
|
|
this.$router.push({ name: "new-edit-account" }); |
|
|
|
}, |
|
|
|
noText: "try again and use " + DEFAULT_USERNAME, |
|
|
|
}, |
|
|
|
-1, |
|
|
|
); |
|
|
|
return; |
|
|
|
} |
|
|
|
const cred = await registerCredential("Time Safari - " + this.userName); |
|
|
|
const publicKeyBytes = cred.publicKeyBytes; |
|
|
|
this.activeDid = createPeerDid(publicKeyBytes as Uint8Array); |
|
|
|
this.credIdHex = cred.credIdHex as string; |
|
|
|