(gene, capsule)
| 168 | } |
| 169 | |
| 170 | async function _publishBundle(gene, capsule) { |
| 171 | const nodeSecret = getHubNodeSecret(); |
| 172 | if (!nodeSecret) return { ok: false, error: 'missing_node_secret_after_hello' }; |
| 173 | const signatureInput = [gene.asset_id, capsule.asset_id].sort().join('|'); |
| 174 | const signature = crypto.createHmac('sha256', nodeSecret).update(signatureInput).digest('hex'); |
| 175 | const msg = { |
| 176 | protocol: 'gep-a2a', |
| 177 | protocol_version: '1.0.0', |
| 178 | message_type: 'publish', |
| 179 | message_id: 'msg_atp_' + crypto.randomBytes(8).toString('hex'), |
| 180 | timestamp: new Date().toISOString(), |
| 181 | sender_id: getNodeId(), |
| 182 | payload: { assets: [gene, capsule], signature: signature }, |
| 183 | }; |
| 184 | return _postJson(_publishUrl(), msg, PUBLISH_TIMEOUT_MS); |
| 185 | } |
| 186 | |
| 187 | async function _completeTaskOnHub(taskId, assetId) { |
| 188 | const base = String(getHubUrl() || '').replace(/\/+$/, ''); |
no test coverage detected