Browse Source

chore: fluff

pull/142/head
Matthew Raymer 3 weeks ago
parent
commit
1eb14ca379
  1. 178
      src/views/TestView.vue

178
src/views/TestView.vue

@ -38,28 +38,16 @@
<div class="mt-8">
<h2 class="text-xl font-bold mb-4">SQL Operations</h2>
<div class="flex gap-2 mt-2">
<button
:class="sqlLinkClasses"
@click="setAllTablesQuery"
>
<button :class="sqlLinkClasses" @click="setAllTablesQuery">
All Tables
</button>
<button
:class="sqlLinkClasses"
@click="setAccountsQuery"
>
<button :class="sqlLinkClasses" @click="setAccountsQuery">
Accounts
</button>
<button
:class="sqlLinkClasses"
@click="setContactsQuery"
>
<button :class="sqlLinkClasses" @click="setContactsQuery">
Contacts
</button>
<button
:class="sqlLinkClasses"
@click="setSettingsQuery"
>
<button :class="sqlLinkClasses" @click="setSettingsQuery">
Settings
</button>
</div>
@ -71,10 +59,7 @@
></textarea>
</div>
<div class="mt-4">
<button
:class="primaryButtonClasses"
@click="executeSql"
>
<button :class="primaryButtonClasses" @click="executeSql">
Execute
</button>
</div>
@ -114,10 +99,7 @@
<div>
Register Passkey
<button
:class="primaryButtonClasses"
@click="register()"
>
<button :class="primaryButtonClasses" @click="register()">
Simplewebauthn
</button>
</div>
@ -130,40 +112,25 @@
>
Simplewebauthn
</button>
<button
:class="primaryButtonClasses"
@click="createJwtNavigator()"
>
<button :class="primaryButtonClasses" @click="createJwtNavigator()">
Navigator
</button>
</div>
<div v-if="jwt">
Verify New JWT
<button
:class="primaryButtonClasses"
@click="verifySimplewebauthn()"
>
<button :class="primaryButtonClasses" @click="verifySimplewebauthn()">
Simplewebauthn
</button>
<button
:class="primaryButtonClasses"
@click="verifyWebCrypto()"
>
<button :class="primaryButtonClasses" @click="verifyWebCrypto()">
WebCrypto
</button>
<button
:class="primaryButtonClasses"
@click="verifyP256()"
>
<button :class="primaryButtonClasses" @click="verifyP256()">
p256 - broken
</button>
</div>
<div v-else>Verify New JWT -- requires creation first</div>
<button
:class="primaryButtonClasses"
@click="verifyMyJwt()"
>
<button :class="primaryButtonClasses" @click="verifyMyJwt()">
Verify Hard-Coded JWT
</button>
</div>
@ -202,10 +169,10 @@ import { Router } from "vue-router";
import QuickNav from "../components/QuickNav.vue";
import { AppString, NotificationIface } from "../constants/app";
import {
NOTIFY_SQL_ERROR,
createSqlErrorMessage,
createPasskeyNameModal
import {
NOTIFY_SQL_ERROR,
createSqlErrorMessage,
createPasskeyNameModal,
} from "../constants/notifications";
import * as vcLib from "../libs/crypto/vc";
import * as cryptoLib from "../libs/crypto";
@ -240,30 +207,30 @@ const TEST_PAYLOAD = {
/**
* TestView Component
*
*
* Development/testing interface providing comprehensive testing tools for:
* - Notification system testing (8 different types)
* - Interactive SQL operations and database queries
* - File upload and image sharing functionality
* - File upload and image sharing functionality
* - Passkey registration and JWT verification
* - Encryption/decryption testing
* - Various crypto operations
*
*
* Features:
* - Raw SQL query execution interface for database testing
* - Notification type demonstrations
* - Passkey and JWT verification workflows
* - File upload with temporary storage
* - Crypto library testing utilities
*
*
* Security Considerations:
* - Test environment only - not for production use
* - SQL operations are intentionally raw for testing purposes
* - File uploads stored temporarily for testing workflows
*
*
* @author Matthew Raymer
*/
@Component({
@Component({
components: { QuickNav },
mixins: [PlatformServiceMixin],
})
@ -295,7 +262,7 @@ export default class Help extends Vue {
* Computed properties for template streamlining
* Eliminates repeated classes and logic in template
*/
/**
* Standard button class for primary actions
*/
@ -311,7 +278,7 @@ export default class Help extends Vue {
}
/**
* Secondary button class for secondary test actions
* Secondary button class for secondary test actions
*/
get secondaryButtonClasses(): string {
return "font-bold capitalize bg-slate-600 text-white px-3 py-2 rounded-md mr-2";
@ -363,8 +330,8 @@ export default class Help extends Vue {
* Formatted display of encryption test result
*/
get encryptionTestResultDisplay(): string {
return this.messageEncryptionTestResult !== undefined
? `Result: ${this.messageEncryptionTestResult}`
return this.messageEncryptionTestResult !== undefined
? `Result: ${this.messageEncryptionTestResult}`
: "Result: Not tested";
}
@ -372,8 +339,8 @@ export default class Help extends Vue {
* Formatted display of simple encryption test result
*/
get simpleEncryptionTestResultDisplay(): string {
return this.simpleEncryptionTestResult !== undefined
? `Result: ${this.simpleEncryptionTestResult}`
return this.simpleEncryptionTestResult !== undefined
? `Result: ${this.simpleEncryptionTestResult}`
: "Result: Not tested";
}
@ -411,21 +378,21 @@ export default class Help extends Vue {
label: "Toast",
classes: this.darkButtonClasses,
notification: {
group: 'alert',
type: 'toast',
title: 'Toast',
group: "alert",
type: "toast",
title: "Toast",
text: "I'm a toast. Without a timeout, I'm stuck.",
},
timeout: 5000,
},
{
label: "Info",
label: "Info",
classes: this.secondaryButtonClasses,
notification: {
group: 'alert',
type: 'info',
title: 'Information Alert',
text: 'Just wanted you to know.',
group: "alert",
type: "info",
title: "Information Alert",
text: "Just wanted you to know.",
},
timeout: 5000,
},
@ -433,10 +400,10 @@ export default class Help extends Vue {
label: "Success",
classes: this.successButtonClasses,
notification: {
group: 'alert',
type: 'success',
title: 'Success Alert',
text: 'Congratulations!',
group: "alert",
type: "success",
title: "Success Alert",
text: "Congratulations!",
},
timeout: 5000,
},
@ -444,10 +411,10 @@ export default class Help extends Vue {
label: "Warning",
classes: this.warningButtonClasses,
notification: {
group: 'alert',
type: 'warning',
title: 'Warning Alert',
text: 'You might wanna look at this.',
group: "alert",
type: "warning",
title: "Warning Alert",
text: "You might wanna look at this.",
},
timeout: 5000,
},
@ -455,10 +422,10 @@ export default class Help extends Vue {
label: "Danger",
classes: this.dangerButtonClasses,
notification: {
group: 'alert',
type: 'danger',
title: 'Danger Alert',
text: 'Something terrible has happened!',
group: "alert",
type: "danger",
title: "Danger Alert",
text: "Something terrible has happened!",
},
timeout: 5000,
},
@ -466,10 +433,10 @@ export default class Help extends Vue {
label: "Notif ON",
classes: this.secondaryButtonClasses,
notification: {
group: 'modal',
type: 'notification-permission',
title: 'Notification Permission',
text: 'Enable notifications?',
group: "modal",
type: "notification-permission",
title: "Notification Permission",
text: "Enable notifications?",
},
timeout: -1,
},
@ -477,10 +444,10 @@ export default class Help extends Vue {
label: "Notif MUTE",
classes: this.secondaryButtonClasses,
notification: {
group: 'modal',
type: 'notification-mute',
title: 'Notification Settings',
text: 'Notifications muted',
group: "modal",
type: "notification-mute",
title: "Notification Settings",
text: "Notifications muted",
},
timeout: -1,
},
@ -488,10 +455,10 @@ export default class Help extends Vue {
label: "Notif OFF",
classes: this.secondaryButtonClasses,
notification: {
group: 'modal',
type: 'notification-off',
title: 'Notifications',
text: 'Notifications turned off',
group: "modal",
type: "notification-off",
title: "Notifications",
text: "Notifications turned off",
},
timeout: -1,
},
@ -508,7 +475,7 @@ export default class Help extends Vue {
/**
* Component initialization
*
*
* Loads user settings and account information for testing interface
* Uses PlatformServiceMixin for database access
*/
@ -529,7 +496,7 @@ export default class Help extends Vue {
/**
* Handles file upload for image sharing tests
*
*
* Processes uploaded files and stores them in temp table for shared photo testing
* Uses PlatformServiceMixin service methods for temp table operations
*/
@ -553,17 +520,14 @@ export default class Help extends Vue {
// Use service methods for temp table operations
const temp = await this.$getTemp(SHARED_PHOTO_BASE64_KEY);
if (temp) {
await this.$updateEntity(
"temp",
{ blobB64 },
"id = ?",
[SHARED_PHOTO_BASE64_KEY]
);
await this.$updateEntity("temp", { blobB64 }, "id = ?", [
SHARED_PHOTO_BASE64_KEY,
]);
} else {
await this.$insertEntity(
"temp",
{ id: SHARED_PHOTO_BASE64_KEY, blobB64 },
["id", "blobB64"]
"temp",
{ id: SHARED_PHOTO_BASE64_KEY, blobB64 },
["id", "blobB64"],
);
}
}
@ -581,7 +545,7 @@ export default class Help extends Vue {
/**
* Handles passkey registration for testing
*
*
* Creates new passkey with user name or default test name
* Includes validation and user confirmation workflow
* Uses notification helpers for consistent messaging
@ -596,9 +560,9 @@ export default class Help extends Vue {
},
async () => {
this.$router.push({ name: "new-edit-account" });
}
},
);
this.$notify(modalConfig, -1);
return;
}
@ -735,7 +699,7 @@ export default class Help extends Vue {
/**
* Executes SQL queries for testing database operations
*
*
* Supports both SELECT queries (dbQuery) and other SQL commands (dbExec)
* Provides interface for testing raw SQL operations
* Uses PlatformServiceMixin for database access and notification helpers for errors

Loading…
Cancel
Save