feat(tool): bip39-generator

This commit is contained in:
Corentin Thomasset 2022-04-09 15:17:59 +02:00
parent 390ef93232
commit 765c010700
No known key found for this signature in database
GPG key ID: 3103EB5E79496F9C
7 changed files with 436 additions and 29 deletions

View file

@ -0,0 +1,47 @@
<template>
<div>
<n-card>
<n-space item-style="flex: 1 1 0">
<n-form-item label="Language:">
<n-select v-model:value="language" :options="languages" />
</n-form-item>
<n-form-item label="Entropy (seed):">
<n-input v-model:value="entropy" placeholder="Your string..." />
</n-form-item>
</n-space>
<n-form-item label="Passphrase (mnemonic):">
<n-input
style="text-align: center;"
:value="passphrase"
type="textarea"
placeholder="Your string hash"
:autosize="{ minRows: 1 }"
readonly
autocomplete="off"
autocorrect="off"
autocapitalize="off"
spellcheck="false"
/>
</n-form-item>
</n-card>
</div>
</template>
<script setup lang="ts">
import { useCopy } from '@/composable/copy';
import { ref, computed } from 'vue'
import { entropyToMnemonic } from 'bip39'
const entropy = ref('1d60683972011cb97322ed6ae96225f3')
const language = ref('English')
const languages = ref(['English'])
const passphrase = computed(() => {
// setDefaultWordlist(language.value)
return entropyToMnemonic(Buffer.from(entropy.value, "utf-8"))
})
</script>
<style lang="scss" scoped>
</style>

View file

@ -0,0 +1,11 @@
import { AlignJustified } from '@vicons/tabler';
import type { ITool } from '../Tool';
export const tool: ITool = {
name: 'BIP39 passphrase generator',
path: '/bip39-generator',
description: 'Generate BIP39 passphrase from existing or random mnemonic, or get the mnemonic from the passphrase.',
keywords: ['BIP39', 'passphrase', 'generator', 'mnemonic', 'entropy'],
component: () => import('./bip39-generator.vue'),
icon: AlignJustified,
};

View file

@ -6,12 +6,13 @@ import { tool as hashText } from './hash-text';
import { tool as uuidGenerator } from './uuid-generator';
import { tool as romanNumeralConverter } from './roman-numeral-converter';
import { tool as cypher } from './encryption';
import { tool as bip39 } from './bip39-generator';
export const toolsByCategory: ToolCategory[] = [
{
name: 'Crypto',
icon: LockOpen,
components: [tokenGenerator, hashText, uuidGenerator, cypher],
components: [tokenGenerator, hashText, uuidGenerator, cypher, bip39],
},
{
name: 'Converter',