MCPcopy Create free account
hub / github.com/Kilo-Org/cloud / deriveEncryptionKey

Function deriveEncryptionKey

services/wasteland/src/util/crypto.util.ts:56–77  ·  view source on GitHub ↗
(secret: string)

Source from the content-addressed store, hash-verified

54
55/** Derive an AES-256-GCM CryptoKey from a secret string using PBKDF2. */
56export async function deriveEncryptionKey(secret: string): Promise<CryptoKey> {
57 const keyMaterial = await crypto.subtle.importKey(
58 'raw',
59 new TextEncoder().encode(secret),
60 'PBKDF2',
61 false,
62 ['deriveKey']
63 );
64
65 return crypto.subtle.deriveKey(
66 {
67 name: 'PBKDF2',
68 salt: PBKDF2_SALT,
69 iterations: PBKDF2_ITERATIONS,
70 hash: 'SHA-256',
71 },
72 keyMaterial,
73 { name: ALGORITHM, length: 256 },
74 false,
75 ['encrypt', 'decrypt']
76 );
77}
78
79// --- base64 helpers using platform-agnostic approach ---
80

Callers 8

loadContextFunction · 0.90
loadSdkContextFunction · 0.90
loadContextFunction · 0.90
persistCredentialFunction · 0.90
loadAdminContextFunction · 0.90
router.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected