Download data/packages/server/src/utils/filesystem/ssh.ts from llama1/dokpl0y: direct link, hf CLI and curl.
- Browser
- Download file 521 Bytes
-
https://huggingface.co/datasets/llama1/dokpl0y/resolve/main/data/packages/server/src/utils/filesystem/ssh.ts
- Command line
-
hf download hf://datasets/llama1/dokpl0y/data/packages/server/src/utils/filesystem/ssh.ts
-
curl -L -o ssh.ts https://huggingface.co/datasets/llama1/dokpl0y/resolve/main/data/packages/server/src/utils/filesystem/ssh.ts
521 Bytes
| 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; | |
| } | |
| }; | |