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.

Validate PUBLIC_KEY and PRIVATE_KEY in decrypt

Throw a clear error when either env var is missing and use local
constants instead of non-null assertions when converting hex to bytes.

+9 -2
+9 -2
apps/modal-sandbox/src/lib/decrypt.ts
··· 8 8 return undefined; 9 9 } 10 10 11 + const { PUBLIC_KEY, PRIVATE_KEY } = process.env; 12 + if (!PUBLIC_KEY || !PRIVATE_KEY) { 13 + throw new Error( 14 + "PUBLIC_KEY and PRIVATE_KEY environment variables must be set for decryption", 15 + ); 16 + } 17 + 11 18 const sealed = sodium.from_base64( 12 19 value, 13 20 sodium.base64_variants.URLSAFE_NO_PADDING, 14 21 ); 15 22 const decryptedBytes = sodium.crypto_box_seal_open( 16 23 sealed, 17 - sodium.from_hex(process.env.PUBLIC_KEY!), 18 - sodium.from_hex(process.env.PRIVATE_KEY!), 24 + sodium.from_hex(PUBLIC_KEY), 25 + sodium.from_hex(PRIVATE_KEY), 19 26 ); 20 27 return sodium.to_string(decryptedBytes); 21 28 }