mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-21 07:16:15 -04:00
feat(new-tool): ed25519 key pair generator
This commit is contained in:
parent
7c40539ef9
commit
55d2a4d7af
3 changed files with 49 additions and 0 deletions
|
@ -0,0 +1,14 @@
|
||||||
|
import { pki } from 'node-forge';
|
||||||
|
|
||||||
|
export { generateKeyPair };
|
||||||
|
|
||||||
|
function generateKeyPair() {
|
||||||
|
const { privateKey, publicKey } = pki.ed25519.generateKeyPair();
|
||||||
|
|
||||||
|
console.log({ privateKey, publicKey });
|
||||||
|
|
||||||
|
return {
|
||||||
|
publicKeyPem: pki.publicKeyToPem(publicKey),
|
||||||
|
privateKeyPem: pki.privateKeyToPem(privateKey),
|
||||||
|
};
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<h3>Public key</h3>
|
||||||
|
<textarea-copyable :value="certs.publicKeyPem" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<h3>Private key</h3>
|
||||||
|
<textarea-copyable :value="certs.privateKeyPem" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import TextareaCopyable from '@/components/TextareaCopyable.vue';
|
||||||
|
import { withDefaultOnErrorAsync } from '@/utils/defaults';
|
||||||
|
import { computed } from 'vue';
|
||||||
|
import { generateKeyPair } from './ed25519-key-pair-generator.service';
|
||||||
|
|
||||||
|
const emptyCerts = { publicKeyPem: '', privateKeyPem: '' };
|
||||||
|
|
||||||
|
const certs = computed(() => generateKeyPair());
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
11
src/tools/ed25519-key-pair-generator/index.ts
Normal file
11
src/tools/ed25519-key-pair-generator/index.ts
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
import { ArrowsShuffle } from '@vicons/tabler';
|
||||||
|
import { defineTool } from '../tool';
|
||||||
|
|
||||||
|
export const tool = defineTool({
|
||||||
|
name: 'Ed25519 key pair generator',
|
||||||
|
path: '/ed25519-key-pair-generator',
|
||||||
|
description: '',
|
||||||
|
keywords: ['ed25519', 'key', 'pair', 'generator'],
|
||||||
|
component: () => import('./ed25519-key-pair-generator.vue'),
|
||||||
|
icon: ArrowsShuffle,
|
||||||
|
});
|
Loading…
Add table
Add a link
Reference in a new issue