@digitaldefiance/eecp-protocol
v0.1.1
Published
Core types and protocol definitions for the Ephemeral Encrypted Collaboration Protocol (EECP)
Maintainers
Readme
@digitaldefiance/eecp-protocol
Core types and protocol definitions for EECP (Ephemeral Encrypted Collaboration Protocol).
Overview
This package defines the foundational types, interfaces, and protocol specifications used across the entire EECP system. It provides workspace configuration, encrypted operations, WebSocket message envelopes, and all shared interfaces for zero-knowledge ephemeral collaboration.
Features
- Type Definitions: WorkspaceId, ParticipantId, OperationId type definitions
- Temporal Scheduling: TimeWindow and temporal key scheduling interfaces
- Operation Structures: EncryptedOperation and CRDT operation structures
- Protocol Types: WebSocket message envelopes and protocol types
- Workspace Metadata: Shared interfaces for workspace metadata and configuration
Installation
npm install @digitaldefiance/eecp-protocol
# or
yarn add @digitaldefiance/eecp-protocolUsage
import {
WorkspaceId,
ParticipantId,
WorkspaceConfig,
MessageEnvelope,
CRDTOperation,
EncryptedOperation,
} from '@digitaldefiance/eecp-protocol';
// Define a workspace configuration
const config: WorkspaceConfig = {
id: workspaceId,
createdAt: Date.now(),
expiresAt: Date.now() + 30 * 60 * 1000, // 30 minutes
timeWindow: {
startTime: Date.now(),
endTime: Date.now() + 30 * 60 * 1000,
rotationInterval: 15, // 15 minutes
gracePeriod: 60 * 1000, // 1 minute
},
maxParticipants: 50,
allowExtension: false,
};
// Create a message envelope
const envelope: MessageEnvelope = {
type: 'operation',
payload: operationMessage,
timestamp: Date.now(),
messageId: crypto.randomUUID(),
};Key Types
WorkspaceConfig
Defines the configuration for an ephemeral workspace:
id: Unique workspace identifiercreatedAt: Workspace creation timestampexpiresAt: Workspace expiration timestamptimeWindow: Temporal key rotation schedulemaxParticipants: Maximum number of concurrent participantsallowExtension: Whether workspace duration can be extended
TimeWindow
Defines the temporal key rotation schedule:
startTime: When the workspace becomes activeendTime: When the workspace expiresrotationInterval: How often keys rotate (in minutes)gracePeriod: Grace period for key transitions (in milliseconds)
CRDTOperation
Represents a CRDT operation:
id: Unique operation identifierparticipantId: Who created the operationtimestamp: When the operation was createdtype: Operation type ('insert' or 'delete')position: Position in the documentcontent: Text content (for insert operations)length: Length (for delete operations)
EncryptedOperation
Represents an encrypted CRDT operation:
id: Unique operation identifierworkspaceId: Which workspace this belongs toparticipantId: Who created the operationtimestamp: When the operation was createdposition: Position in the documentoperationType: Type of operationencryptedContent: Encrypted operation payloadsignature: ECDSA signature for authenticity
MessageEnvelope
WebSocket message wrapper:
type: Message type (handshake, operation, sync_request, etc.)payload: Message-specific payloadtimestamp: When the message was createdmessageId: Unique message identifier
Message Types
handshake: Initial connection authenticationhandshake_ack: Server acknowledgment of handshakechallenge: Server challenge for authenticationoperation: CRDT operation broadcastoperation_ack: Server acknowledgment of operationsync_request: Request for operation historysync_response: Response with operation historyerror: Error messageping/pong: Connection keep-alive
License
MIT
Repository
https://github.com/Digital-Defiance/digitaldefiance-eecp
