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.

Make decrypt async and await results

Update callers to use Promise.all and Object.fromEntries to build env
maps, allowing concurrent asynchronous decryption
instead of a synchronous reduce over secrets

+16 -21
+14 -18
apps/cf-sandbox/src/index.ts
··· 277 277 }, 278 278 {} as Record<string, string>, 279 279 ), 280 - ...params[1] 281 - .map(({ secrets }) => secrets) 282 - .filter((v) => v !== null) 283 - .reduce( 284 - (acc, v) => { 285 - acc[v.name] = decrypt(v.value); 286 - return acc; 287 - }, 288 - {} as Record<string, string>, 280 + ...Object.fromEntries( 281 + await Promise.all( 282 + params[1] 283 + .map(({ secrets }) => secrets) 284 + .filter((v) => v !== null) 285 + .map(async (v) => [v.name, await decrypt(v.value)] as const), 289 286 ), 287 + ), 290 288 }); 291 289 292 290 await sandbox.start(); ··· 459 457 }, 460 458 {} as Record<string, string>, 461 459 ), 462 - ...params[1] 463 - .map(({ secrets }) => secrets) 464 - .filter((v) => v !== null) 465 - .reduce( 466 - (acc, v) => { 467 - acc[v.name] = decrypt(v.value); 468 - return acc; 469 - }, 470 - {} as Record<string, string>, 460 + ...Object.fromEntries( 461 + await Promise.all( 462 + params[1] 463 + .map(({ secrets }) => secrets) 464 + .filter((v) => v !== null) 465 + .map(async (v) => [v.name, await decrypt(v.value)] as const), 471 466 ), 467 + ), 472 468 }; 473 469 await sandbox.setEnvVars(envVars); 474 470
+2 -3
apps/cf-sandbox/src/lib/decrypt.ts
··· 1 1 import { env } from "cloudflare:workers"; 2 2 import sodium from "libsodium-wrappers"; 3 3 4 - await sodium.ready; 5 - 6 - export default function decrypt(value: string): string { 4 + export default async function decrypt(value: string): Promise<string> { 5 + await sodium.ready; 7 6 const sealed = sodium.from_base64( 8 7 value, 9 8 sodium.base64_variants.URLSAFE_NO_PADDING,