mirror of https://github.com/dethos/kinspect.git
add web key directory search
This commit is contained in:
parent
3903e97b7e
commit
5206b81e32
24
src/App.vue
24
src/App.vue
|
@ -6,6 +6,9 @@
|
||||||
<span class="font-weight-light">Check the details of any PGP key</span>
|
<span class="font-weight-light">Check the details of any PGP key</span>
|
||||||
</v-toolbar-title>
|
</v-toolbar-title>
|
||||||
<v-spacer></v-spacer>
|
<v-spacer></v-spacer>
|
||||||
|
<v-btn text @click.stop="searchDialog = true">
|
||||||
|
<span class="mr-2">Search Key</span>
|
||||||
|
</v-btn>
|
||||||
<v-btn text v-on:click="changeTheme">
|
<v-btn text v-on:click="changeTheme">
|
||||||
<span class="mr-2">Swicth to {{darkTheme ? "light theme" : "dark theme"}}</span>
|
<span class="mr-2">Swicth to {{darkTheme ? "light theme" : "dark theme"}}</span>
|
||||||
</v-btn>
|
</v-btn>
|
||||||
|
@ -15,7 +18,12 @@
|
||||||
</v-app-bar>
|
</v-app-bar>
|
||||||
|
|
||||||
<v-content>
|
<v-content>
|
||||||
<KeyInspect />
|
<KeyInspect v-bind:initialKey="searchKey" />
|
||||||
|
<DirSearch
|
||||||
|
v-bind:dialog="searchDialog"
|
||||||
|
v-on:dialogClosed="closeDialog"
|
||||||
|
v-on:keyFound="setSearchKey"
|
||||||
|
/>
|
||||||
</v-content>
|
</v-content>
|
||||||
|
|
||||||
<v-footer>
|
<v-footer>
|
||||||
|
@ -31,14 +39,18 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import KeyInspect from "./components/KeyInspect";
|
import KeyInspect from "./components/KeyInspect";
|
||||||
|
import DirSearch from "./components/DirSearch";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "App",
|
name: "App",
|
||||||
components: {
|
components: {
|
||||||
KeyInspect
|
KeyInspect,
|
||||||
|
DirSearch
|
||||||
},
|
},
|
||||||
data: () => ({
|
data: () => ({
|
||||||
darkTheme: true
|
darkTheme: true,
|
||||||
|
searchDialog: false,
|
||||||
|
searchKey: ""
|
||||||
}),
|
}),
|
||||||
created: function() {
|
created: function() {
|
||||||
this.$vuetify.theme.dark = this.darkTheme;
|
this.$vuetify.theme.dark = this.darkTheme;
|
||||||
|
@ -47,6 +59,12 @@ export default {
|
||||||
changeTheme: function() {
|
changeTheme: function() {
|
||||||
this.darkTheme = !this.darkTheme;
|
this.darkTheme = !this.darkTheme;
|
||||||
this.$vuetify.theme.dark = this.darkTheme;
|
this.$vuetify.theme.dark = this.darkTheme;
|
||||||
|
},
|
||||||
|
closeDialog: function() {
|
||||||
|
this.searchDialog = false;
|
||||||
|
},
|
||||||
|
setSearchKey: function(armoredKey) {
|
||||||
|
this.searchKey = armoredKey;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
<template>
|
||||||
|
<v-dialog v-model="dialog" width="500">
|
||||||
|
<v-card>
|
||||||
|
<v-card-title class="headline" primary-title>Key Search</v-card-title>
|
||||||
|
<v-card-text>
|
||||||
|
<p>
|
||||||
|
Find a public key based on a given email address. Kinspect will do a
|
||||||
|
<a
|
||||||
|
href="https://wiki.gnupg.org/WKD"
|
||||||
|
>
|
||||||
|
Web Key Directory
|
||||||
|
(WKD)
|
||||||
|
</a> lookup to find and select the correct public key.
|
||||||
|
</p>
|
||||||
|
<v-text-field v-model="email" :rules="emailRules" label="Email Address" required></v-text-field>
|
||||||
|
<p v-if="error">{{error}}</p>
|
||||||
|
</v-card-text>
|
||||||
|
<v-divider></v-divider>
|
||||||
|
<v-card-actions>
|
||||||
|
<v-spacer></v-spacer>
|
||||||
|
<v-btn color="primary" text @click="searchKey()">Search</v-btn>
|
||||||
|
<v-btn color="primary" text @click="closeDialog()">Close</v-btn>
|
||||||
|
</v-card-actions>
|
||||||
|
</v-card>
|
||||||
|
</v-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import * as openpgp from "openpgp";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
props: ["dialog"],
|
||||||
|
data: () => ({
|
||||||
|
email: "",
|
||||||
|
emailRules: [
|
||||||
|
v => !!v || "E-mail is required",
|
||||||
|
v => /.+@.+\..+/.test(v) || "E-mail must be valid"
|
||||||
|
],
|
||||||
|
error: ""
|
||||||
|
}),
|
||||||
|
methods: {
|
||||||
|
closeDialog: function() {
|
||||||
|
this.$emit("dialogClosed");
|
||||||
|
},
|
||||||
|
searchKey: async function() {
|
||||||
|
this.error = "";
|
||||||
|
let wkd = new openpgp.WKD();
|
||||||
|
try {
|
||||||
|
let result = await wkd.lookup({ email: this.email });
|
||||||
|
let key = result.keys[0];
|
||||||
|
this.$emit("keyFound", key.armor());
|
||||||
|
this.$emit("dialogClosed");
|
||||||
|
} catch (e) {
|
||||||
|
this.error = "Unable to find the key for the specified email address.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
|
@ -68,13 +68,20 @@ export default {
|
||||||
SubKey,
|
SubKey,
|
||||||
UserId
|
UserId
|
||||||
},
|
},
|
||||||
data: () => ({
|
props: {
|
||||||
pubkey: "",
|
initialKey: {
|
||||||
key: null,
|
default: ""
|
||||||
error: "",
|
}
|
||||||
alert: localStorage.getItem("keyAlertDismissed") == "true" ? false : true,
|
},
|
||||||
previousPubKeys: JSON.parse(localStorage.getItem("previousPubKeys")) || []
|
data: function() {
|
||||||
}),
|
return {
|
||||||
|
pubkey: this.initialKey ? this.initialKey : "",
|
||||||
|
key: null,
|
||||||
|
error: "",
|
||||||
|
alert: localStorage.getItem("keyAlertDismissed") == "true" ? false : true,
|
||||||
|
previousPubKeys: JSON.parse(localStorage.getItem("previousPubKeys")) || []
|
||||||
|
};
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
inspect: async function() {
|
inspect: async function() {
|
||||||
try {
|
try {
|
||||||
|
@ -121,6 +128,10 @@ export default {
|
||||||
watch: {
|
watch: {
|
||||||
alert: function() {
|
alert: function() {
|
||||||
localStorage.setItem("keyAlertDismissed", true);
|
localStorage.setItem("keyAlertDismissed", true);
|
||||||
|
},
|
||||||
|
initialKey: function(newValue) {
|
||||||
|
this.pubkey = newValue;
|
||||||
|
this.inspect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
module.exports = {
|
||||||
|
devServer: {
|
||||||
|
https: true,
|
||||||
|
},
|
||||||
|
};
|
Loading…
Reference in New Issue