Compare commits

..
Author SHA1 Message Date
sharevb cb45057c78 Merge branch 'main' into feat/x509-cert-generator 2024-03-09 10:25:07 +01:00
sharevb 16d1a0072d feat(new tool): x509 Certificate Generator
Fix CorentinTh#857
2024-03-09 10:14:58 +01:00
ShareVB e073b2babf chore: fix deps 2024-02-18 12:01:33 +01:00
sharevb 83832f3e2c feat(TextareaCopyable): word-wrap prop
Add word-wrap property (to allow presenting long public keys)
2024-02-18 11:39:13 +01:00
sharevb ee40ba1439 chore: prepare sshpk for cert/key/sshkeys related tools 2024-02-18 11:39:13 +01:00
sharevb 3f32990499 chore: prepare sshpk for cert/key/sshkeys related tools 2024-02-18 11:38:29 +01:00
21 changed files with 673 additions and 403 deletions

No files matched your search

+1 -1
View File
@@ -15,7 +15,7 @@ jobs:
- run: corepack enable
- uses: actions/setup-node@v3
with:
node-version: 20
node-version: 16
cache: 'pnpm'
- name: Install dependencies
+1 -1
View File
@@ -18,7 +18,7 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 20
node-version: 16
cache: 'pnpm'
- name: Get Playwright version
+1 -29
View File
@@ -89,28 +89,17 @@ declare module '@vue/runtime-core' {
HttpStatusCodes: typeof import('./src/tools/http-status-codes/http-status-codes.vue')['default']
IbanValidatorAndParser: typeof import('./src/tools/iban-validator-and-parser/iban-validator-and-parser.vue')['default']
'IconMdi:brushVariant': typeof import('~icons/mdi/brush-variant')['default']
'IconMdi:contentCopy': typeof import('~icons/mdi/content-copy')['default']
'IconMdi:kettleSteamOutline': typeof import('~icons/mdi/kettle-steam-outline')['default']
IconMdiArrowDown: typeof import('~icons/mdi/arrow-down')['default']
IconMdiArrowRightBottom: typeof import('~icons/mdi/arrow-right-bottom')['default']
IconMdiCamera: typeof import('~icons/mdi/camera')['default']
IconMdiChevronDown: typeof import('~icons/mdi/chevron-down')['default']
IconMdiChevronRight: typeof import('~icons/mdi/chevron-right')['default']
IconMdiClose: typeof import('~icons/mdi/close')['default']
IconMdiContentCopy: typeof import('~icons/mdi/content-copy')['default']
IconMdiDeleteOutline: typeof import('~icons/mdi/delete-outline')['default']
IconMdiDownload: typeof import('~icons/mdi/download')['default']
IconMdiEye: typeof import('~icons/mdi/eye')['default']
IconMdiEyeOff: typeof import('~icons/mdi/eye-off')['default']
IconMdiHeart: typeof import('~icons/mdi/heart')['default']
IconMdiPause: typeof import('~icons/mdi/pause')['default']
IconMdiPlay: typeof import('~icons/mdi/play')['default']
IconMdiRecord: typeof import('~icons/mdi/record')['default']
IconMdiRefresh: typeof import('~icons/mdi/refresh')['default']
IconMdiSearch: typeof import('~icons/mdi/search')['default']
IconMdiTranslate: typeof import('~icons/mdi/translate')['default']
IconMdiTriangleDown: typeof import('~icons/mdi/triangle-down')['default']
IconMdiVideo: typeof import('~icons/mdi/video')['default']
InputCopyable: typeof import('./src/components/InputCopyable.vue')['default']
IntegerBaseConverter: typeof import('./src/tools/integer-base-converter/integer-base-converter.vue')['default']
Ipv4AddressConverter: typeof import('./src/tools/ipv4-address-converter/ipv4-address-converter.vue')['default']
@@ -137,41 +126,25 @@ declare module '@vue/runtime-core' {
MenuLayout: typeof import('./src/components/MenuLayout.vue')['default']
MetaTagGenerator: typeof import('./src/tools/meta-tag-generator/meta-tag-generator.vue')['default']
MimeTypes: typeof import('./src/tools/mime-types/mime-types.vue')['default']
NAlert: typeof import('naive-ui')['NAlert']
NavbarButtons: typeof import('./src/components/NavbarButtons.vue')['default']
NCheckbox: typeof import('naive-ui')['NCheckbox']
NCode: typeof import('naive-ui')['NCode']
NCollapseTransition: typeof import('naive-ui')['NCollapseTransition']
NColorPicker: typeof import('naive-ui')['NColorPicker']
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
NDatePicker: typeof import('naive-ui')['NDatePicker']
NDivider: typeof import('naive-ui')['NDivider']
NDynamicInput: typeof import('naive-ui')['NDynamicInput']
NEllipsis: typeof import('naive-ui')['NEllipsis']
NForm: typeof import('naive-ui')['NForm']
NFormItem: typeof import('naive-ui')['NFormItem']
NGi: typeof import('naive-ui')['NGi']
NginxFormatter: typeof import('./src/tools/nginx-formatter/nginx-formatter.vue')['default']
NGrid: typeof import('naive-ui')['NGrid']
NH1: typeof import('naive-ui')['NH1']
NH2: typeof import('naive-ui')['NH2']
NH3: typeof import('naive-ui')['NH3']
NIcon: typeof import('naive-ui')['NIcon']
NImage: typeof import('naive-ui')['NImage']
NInputGroup: typeof import('naive-ui')['NInputGroup']
NInputGroupLabel: typeof import('naive-ui')['NInputGroupLabel']
NInputNumber: typeof import('naive-ui')['NInputNumber']
NLabel: typeof import('naive-ui')['NLabel']
NLayout: typeof import('naive-ui')['NLayout']
NLayoutSider: typeof import('naive-ui')['NLayoutSider']
NMenu: typeof import('naive-ui')['NMenu']
NProgress: typeof import('naive-ui')['NProgress']
NScrollbar: typeof import('naive-ui')['NScrollbar']
NSlider: typeof import('naive-ui')['NSlider']
NSpin: typeof import('naive-ui')['NSpin']
NStatistic: typeof import('naive-ui')['NStatistic']
NSwitch: typeof import('naive-ui')['NSwitch']
NTable: typeof import('naive-ui')['NTable']
NTag: typeof import('naive-ui')['NTag']
NumeronymGenerator: typeof import('./src/tools/numeronym-generator/numeronym-generator.vue')['default']
OtpCodeGeneratorAndValidator: typeof import('./src/tools/otp-code-generator-and-validator/otp-code-generator-and-validator.vue')['default']
PasswordStrengthAnalyser: typeof import('./src/tools/password-strength-analyser/password-strength-analyser.vue')['default']
@@ -186,7 +159,6 @@ declare module '@vue/runtime-core' {
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
RsaKeyPairGenerator: typeof import('./src/tools/rsa-key-pair-generator/rsa-key-pair-generator.vue')['default']
SafelinkDecoder: typeof import('./src/tools/safelink-decoder/safelink-decoder.vue')['default']
SlugifyString: typeof import('./src/tools/slugify-string/slugify-string.vue')['default']
SpanCopyable: typeof import('./src/components/SpanCopyable.vue')['default']
SqlPrettify: typeof import('./src/tools/sql-prettify/sql-prettify.vue')['default']
+3 -2
View File
@@ -74,7 +74,6 @@
"monaco-editor": "^0.43.0",
"naive-ui": "^2.35.0",
"netmask": "^2.0.2",
"nginx-config-formatter": "^1.4.5",
"node-forge": "^1.3.1",
"oui-data": "^1.0.10",
"pdf-signature-reader": "^1.4.2",
@@ -82,12 +81,12 @@
"plausible-tracker": "^0.3.8",
"qrcode": "^1.5.1",
"sql-formatter": "^13.0.0",
"sshpk": "^1.18.0",
"ua-parser-js": "^1.0.35",
"ulid": "^2.3.0",
"unicode-emoji-json": "^0.4.0",
"unplugin-auto-import": "^0.16.4",
"uuid": "^9.0.0",
"vite-plugin-node-polyfills": "^0.21.0",
"vue": "^3.3.4",
"vue-i18n": "^9.9.1",
"vue-router": "^4.1.6",
@@ -112,6 +111,7 @@
"@types/node": "^18.15.11",
"@types/node-forge": "^1.3.2",
"@types/qrcode": "^1.5.0",
"@types/sshpk": "^1.17.4",
"@types/ua-parser-js": "^0.7.36",
"@types/uuid": "^9.0.0",
"@unocss/eslint-config": "^0.57.0",
@@ -133,6 +133,7 @@
"unplugin-icons": "^0.17.0",
"unplugin-vue-components": "^0.25.0",
"vite": "^4.4.9",
"vite-plugin-node-polyfills": "^0.21.0",
"vite-plugin-pwa": "^0.16.0",
"vite-plugin-vue-markdown": "^0.23.5",
"vite-svg-loader": "^4.0.0",
+2 -2
View File
@@ -9,7 +9,7 @@ const useWebServer = process.env.NO_WEB_SERVER !== 'true';
*/
export default defineConfig({
testDir: './src',
testMatch: /\.e2e\.(spec\.)?ts$/,
testMatch: /.*\.e2e\.(spec\.)?ts/,
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
@@ -57,7 +57,7 @@ export default defineConfig({
&& {
webServer: {
command: 'npm run preview',
url: 'http://localhost:5050',
url: 'http://127.0.0.1:5050',
reuseExistingServer: !isCI,
},
}
+314 -238
View File
File diff suppressed because it is too large. Load diff
+2 -1
View File
@@ -16,6 +16,7 @@ const props = withDefaults(
language?: string
copyPlacement?: 'top-right' | 'bottom-right' | 'outside' | 'none'
copyMessage?: string
wordWrap?: boolean
}>(),
{
followHeightOf: null,
@@ -47,7 +48,7 @@ const tooltipText = computed(() => isJustCopied.value ? 'Copied!' : copyMessage.
:style="height ? `min-height: ${height - 40 /* card padding */ + 10 /* negative margin compensation */}px` : ''"
>
<n-config-provider :hljs="hljs">
<n-code :code="value" :language="language" :trim="false" data-test-id="area-content" />
<n-code :code="value" :language="language" :word-wrap="wordWrap" :trim="false" data-test-id="area-content" />
</n-config-provider>
</n-scrollbar>
<div absolute right-10px top-10px>
+1 -1
View File
@@ -28,7 +28,7 @@ const compareMatch = computed(() => compareSync(compareString.value, compareHash
mb-2
/>
<n-form-item label="Salt count: " label-placement="left" label-width="120">
<n-input-number v-model:value="saltCount" placeholder="Salt rounds..." :max="100" :min="0" w-full />
<n-input-number v-model:value="saltCount" placeholder="Salt rounds..." :max="10" :min="0" w-full />
</n-form-item>
<c-input-text :value="hashed" readonly text-center />
+15 -5
View File
@@ -5,8 +5,7 @@ import { tool as basicAuthGenerator } from './basic-auth-generator';
import { tool as asciiTextDrawer } from './ascii-text-drawer';
import { tool as textToUnicode } from './text-to-unicode';
import { tool as safelinkDecoder } from './safelink-decoder';
import { tool as nginxFormatter } from './nginx-formatter';
import { tool as x509CertificateGenerator } from './x509-certificate-generator';
import { tool as pdfSignatureChecker } from './pdf-signature-checker';
import { tool as numeronymGenerator } from './numeronym-generator';
import { tool as macAddressGenerator } from './mac-address-generator';
@@ -86,7 +85,20 @@ import { tool as yamlViewer } from './yaml-viewer';
export const toolsByCategory: ToolCategory[] = [
{
name: 'Crypto',
components: [tokenGenerator, hashText, bcrypt, uuidGenerator, ulidGenerator, cypher, bip39, hmacGenerator, rsaKeyPairGenerator, passwordStrengthAnalyser, pdfSignatureChecker],
components: [
tokenGenerator,
hashText,
bcrypt,
uuidGenerator,
ulidGenerator,
cypher,
bip39,
hmacGenerator,
rsaKeyPairGenerator,
x509CertificateGenerator,
passwordStrengthAnalyser,
pdfSignatureChecker,
],
},
{
name: 'Converter',
@@ -128,7 +140,6 @@ export const toolsByCategory: ToolCategory[] = [
userAgentParser,
httpStatusCodes,
jsonDiff,
safelinkDecoder,
],
},
{
@@ -149,7 +160,6 @@ export const toolsByCategory: ToolCategory[] = [
dockerRunToDockerComposeConverter,
xmlFormatter,
yamlViewer,
nginxFormatter,
],
},
{
@@ -11,9 +11,6 @@ describe('integer-base-converter', () => {
expect(convertBase({ value: '10100101', fromBase: 2, toBase: 16 })).toEqual('a5');
expect(convertBase({ value: '192654', fromBase: 10, toBase: 8 })).toEqual('570216');
expect(convertBase({ value: 'zz', fromBase: 64, toBase: 10 })).toEqual('2275');
expect(convertBase({ value: '42540766411283223938465490632011909384', fromBase: 10, toBase: 10 })).toEqual('42540766411283223938465490632011909384');
expect(convertBase({ value: '42540766411283223938465490632011909384', fromBase: 10, toBase: 16 })).toEqual('20010db8000085a300000000ac1f8908');
expect(convertBase({ value: '20010db8000085a300000000ac1f8908', fromBase: 16, toBase: 10 })).toEqual('42540766411283223938465490632011909384');
});
});
});
@@ -5,16 +5,16 @@ export function convertBase({ value, fromBase, toBase }: { value: string; fromBa
let decValue = value
.split('')
.reverse()
.reduce((carry: bigint, digit: string, index: number) => {
.reduce((carry: number, digit: string, index: number) => {
if (!fromRange.includes(digit)) {
throw new Error(`Invalid digit "${digit}" for base ${fromBase}.`);
}
return (carry += BigInt(fromRange.indexOf(digit)) * BigInt(fromBase) ** BigInt(index));
}, 0n);
return (carry += fromRange.indexOf(digit) * fromBase ** index);
}, 0);
let newValue = '';
while (decValue > 0) {
newValue = toRange[Number(decValue % BigInt(toBase))] + newValue;
decValue = (decValue - (decValue % BigInt(toBase))) / BigInt(toBase);
newValue = toRange[decValue % toBase] + newValue;
decValue = (decValue - (decValue % toBase)) / toBase;
}
return newValue || '0';
}
-12
View File
@@ -1,12 +0,0 @@
import { Braces } from '@vicons/tabler';
import { defineTool } from '../tool';
export const tool = defineTool({
name: 'Nginx formatter',
path: '/nginx-formatter',
description: 'Format/prettify Nginx configuration files',
keywords: ['nginx', 'formatter', 'prettier'],
component: () => import('./nginx-formatter.vue'),
icon: Braces,
createdAt: new Date('2024-03-30'),
});
@@ -1,27 +0,0 @@
<script setup lang="ts">
import { formatContent } from 'nginx-config-formatter';
import type { UseValidationRule } from '@/composable/validation';
import { withDefaultOnError } from '@/utils/defaults';
const defaultValue = '{\n\t"hello": [\n\t\t"world"\n\t]\n}';
const transformer = (value: string) => withDefaultOnError(() => formatContent(value), '');
const rules: UseValidationRule<string>[] = [
{
validator: (v: string) => v === '' || formatContent(v),
message: 'Provided Nginx config is not valid.',
},
];
</script>
<template>
<format-transformer
input-label="Your Nginx config"
:input-default="defaultValue"
input-placeholder="Paste your Nginx config here..."
output-label="Prettified Nginx config"
output-language="json"
:input-validation-rules="rules"
:transformer="transformer"
/>
</template>
-12
View File
@@ -1,12 +0,0 @@
import { Mailbox } from '@vicons/tabler';
import { defineTool } from '../tool';
export const tool = defineTool({
name: 'Outlook Safelink decoder',
path: '/safelink-decoder',
description: 'Decode Outlook SafeLink links',
keywords: ['outlook', 'safelink', 'decoder'],
component: () => import('./safelink-decoder.vue'),
icon: Mailbox,
createdAt: new Date('2024-03-11'),
});
@@ -1,21 +0,0 @@
import { describe, expect, it } from 'vitest';
import { decodeSafeLinksURL } from './safelink-decoder.service';
describe('safelink-decoder', () => {
describe('decodeSafeLinksURL', () => {
describe('decode outlook safelink urls', () => {
it('should decode basic safelink urls', () => {
expect(decodeSafeLinksURL('https://aus01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.google.com%2Fsearch%3Fq%3Dsafelink%26rlz%3D1&data=05%7C02%7C%7C1ed07253975b46da1d1508dc3443752a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638442711583216725%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdata=%2BQY0HBnnxfI7pzZoxzlhZdDvYu80LwQB0zUUjrffVnk%3D&reserved=0'))
.toBe('https://www.google.com/search?q=safelink&rlz=1');
});
it('should decode encoded safelink urls', () => {
expect(decodeSafeLinksURL('https://aus01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.google.com%2Fsearch%3Fq%3Dsafelink%26rlz%3D1&amp;data=05%7C02%7C%7C1ed07253975b46da1d1508dc3443752a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638442711583216725%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&amp;sdata=%2BQY0HBnnxfI7pzZoxzlhZdDvYu80LwQB0zUUjrffVnk%3D&amp;reserved=0'))
.toBe('https://www.google.com/search?q=safelink&rlz=1');
});
it('throw on not outlook safelink urls', () => {
expect(() => decodeSafeLinksURL('https://google.com'))
.toThrow('Invalid SafeLinks URL provided');
});
});
});
});
@@ -1,7 +0,0 @@
export function decodeSafeLinksURL(safeLinksUrl: string) {
if (!safeLinksUrl.match(/\.safelinks\.protection\.outlook\.com/)) {
throw new Error('Invalid SafeLinks URL provided');
}
return new URL(safeLinksUrl).searchParams.get('url');
}
@@ -1,32 +0,0 @@
<script setup lang="ts">
import { decodeSafeLinksURL } from './safelink-decoder.service';
import TextareaCopyable from '@/components/TextareaCopyable.vue';
const inputSafeLinkUrl = ref('');
const outputDecodedUrl = computed(() => {
try {
return decodeSafeLinksURL(inputSafeLinkUrl.value);
}
catch (e: any) {
return e.toString();
}
});
</script>
<template>
<div>
<c-input-text
v-model:value="inputSafeLinkUrl"
raw-text
placeholder="Your input Outlook SafeLink Url..."
autofocus
label="Your input Outlook SafeLink Url:"
/>
<n-divider />
<n-form-item label="Output decoded URL:">
<TextareaCopyable :value="outputDecodedUrl" :word-wrap="true" />
</n-form-item>
</div>
</template>
@@ -0,0 +1,12 @@
import { FileCertificate } from '@vicons/tabler';
import { defineTool } from '../tool';
export const tool = defineTool({
name: 'X509 certificate generator',
path: '/x509-certificate-generator',
description: 'Generate a self signed SSL/x509 certificate',
keywords: ['x509', 'ssl', 'tls', 'self-signed', 'certificate', 'generator'],
component: () => import('./x509-certificate-generator.vue'),
icon: FileCertificate,
createdAt: new Date('2024-02-25'),
});
@@ -0,0 +1,119 @@
import { asn1, md, pki, random, util } from 'node-forge';
import workerScript from 'node-forge/dist/prime.worker.min?url';
export { generateSSLCertificate };
function generateRSAPairs({ bits = 2048 }) {
return new Promise<pki.rsa.KeyPair>((resolve, reject) =>
pki.rsa.generateKeyPair({ bits, workerScript }, (err, keyPair) => {
if (err) {
reject(err);
return;
}
resolve(keyPair);
}),
);
}
// a hexString is considered negative if it's most significant bit is 1
// because serial numbers use ones' complement notation
// this RFC in section 4.1.2.2 requires serial numbers to be positive
// http://www.ietf.org/rfc/rfc5280.txt
function toPositiveHex(hexString: string) {
let mostSiginficativeHexAsInt = Number.parseInt(hexString[0], 16);
if (mostSiginficativeHexAsInt < 8) {
return hexString;
}
mostSiginficativeHexAsInt -= 8;
return mostSiginficativeHexAsInt.toString() + hexString.substring(1);
}
async function generateSSLCertificate(config: {
bits?: number
password?: string
commonName?: string
countryName?: string
city?: string
state?: string
organizationName?: string
organizationalUnit?: string
contactEmail?: string
days?: number
} = {}): Promise<{
fingerprint: string
publicKeyPem: string
privateKeyPem: string
certificatePem: string
}> {
const { privateKey, publicKey } = await generateRSAPairs(config);
const cert = pki.createCertificate();
cert.serialNumber = toPositiveHex(util.bytesToHex(random.getBytesSync(9))); // the serial number can be decimal or hex (if preceded by 0x)
cert.validity.notBefore = new Date();
cert.validity.notAfter = new Date();
cert.validity.notAfter.setDate(cert.validity.notBefore.getDate() + (config.days || 365));
const attrs = [{
name: 'commonName',
value: config.commonName,
}, {
name: 'countryName',
value: config.countryName,
}, {
name: 'stateOrProvinceName',
value: config.state,
}, {
name: 'localityName',
value: config.city,
}, {
name: 'organizationName',
value: config.organizationName,
}, {
name: 'organizationalUnitName',
value: config.organizationalUnit,
}, {
name: 'emailAddress',
value: config.contactEmail,
}].filter(attr => attr.value !== null && attr.value?.trim() !== '');
cert.setSubject(attrs);
cert.setIssuer(attrs);
cert.publicKey = publicKey;
cert.setExtensions([{
name: 'basicConstraints',
cA: true,
}, {
name: 'keyUsage',
keyCertSign: true,
digitalSignature: true,
nonRepudiation: true,
keyEncipherment: true,
dataEncipherment: true,
}]);
cert.sign(privateKey);
const fingerprint = md.sha1
.create()
.update(asn1.toDer(pki.certificateToAsn1(cert)).getBytes())
.digest()
.toHex()
.match(/.{2}/g)?.join(':') ?? '';
const privateUnencryptedKeyPem = pki.privateKeyToPem(privateKey);
return {
fingerprint,
certificatePem: pki.certificateToPem(cert),
publicKeyPem: pki.publicKeyToPem(publicKey),
privateKeyPem: config?.password
? pki.encryptRsaPrivateKey(privateKey, config?.password)
: privateUnencryptedKeyPem,
};
}
@@ -0,0 +1,196 @@
<script setup lang="ts">
import { generateSSLCertificate } from './x509-certificate-generator.service';
import TextareaCopyable from '@/components/TextareaCopyable.vue';
import { withDefaultOnErrorAsync } from '@/utils/defaults';
import { computedRefreshableAsync } from '@/composable/computedRefreshable';
import { useValidation } from '@/composable/validation';
const commonName = ref('test.com');
const commonNameValidation = useValidation({
source: commonName,
rules: [
{
message: 'Common Name/Domain Name must not be empty',
validator: value => value?.trim() !== '',
},
],
});
const organizationName = ref('Test');
const organizationalUnit = ref('');
const days = ref(365);
const password = ref('');
const city = ref('Paris');
const state = ref('FR');
const country = ref('France');
const contactEmail = ref('');
const emptyCSR = { certificatePem: '', privateKeyPem: '', publicKeyPem: '', fingerprint: '' };
const [certs, refreshCerts] = computedRefreshableAsync(
() => withDefaultOnErrorAsync(() => {
if (!commonNameValidation.isValid) {
return emptyCSR;
}
return generateSSLCertificate({
password: password.value,
commonName: commonName.value,
countryName: country.value,
city: city.value,
state: state.value,
organizationName: organizationName.value,
organizationalUnit: organizationalUnit.value,
contactEmail: contactEmail.value,
days: days.value,
});
},
emptyCSR,
), emptyCSR);
</script>
<template>
<div>
<div mb-2>
<n-form-item
label="Common Name/Domain Name:"
label-placement="top"
:feedback="commonNameValidation.message"
:validation-status="commonNameValidation.status"
>
<n-input
v-model:value="commonName"
placeholder="Common/Domain Name"
/>
</n-form-item>
</div>
<div>
<n-form-item
label="Duration (days):"
label-placement="left" label-width="100"
>
<n-input-number
v-model:value="days"
placeholder="Duration (days)"
:min="1"
/>
</n-form-item>
</div>
<div>
<n-form-item
label="Organization Name:"
label-placement="left" label-width="100"
>
<n-input
v-model:value="organizationName"
placeholder="Organization Name"
/>
</n-form-item>
</div>
<div>
<n-form-item
label="Organizational Unit:"
label-placement="left" label-width="100"
>
<n-input
v-model:value="organizationalUnit"
placeholder="Organization Unit"
/>
</n-form-item>
</div>
<div>
<n-form-item
label="State:"
label-placement="left" label-width="100"
>
<n-input
v-model:value="state"
placeholder="State"
/>
</n-form-item>
</div>
<div>
<n-form-item
label="City:"
label-placement="left" label-width="100"
>
<n-input
v-model:value="city"
placeholder="City"
/>
</n-form-item>
</div>
<div>
<n-form-item
label="Country:"
label-placement="left" label-width="100"
>
<n-input
v-model:value="country"
placeholder="Country"
/>
</n-form-item>
</div>
<div>
<n-form-item
label="Contact Email:"
label-placement="left" label-width="100"
>
<n-input
v-model:value="contactEmail"
placeholder="Contact Email"
/>
</n-form-item>
</div>
<div>
<n-form-item
label="Private Key passphrase:"
label-placement="top"
>
<n-input
v-model:value="password"
type="password"
show-password-on="mousedown"
placeholder="Passphrase"
/>
</n-form-item>
</div>
<div flex justify-center>
<c-button @click="refreshCerts">
Refresh Certificate
</c-button>
</div>
<n-divider />
<div v-if="commonNameValidation.isValid">
<div>
<h3>Certificate (PEM)</h3>
<TextareaCopyable :value="certs.certificatePem" />
</div>
<div>
<h3>Fingerprint:</h3>
<TextareaCopyable :value="certs.fingerprint" :word-wrap="true" />
</div>
<div>
<h3>Public key</h3>
<TextareaCopyable :value="certs.publicKeyPem" :word-wrap="true" />
</div>
<div>
<h3>Private key</h3>
<TextareaCopyable :value="certs.privateKeyPem" />
</div>
</div>
</div>
</template>
+1 -4
View File
@@ -1,5 +1,6 @@
import { resolve } from 'node:path';
import { URL, fileURLToPath } from 'node:url';
import { nodePolyfills } from 'vite-plugin-node-polyfills';
import VueI18n from '@intlify/unplugin-vue-i18n/vite';
import vue from '@vitejs/plugin-vue';
@@ -15,7 +16,6 @@ import { VitePWA } from 'vite-plugin-pwa';
import markdown from 'vite-plugin-vue-markdown';
import svgLoader from 'vite-svg-loader';
import { configDefaults } from 'vitest/config';
import { nodePolyfills } from 'vite-plugin-node-polyfills'
const baseUrl = process.env.BASE_URL ?? '/';
@@ -114,8 +114,5 @@ export default defineConfig({
},
build: {
target: 'esnext',
rollupOptions: {
external: ['node:fs/promises', 'fs'],
},
},
});