mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
refactor: rename builders to server
This commit is contained in:
26
packages/server/src/utils/filesystem/ssh.ts
Normal file
26
packages/server/src/utils/filesystem/ssh.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import * as ssh2 from "ssh2";
|
||||
|
||||
export const generateSSHKey = async (type: "rsa" | "ed25519" = "rsa") => {
|
||||
try {
|
||||
if (type === "rsa") {
|
||||
const keys = ssh2.utils.generateKeyPairSync("rsa", {
|
||||
bits: 4096,
|
||||
comment: "dokploy",
|
||||
});
|
||||
return {
|
||||
privateKey: keys.private,
|
||||
publicKey: keys.public,
|
||||
};
|
||||
}
|
||||
const keys = ssh2.utils.generateKeyPairSync("ed25519", {
|
||||
comment: "dokploy",
|
||||
});
|
||||
|
||||
return {
|
||||
privateKey: keys.private,
|
||||
publicKey: keys.public,
|
||||
};
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user