diff --git a/app/src/constants/index.ts b/app/src/constants/index.ts index 1bbb5c18..b8606cc8 100644 --- a/app/src/constants/index.ts +++ b/app/src/constants/index.ts @@ -25,3 +25,14 @@ export enum NginxStatus { Restarting, Stopped, } + +export const PrivateKeyTypeMask = { + 2048: 'RSA2048', + 3072: 'RSA3072', + 4096: 'RSA4096', + 8192: 'RSA8192', + P256: 'EC256', + P384: 'EC384', +} as const + +export const PrivateKeyTypeList = Object.entries(PrivateKeyTypeMask).map(([key, name]) => ({ key, name })) diff --git a/app/src/views/certificate/Certificate.vue b/app/src/views/certificate/Certificate.vue index a8ae7809..ad096e61 100644 --- a/app/src/views/certificate/Certificate.vue +++ b/app/src/views/certificate/Certificate.vue @@ -4,11 +4,11 @@ import dayjs from 'dayjs' import { CloudUploadOutlined, SafetyCertificateOutlined } from '@ant-design/icons-vue' import { input } from '@/components/StdDesign/StdDataEntry' import type { customRender } from '@/components/StdDesign/StdDataDisplay/StdTableTransformer' -import { datetime } from '@/components/StdDesign/StdDataDisplay/StdTableTransformer' +import { datetime, mask } from '@/components/StdDesign/StdDataDisplay/StdTableTransformer' import cert from '@/api/cert' import type { Column, JSXElements } from '@/components/StdDesign/types' import type { Cert } from '@/api/cert' -import { AutoCertState } from '@/constants' +import { AutoCertState, PrivateKeyTypeMask } from '@/constants' import StdTable from '@/components/StdDesign/StdDataDisplay/StdTable.vue' import WildcardCertificate from '@/views/certificate/WildcardCertificate.vue' @@ -57,6 +57,12 @@ const columns: Column[] = [{ }, sortable: true, pithy: true, +}, { + title: () => $gettext('Key Type'), + dataIndex: 'key_type', + customRender: mask(PrivateKeyTypeMask), + sortable: true, + pithy: true, }, { title: () => $gettext('SSL Certificate Path'), dataIndex: 'ssl_certificate_path', diff --git a/app/src/views/certificate/WildcardCertificate.vue b/app/src/views/certificate/WildcardCertificate.vue index 1a1dbbce..f868bd3a 100644 --- a/app/src/views/certificate/WildcardCertificate.vue +++ b/app/src/views/certificate/WildcardCertificate.vue @@ -4,6 +4,7 @@ import { message } from 'ant-design-vue' import type { Cert } from '@/api/cert' import ObtainCertLive from '@/views/domain/cert/components/ObtainCertLive.vue' import DNSChallenge from '@/views/domain/cert/components/DNSChallenge.vue' +import { PrivateKeyTypeList } from '@/constants' const emit = defineEmits<{ issued: [void] @@ -50,33 +51,6 @@ const issueCert = () => { emit('issued') }) } - -const keyType = shallowRef([ - { - key: '2048', - name: 'RSA2048', - }, - { - key: '3072', - name: 'RSA3072', - }, - { - key: '4096', - name: 'RSA4096', - }, - { - key: '8192', - name: 'RAS8192', - }, - { - key: 'P256', - name: 'EC256', - }, - { - key: 'P384', - name: 'EC384', - }, -])