mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-14 22:51:53 +00:00
Add ssh project default cas
This commit is contained in:
@@ -17,9 +17,11 @@ import {
|
||||
} from "@app/components/v2";
|
||||
import { useWorkspace } from "@app/context";
|
||||
import { useCreateSshCa, useGetSshCaById, useUpdateSshCa } from "@app/hooks/api";
|
||||
import { certKeyAlgorithms } from "@app/hooks/api/certificates/constants";
|
||||
import { CertKeyAlgorithm } from "@app/hooks/api/certificates/enums";
|
||||
import { SshCaKeySource } from "@app/hooks/api/sshCa/constants";
|
||||
import {
|
||||
SshCaKeySource,
|
||||
SshCertKeyAlgorithm,
|
||||
sshCertKeyAlgorithms
|
||||
} from "@app/hooks/api/sshCa/constants";
|
||||
import { ProjectType } from "@app/hooks/api/workspace/types";
|
||||
import { UsePopUpState } from "@app/hooks/usePopUp";
|
||||
|
||||
@@ -40,10 +42,11 @@ const schema = z
|
||||
publicKey: z.string().optional(),
|
||||
privateKey: z.string().optional(),
|
||||
keyAlgorithm: z.enum([
|
||||
CertKeyAlgorithm.RSA_2048,
|
||||
CertKeyAlgorithm.RSA_4096,
|
||||
CertKeyAlgorithm.ECDSA_P256,
|
||||
CertKeyAlgorithm.ECDSA_P384
|
||||
SshCertKeyAlgorithm.RSA_2048,
|
||||
SshCertKeyAlgorithm.RSA_4096,
|
||||
SshCertKeyAlgorithm.ECDSA_P256,
|
||||
SshCertKeyAlgorithm.ECDSA_P384,
|
||||
SshCertKeyAlgorithm.ED25519
|
||||
])
|
||||
})
|
||||
.required();
|
||||
@@ -69,7 +72,7 @@ export const SshCaModal = ({ popUp, handlePopUpToggle }: Props) => {
|
||||
resolver: zodResolver(schema),
|
||||
defaultValues: {
|
||||
friendlyName: "",
|
||||
keyAlgorithm: CertKeyAlgorithm.RSA_2048,
|
||||
keyAlgorithm: SshCertKeyAlgorithm.ED25519,
|
||||
keySource: SshCaKeySource.INTERNAL,
|
||||
publicKey: "",
|
||||
privateKey: ""
|
||||
@@ -89,7 +92,7 @@ export const SshCaModal = ({ popUp, handlePopUpToggle }: Props) => {
|
||||
} else {
|
||||
reset({
|
||||
friendlyName: "",
|
||||
keyAlgorithm: CertKeyAlgorithm.RSA_2048,
|
||||
keyAlgorithm: SshCertKeyAlgorithm.ED25519,
|
||||
keySource: SshCaKeySource.INTERNAL,
|
||||
publicKey: "",
|
||||
privateKey: ""
|
||||
@@ -210,7 +213,7 @@ export const SshCaModal = ({ popUp, handlePopUpToggle }: Props) => {
|
||||
<Controller
|
||||
control={control}
|
||||
name="keyAlgorithm"
|
||||
defaultValue={CertKeyAlgorithm.RSA_2048}
|
||||
defaultValue={SshCertKeyAlgorithm.ED25519}
|
||||
render={({ field: { onChange, ...field }, fieldState: { error } }) => (
|
||||
<FormControl
|
||||
label="Key Algorithm"
|
||||
@@ -225,7 +228,7 @@ export const SshCaModal = ({ popUp, handlePopUpToggle }: Props) => {
|
||||
className="w-full"
|
||||
isDisabled={Boolean(ca)}
|
||||
>
|
||||
{certKeyAlgorithms.map(({ label, value }) => (
|
||||
{sshCertKeyAlgorithms.map(({ label, value }) => (
|
||||
<SelectItem value={String(value || "")} key={label}>
|
||||
{label}
|
||||
</SelectItem>
|
||||
|
||||
@@ -8,7 +8,7 @@ import { ProjectPermissionActions, ProjectPermissionSub } from "@app/context";
|
||||
import { useTimedReset } from "@app/hooks";
|
||||
import { useGetSshCaById } from "@app/hooks/api";
|
||||
import { caStatusToNameMap } from "@app/hooks/api/ca/constants";
|
||||
import { certKeyAlgorithmToNameMap } from "@app/hooks/api/certificates/constants";
|
||||
import { sshCertKeyAlgorithmToNameMap } from "@app/hooks/api/sshCa/constants";
|
||||
import { UsePopUpState } from "@app/hooks/usePopUp";
|
||||
|
||||
type Props = {
|
||||
@@ -93,7 +93,9 @@ export const SshCaDetailsSection = ({ caId, handlePopUpOpen }: Props) => {
|
||||
</div>
|
||||
<div className="mb-4">
|
||||
<p className="text-sm font-semibold text-mineshaft-300">Key Algorithm</p>
|
||||
<p className="text-sm text-mineshaft-300">{certKeyAlgorithmToNameMap[ca.keyAlgorithm]}</p>
|
||||
<p className="text-sm text-mineshaft-300">
|
||||
{sshCertKeyAlgorithmToNameMap[ca.keyAlgorithm]}
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<p className="text-sm font-semibold text-mineshaft-300">Public Key</p>
|
||||
|
||||
@@ -22,9 +22,11 @@ import {
|
||||
useListWorkspaceSshCertificateTemplates,
|
||||
useSignSshKey
|
||||
} from "@app/hooks/api";
|
||||
import { certKeyAlgorithms } from "@app/hooks/api/certificates/constants";
|
||||
import { CertKeyAlgorithm } from "@app/hooks/api/certificates/enums";
|
||||
import { SshCertType } from "@app/hooks/api/sshCa/constants";
|
||||
import {
|
||||
SshCertKeyAlgorithm,
|
||||
sshCertKeyAlgorithms,
|
||||
SshCertType
|
||||
} from "@app/hooks/api/sshCa/constants";
|
||||
import { UsePopUpState } from "@app/hooks/usePopUp";
|
||||
|
||||
import { SshCertificateContent } from "./SshCertificateContent";
|
||||
@@ -33,10 +35,11 @@ const schema = z.object({
|
||||
templateId: z.string(),
|
||||
publicKey: z.string().optional(),
|
||||
keyAlgorithm: z.enum([
|
||||
CertKeyAlgorithm.RSA_2048,
|
||||
CertKeyAlgorithm.RSA_4096,
|
||||
CertKeyAlgorithm.ECDSA_P256,
|
||||
CertKeyAlgorithm.ECDSA_P384
|
||||
SshCertKeyAlgorithm.RSA_2048,
|
||||
SshCertKeyAlgorithm.RSA_4096,
|
||||
SshCertKeyAlgorithm.ECDSA_P256,
|
||||
SshCertKeyAlgorithm.ECDSA_P384,
|
||||
SshCertKeyAlgorithm.ED25519
|
||||
]),
|
||||
certType: z.nativeEnum(SshCertType),
|
||||
principals: z.string(),
|
||||
@@ -95,7 +98,7 @@ export const SshCertificateModal = ({ popUp, handlePopUpToggle }: Props) => {
|
||||
} = useForm<FormData>({
|
||||
resolver: zodResolver(schema),
|
||||
defaultValues: {
|
||||
keyAlgorithm: CertKeyAlgorithm.RSA_2048,
|
||||
keyAlgorithm: SshCertKeyAlgorithm.ED25519,
|
||||
certType: SshCertType.USER
|
||||
}
|
||||
});
|
||||
@@ -282,7 +285,7 @@ export const SshCertificateModal = ({ popUp, handlePopUpToggle }: Props) => {
|
||||
<Controller
|
||||
control={control}
|
||||
name="keyAlgorithm"
|
||||
defaultValue={CertKeyAlgorithm.RSA_2048}
|
||||
defaultValue={SshCertKeyAlgorithm.ED25519}
|
||||
render={({ field: { onChange, ...field }, fieldState: { error } }) => (
|
||||
<FormControl
|
||||
label="Key Algorithm"
|
||||
@@ -295,7 +298,7 @@ export const SshCertificateModal = ({ popUp, handlePopUpToggle }: Props) => {
|
||||
onValueChange={(e) => onChange(e)}
|
||||
className="w-full"
|
||||
>
|
||||
{certKeyAlgorithms.map(({ label, value }) => (
|
||||
{sshCertKeyAlgorithms.map(({ label, value }) => (
|
||||
<SelectItem value={String(value || "")} key={label}>
|
||||
{label}
|
||||
</SelectItem>
|
||||
|
||||
Reference in New Issue
Block a user