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

Function loadIdentityPrivateKey

src/cli/init.ts:217–224  ·  view source on GitHub ↗
(key: Uint8Array)

Source from the content-addressed store, hash-verified

215 * Load the identity private key (decrypts identity.enc with the derived key).
216 */
217export function loadIdentityPrivateKey(key: Uint8Array): Uint8Array {
218 if (!existsSync(IDENTITY_PATH)) {
219 console.error("No identity found. Run `sharedcontext init` first.");
220 process.exit(1);
221 }
222 const encrypted = new Uint8Array(readFileSync(IDENTITY_PATH));
223 return decrypt(encrypted, key);
224}
225
226export function getSharedContextDir(): string {
227 return SHAREDCONTEXT_DIR;

Callers 2

resolveIdentityFunction · 0.85
identityCommandFunction · 0.85

Calls 1

decryptFunction · 0.85

Tested by

no test coverage detected