diff options
Diffstat (limited to 'src/tools/bcrypt/bcrypt.vue')
-rw-r--r-- | src/tools/bcrypt/bcrypt.vue | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/src/tools/bcrypt/bcrypt.vue b/src/tools/bcrypt/bcrypt.vue index eb366fa..893cc28 100644 --- a/src/tools/bcrypt/bcrypt.vue +++ b/src/tools/bcrypt/bcrypt.vue @@ -1,3 +1,21 @@ +<script setup lang="ts"> +import { computed, ref } from 'vue'; +import { compareSync, hashSync } from 'bcryptjs'; +import { useThemeVars } from 'naive-ui'; +import { useCopy } from '@/composable/copy'; + +const themeVars = useThemeVars(); + +const input = ref(''); +const saltCount = ref(10); +const hashed = computed(() => hashSync(input.value, saltCount.value)); +const { copy } = useCopy({ source: hashed, text: 'Hashed string copied to the clipboard' }); + +const compareString = ref(''); +const compareHash = ref(''); +const compareMatch = computed(() => compareSync(compareString.value, compareHash.value)); +</script> + <template> <c-card title="Hash"> <c-input-text @@ -16,7 +34,9 @@ <c-input-text :value="hashed" readonly text-center /> <div mt-5 flex justify-center> - <c-button @click="copy"> Copy hash </c-button> + <c-button @click="copy"> + Copy hash + </c-button> </div> </c-card> @@ -37,24 +57,6 @@ </c-card> </template> -<script setup lang="ts"> -import { computed, ref } from 'vue'; -import { hashSync, compareSync } from 'bcryptjs'; -import { useCopy } from '@/composable/copy'; -import { useThemeVars } from 'naive-ui'; - -const themeVars = useThemeVars(); - -const input = ref(''); -const saltCount = ref(10); -const hashed = computed(() => hashSync(input.value, saltCount.value)); -const { copy } = useCopy({ source: hashed, text: 'Hashed string copied to the clipboard' }); - -const compareString = ref(''); -const compareHash = ref(''); -const compareMatch = computed(() => compareSync(compareString.value, compareHash.value)); -</script> - <style lang="less" scoped> .compare-result { color: v-bind('themeVars.errorColor'); |