This commit is contained in:
ZacharyZhang-NY committed 2026-02-28 20:06:02 -05:00
1 parent deab4ebe1b
commit 88b19d4548
2 files changed
+5 -4

No files matched your search

+2
View File
@@ -118,11 +118,13 @@ async function cmdInstall(args: string[]): Promise<void> {
...(token ? { token } : {}), ...(token ? { token } : {}),
}; };
await fsp.writeFile(agentConfigPath, JSON.stringify(agentConfig, null, 2) + '\n', 'utf-8'); await fsp.writeFile(agentConfigPath, JSON.stringify(agentConfig, null, 2) + '\n', 'utf-8');
await fsp.chmod(agentConfigPath, 0o600);
console.log(` Agent config: ${agentConfigPath}`); console.log(` Agent config: ${agentConfigPath}`);
// Write private key (chmod 600) // Write private key (chmod 600)
const keyPath = path.join(agentsDir, `${agentName}.key`); const keyPath = path.join(agentsDir, `${agentName}.key`);
await fsp.writeFile(keyPath, privateKey, { encoding: 'utf-8', mode: 0o600 }); await fsp.writeFile(keyPath, privateKey, { encoding: 'utf-8', mode: 0o600 });
await fsp.chmod(keyPath, 0o600);
console.log(` Private key: ${keyPath}`); console.log(` Private key: ${keyPath}`);
// Generate and write hook script (PostToolUse — audit logging) // Generate and write hook script (PostToolUse — audit logging)
+3 -4
View File
@@ -151,8 +151,7 @@ export function derivePublicKey(privateKeyBase64url: string): string {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/** /**
* The initial chain hash value: SHA-256 of 32 zero bytes, base64url encoded. * The initial chain hash value: base64url encoding of 32 zero bytes.
* Must match the backend's GENESIS_CHAIN_HASH constant exactly.
*/ */
export const ZERO_CHAIN_HASH: string = base64urlEncode( export const ZERO_CHAIN_HASH: string = base64urlEncode(Buffer.alloc(32, 0));
crypto.createHash('sha256').update(Buffer.alloc(32, 0)).digest(),
);