MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / encryptEnv

Function encryptEnv

vmm/ui/src/composables/useVmManager.ts:916–928  ·  view source on GitHub ↗
(envs: EncryptedEnvEntry[], kmsEnabled: boolean, appId: string | null)

Source from the content-addressed store, hash-verified

914 }
915
916 async function encryptEnv(envs: EncryptedEnvEntry[], kmsEnabled: boolean, appId: string | null) {
917 if (!kmsEnabled || envs.length === 0) {
918 return undefined;
919 }
920 let appIdToUse = appId;
921 if (!appIdToUse) {
922 const appCompose = await makeAppComposeFile();
923 appIdToUse = await calcAppId(appCompose);
924 }
925 const keyBytes = hexToBytes(appIdToUse);
926 const response = await vmmRpc.getAppEnvEncryptPubKey({ app_id: keyBytes });
927 return encryptEnvWithKey(envs, response.public_key);
928 }
929
930 async function encryptEnvWithKey(envs: EncryptedEnvEntry[], publicKeyBytes: Uint8Array) {
931 const envsJson = JSON.stringify({ env: envs });

Callers 1

createVmFunction · 0.85

Calls 4

makeAppComposeFileFunction · 0.85
calcAppIdFunction · 0.85
encryptEnvWithKeyFunction · 0.85
hexToBytesFunction · 0.70

Tested by

no test coverage detected