From bad859ea7c2490cbd5e7eafabb8a4ff159a0310e Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Sat, 8 Jun 2024 15:29:16 -0600 Subject: [PATCH] move all passkey testing to /test --- src/views/StartView.vue | 52 ++------------------- src/views/TestView.vue | 101 ++++++++++++++++++++++++++++++++++++++-- 2 files changed, 100 insertions(+), 53 deletions(-) diff --git a/src/views/StartView.vue b/src/views/StartView.vue index 6346da6..c8bbd6b 100644 --- a/src/views/StartView.vue +++ b/src/views/StartView.vue @@ -70,7 +70,6 @@ import { accountsDB } from "@/db/index"; import { generateRandomBytes } from "@/libs/crypto"; import { createPeerDid, - JWK, PeerSetup, registerCredential, verifyJwt, @@ -80,14 +79,7 @@ import { components: {}, }) export default class StartView extends Vue { - authenticatorData?: ArrayBuffer; - credId?: Base64URLString; numAccounts = 0; - publicKeyJwk?: JWK; - publicKeyBytes?: Uint8Array; - rawId?: Uint8Array; - savedCredentialId = ""; - userId?: ArrayBuffer; async mounted() { await accountsDB.open(); @@ -95,53 +87,15 @@ export default class StartView extends Vue { } public async onClickYes() { - this.userId = generateRandomBytes(16).buffer; - const encodedUserId = new TextDecoder("utf-8").decode(this.userId); - console.log("encodedUserId", encodedUserId); - - const challenge = generateRandomBytes(32); - const cred = await registerCredential( - this.userId as Uint8Array, - challenge as Uint8Array, - ); - console.log("public key", cred); - this.publicKeyJwk = cred.publicKeyJwk; - this.publicKeyBytes = cred.publicKeyBytes; - this.credId = cred.credId as string; - this.rawId = cred.rawId as Uint8Array; - this.savedCredentialId = this.credId; - //this.$router.push({ name: "new-identifier" }); + this.$router.push({ name: "new-identifier" }); } public async onClickNo() { - const did = createPeerDid(this.publicKeyBytes as Uint8Array); - console.log("did", did); - const payload = { a: 1 }; - const peerSetup = new PeerSetup(); - const jwt = await peerSetup.createJwt(payload, did, this.credId as string); - console.log("jwt", jwt); - const jwt4url = jwt - .replace(/\+/g, "-") - .replace(/\//g, "_") - .replace(/=+$/, ""); - console.log("jwt4url", jwt4url); - - const signature = jwt4url.split(".")[2]; - const decoded = await verifyJwt( - jwt4url, - this.credId as Base64URLString, - this.rawId as Uint8Array, - peerSetup.authenticatorData as ArrayBuffer, - peerSetup.clientDataJsonDecoded, - this.publicKeyBytes as Uint8Array, - signature, - ); - console.log("decoded", decoded); - //this.$router.push({ name: "import-account" }); + this.$router.push({ name: "import-account" }); } public onClickDerive() { - //this.$router.push({ name: "import-derive" }); + this.$router.push({ name: "import-derive" }); } } diff --git a/src/views/TestView.vue b/src/views/TestView.vue index 3e31dc0..75112fd 100644 --- a/src/views/TestView.vue +++ b/src/views/TestView.vue @@ -21,8 +21,8 @@ -
-

Notiwind Alert Test Suite

+
+

Notiwind Alerts

+ + +