Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
add xspace-agent/packages/core/src/webhooks/signing.ts
oversteppinga38a82286e99
diff --git a/xspace-agent/packages/core/src/webhooks/signing.ts b/xspace-agent/packages/core/src/webhooks/signing.tsnew file mode 100644index 000000000..ae482476a--- /dev/null+++ b/xspace-agent/packages/core/src/webhooks/signing.ts@@ -0,0 +1,49 @@+// SPDX-License-Identifier: Apache-2.0+// Copyright 2026 nirholas (https://github.com/nirholas/xspace-agent) [§79]++// =============================================================================+// Webhooks — HMAC-SHA256 Signing & Verification+// =============================================================================++import { createHmac, randomBytes, timingSafeEqual } from 'crypto'++/**+ * Sign a webhook payload using HMAC-SHA256.+ *+ * The signed content is `${timestamp}.${JSON.stringify(payload)}` to prevent+ * replay attacks (timestamp is bound into the signature).+ */+export function signPayload(payload: unknown, secret: string, timestamp: number): string {+ const signedContent = `${timestamp}.${JSON.stringify(payload)}`+ const hmac = createHmac('sha256', secret).update(signedContent).digest('hex')+ return `sha256=${hmac}`+}++/**+ * Verify a webhook signature. Uses timing-safe comparison to prevent timing attacks.+ */+export function verifySignature(+ payload: unknown,+ signature: string,+ timestamp: number,+ secret: string,+): boolean {+ const expected = signPayload(payload, secret, timestamp)+ try {+ return timingSafeEqual(Buffer.from(signature), Buffer.from(expected))+ } catch {+ return false+ }+}++/** Generate a cryptographically secure webhook secret. */+export function generateWebhookSecret(): string {+ return `whsec_${randomBytes(32).toString('hex')}`+}++/** Generate a prefixed event ID. */+export function generateEventId(): string {+ return `evt_${randomBytes(16).toString('hex')}`+}++