MCPcopy Create free account
hub / github.com/Eversmile12/sharedcontext / loadKey

Function loadKey

src/cli/init.ts:205–212  ·  view source on GitHub ↗
(passphrase: string)

Source from the content-addressed store, hash-verified

203 * Load the encryption key from salt + passphrase.
204 */
205export function loadKey(passphrase: string): Uint8Array {
206 if (!existsSync(SALT_PATH)) {
207 console.error("SharedContext not initialized. Run `sharedcontext init` first.");
208 process.exit(1);
209 }
210 const salt = new Uint8Array(readFileSync(SALT_PATH));
211 return deriveKey(passphrase, salt);
212}
213
214/**
215 * Load the identity private key (decrypts identity.enc with the derived key).

Callers 2

resolveIdentityFunction · 0.85
identityCommandFunction · 0.85

Calls 1

deriveKeyFunction · 0.85

Tested by

no test coverage detected