Add ssh project default cas

This commit is contained in:
Tuan Dang
2025-04-06 14:22:17 -07:00
parent 5671cd5cef
commit c2f2a038ad
141 changed files with 696 additions and 400 deletions
@@ -17,3 +17,42 @@ export enum SshCaKeySource {
INTERNAL = "internal",
EXTERNAL = "external"
}
export enum SshCertKeyAlgorithm {
RSA_2048 = "RSA_2048",
RSA_4096 = "RSA_4096",
ECDSA_P256 = "EC_prime256v1",
ECDSA_P384 = "EC_secp384r1",
ED25519 = "ED25519"
}
export const sshCertKeyAlgorithmToNameMap: { [K in SshCertKeyAlgorithm]: string } = {
[SshCertKeyAlgorithm.RSA_2048]: "RSA 2048",
[SshCertKeyAlgorithm.RSA_4096]: "RSA 4096",
[SshCertKeyAlgorithm.ECDSA_P256]: "ECDSA P256",
[SshCertKeyAlgorithm.ECDSA_P384]: "ECDSA P384",
[SshCertKeyAlgorithm.ED25519]: "ED25519"
};
export const sshCertKeyAlgorithms = [
{
label: sshCertKeyAlgorithmToNameMap[SshCertKeyAlgorithm.RSA_2048],
value: SshCertKeyAlgorithm.RSA_2048
},
{
label: sshCertKeyAlgorithmToNameMap[SshCertKeyAlgorithm.RSA_4096],
value: SshCertKeyAlgorithm.RSA_4096
},
{
label: sshCertKeyAlgorithmToNameMap[SshCertKeyAlgorithm.ECDSA_P256],
value: SshCertKeyAlgorithm.ECDSA_P256
},
{
label: sshCertKeyAlgorithmToNameMap[SshCertKeyAlgorithm.ECDSA_P384],
value: SshCertKeyAlgorithm.ECDSA_P384
},
{
label: sshCertKeyAlgorithmToNameMap[SshCertKeyAlgorithm.ED25519],
value: SshCertKeyAlgorithm.ED25519
}
];
+6 -7
View File
@@ -1,5 +1,4 @@
import { CertKeyAlgorithm } from "../certificates/enums";
import { SshCaKeySource, SshCaStatus, SshCertType } from "./constants";
import { SshCaKeySource, SshCaStatus, SshCertKeyAlgorithm, SshCertType } from "./constants";
export type TSshCertificate = {
id: string;
@@ -18,7 +17,7 @@ export type TSshCertificateAuthority = {
projectId: string;
status: SshCaStatus;
friendlyName: string;
keyAlgorithm: CertKeyAlgorithm;
keyAlgorithm: SshCertKeyAlgorithm;
keySource: SshCaKeySource;
createdAt: string;
updatedAt: string;
@@ -30,13 +29,13 @@ export type TCreateSshCaDTO =
projectId: string;
friendlyName?: string;
keySource: SshCaKeySource.INTERNAL;
keyAlgorithm: CertKeyAlgorithm;
keyAlgorithm: SshCertKeyAlgorithm;
}
| {
projectId: string;
friendlyName?: string;
keySource: SshCaKeySource.EXTERNAL;
keyAlgorithm: CertKeyAlgorithm;
keyAlgorithm: SshCertKeyAlgorithm;
publicKey: string;
privateKey: string;
};
@@ -69,7 +68,7 @@ export type TSignSshKeyResponse = {
export type TIssueSshCredsDTO = {
projectId: string;
certificateTemplateId: string;
keyAlgorithm: CertKeyAlgorithm;
keyAlgorithm: SshCertKeyAlgorithm;
certType: SshCertType;
principals: string[];
ttl?: string;
@@ -81,5 +80,5 @@ export type TIssueSshCredsResponse = {
signedKey: string;
privateKey: string;
publicKey: string;
keyAlgorithm: CertKeyAlgorithm;
keyAlgorithm: SshCertKeyAlgorithm;
};