the universal sandbox runtime for agents and humans. pocketenv.io
sandbox openclaw agent claude-code vercel-sandbox deno-sandbox cloudflare-sandbox atproto sprites daytona
7
fork

Configure Feed

Select the types of activity you want to include in your feed.

Support SSH key generation and editor input

+53 -2
+52 -2
apps/cli/src/cmd/sshkeys.ts
··· 1 - import { input } from "@inquirer/prompts"; 1 + import { editor, input } from "@inquirer/prompts"; 2 2 import getAccessToken from "../lib/getAccessToken"; 3 + import { generateEd25519SSHKeyPair } from "../lib/sshKeys"; 4 + import consola from "consola"; 3 5 4 6 export async function getSshKey(sandbox: string) { 5 7 const token = await getAccessToken(); 6 8 } 7 9 8 - export async function putKeys(sandbox: string) { 10 + export async function putKeys( 11 + sandbox: string, 12 + { generate }: { generate: boolean | undefined }, 13 + ) { 9 14 const token = await getAccessToken(); 15 + if (generate) { 16 + const { privateKey, publicKey } = await generateEd25519SSHKeyPair(); 17 + consola.log("\nPrivate Key:\n"); 18 + consola.log(privateKey); 19 + consola.log("\nPublic Key:\n"); 20 + consola.log(publicKey, "\n"); 21 + 22 + consola.success("SSH keys generated successfully!"); 23 + return; 24 + } 25 + 26 + const validatePrivateKey = (value: string): string | true => { 27 + const trimmed = value.trim(); 28 + if (!trimmed.startsWith("-----BEGIN")) { 29 + return "Private key must start with a PEM header (e.g. -----BEGIN OPENSSH PRIVATE KEY-----)"; 30 + } 31 + if (!trimmed.endsWith("-----")) { 32 + return "Private key must end with a PEM footer (e.g. -----END OPENSSH PRIVATE KEY-----)"; 33 + } 34 + return true; 35 + }; 36 + 37 + const privateKey = ( 38 + await editor({ 39 + message: "Enter your SSH private key (opens in $EDITOR):", 40 + postfix: ".pem", 41 + waitForUserInput: false, 42 + validate: validatePrivateKey, 43 + }) 44 + ).trim(); 45 + 46 + const publicKey = ( 47 + await input({ 48 + message: "Enter your SSH public key:", 49 + validate: (value: string): string | true => 50 + value.trim().length > 0 ? true : "Public key cannot be empty.", 51 + }) 52 + ).trim(); 53 + 54 + consola.log("\nPrivate Key:\n"); 55 + consola.log(privateKey); 56 + consola.log("\nPublic Key:\n"); 57 + consola.log(publicKey, "\n"); 58 + 59 + consola.success("SSH keys saved successfully!"); 10 60 }
+1
apps/cli/src/index.ts
··· 157 157 .argument("<sandbox>", "the sandbox to put the SSH key in") 158 158 .option("--private-key", "the path to the SSH private key") 159 159 .option("--public-key", "the path to the SSH public key") 160 + .option("--generate, -g", "generate a new SSH key pair") 160 161 .description("put an SSH key in the given sandbox") 161 162 .action(putKeys); 162 163