@proposeflow/shared

v0.1.1

Published

Shared types and utilities for ProposeFlow

Readme

@proposeflow/shared

Shared types and utilities used across ProposeFlow packages.

Overview

This internal package provides:

  • Common TypeScript type definitions
  • Webhook signature generation and verification utilities
  • Shared constants and utilities

Usage

This package is used internally by other ProposeFlow packages:

import { verifyWebhookSignature, generateWebhookSignature } from '@proposeflow/shared';
import type { WebhookEvent, ProposalStatus } from '@proposeflow/shared';

Exports

Types

Common type definitions shared across the API, SDK, and other packages:

  • ProposalStatus - Proposal lifecycle states
  • WebhookEvent - Webhook event types and payloads
  • Schema - Schema definition types
  • Other shared interfaces

Webhook Utilities

// Generate a webhook signature (used by API)
const signature = generateWebhookSignature({
  body: JSON.stringify(payload),
  secret: webhookSecret,
  timestamp: Date.now(),
});

// Verify a webhook signature (used by SDK/consumers)
const result = verifyWebhookSignature({
  body: rawBody,
  signature: headers['x-proposeflow-signature'],
  timestamp: headers['x-proposeflow-timestamp'],
  secret: webhookSecret,
});

if (result.valid) {
  // Signature is valid
}

Development

# Build
pnpm build

# Watch mode
pnpm dev

# Type check
pnpm typecheck

Note

This is an internal package (private: true) and is not published to npm. It's consumed via pnpm workspace dependencies.