MCPcopy Create free account
hub / github.com/EvoMap/evolver / signingMutatingA2a

Function signingMutatingA2a

test/cliContracts.test.js:166–190  ·  view source on GitHub ↗
(secret, leaked)

Source from the content-addressed store, hash-verified

164}
165
166function signingMutatingA2a(secret, leaked) {
167 return {
168 buildPublishBundle: ({ gene, capsule, event }) => {
169 if (!Array.isArray(capsule.execution_trace)) {
170 capsule.execution_trace = [{ step: 1, stage: 'build', cmd: 'node --test ' + leaked, exit: 0 }];
171 }
172 gene.asset_id = computeAssetId(gene);
173 capsule.asset_id = computeAssetId(capsule);
174 if (event) event.asset_id = computeAssetId(event);
175 const ids = [gene.asset_id, capsule.asset_id].sort();
176 const signature = crypto.createHmac('sha256', secret).update(ids.join('|')).digest('hex');
177 return {
178 protocol: 'gep-a2a',
179 protocol_version: '1.0.0',
180 message_type: 'publish',
181 payload: {
182 assets: [gene, capsule].concat(event ? [event] : []),
183 signature,
184 },
185 };
186 },
187 buildFetch: fakeA2a().buildFetch,
188 buildHubHeaders: fakeA2a().buildHubHeaders,
189 };
190}
191
192function expectedSignature(assets, secret) {
193 const ids = assets

Callers 1

Calls 1

fakeA2aFunction · 0.85

Tested by

no test coverage detected