Skip to main content

Vaultys Peer SDK Overview

A decoupled, reusable SDK for peer-to-peer communication built on WebRTC. This SDK provides a clean, interface-based architecture for building peer-to-peer applications with support for messaging, file sharing, audio/video calls, and group communication.

๐Ÿš€ Why Vaultys Peer SDK?โ€‹

The Challenge of P2P Developmentโ€‹

Building peer-to-peer applications traditionally requires:

  • Deep understanding of WebRTC complexities
  • NAT traversal and STUN/TURN configuration
  • Connection management and state handling
  • Implementing reconnection logic
  • Building message protocols from scratch
  • Handling edge cases and network failures

Our Solutionโ€‹

Vaultys Peer SDK abstracts away these complexities while maintaining flexibility:

  • Batteries Included: Powered by VaultysId for enterprise-grade DID management
  • Scale Effortlessly: Lazy loading enables managing thousands of peers with zero overhead
  • Your Infrastructure: Bring your own signaling server for complete control
  • Developer First: Clean APIs, TypeScript support, and comprehensive documentation

โœจ Key Featuresโ€‹

๐Ÿ”‹ Powered by VaultysIdโ€‹

Built on VaultysId, the leading open-source Decentralized Identity System. Get W3C-compliant DIDs, verifiable credentials, and key management out of the box. Passkey and FIDO2 authentication has never been so easy! Enable passwordless login with just one line of code - your users can authenticate with fingerprint, Face ID, or security keys.

โšก Lazy Loading Magicโ€‹

Manage thousands of peers without performance impact. Connections are established only when messages are exchanged, making it perfect for large-scale applications.

๐Ÿ—๏ธ Infrastructure Flexibilityโ€‹

  • Bring your own signaling server today
  • Configure custom STUN/TURN servers
  • Deploy on-premise or in the cloud
  • Coming Soon: Bring your own DID system

๐Ÿ” Security Firstโ€‹

  • Passwordless authentication with passkeys/FIDO2
  • Biometric and security key support
  • End-to-end encryption support
  • DID-based authentication
  • No central message storage
  • Privacy by design

๐Ÿ“ฆ TypeScript Nativeโ€‹

Full TypeScript support with comprehensive type definitions, enabling better IDE support and catching errors at compile time.

๐ŸŽฏ Perfect Forโ€‹

Applicationsโ€‹

  • ๐Ÿ’ฌ Chat Applications: WhatsApp-like messaging with E2E encryption
  • ๐Ÿ“ File Sharing: Dropbox-style sharing without the middleman
  • ๐ŸŽฎ Multiplayer Games: Low-latency networking for real-time gameplay
  • ๐Ÿ“น Video Conferencing: Zoom-like calls with WebRTC
  • ๐Ÿค Collaboration Tools: Real-time collaborative editing
  • ๐Ÿ”’ Secure Communications: Private channels for sensitive data

Industriesโ€‹

  • Healthcare: HIPAA-compliant peer-to-peer communication
  • Finance: Secure document sharing and communication
  • Education: Virtual classrooms and study groups
  • Gaming: Multiplayer game networking
  • Enterprise: Internal communication tools

๐Ÿ—๏ธ Architectureโ€‹

The SDK follows a modular, interface-based architecture:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Your Application โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Vaultys Peer SDK โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ PeerService โ”‚ Storage โ”‚ Event Bus โ”‚
โ”‚ โ”‚ Provider โ”‚ โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ PeerJS โ”‚ IndexedDB โ”‚ EventEmitter โ”‚
โ”‚ WebRTC โ”‚ OPFS โ”‚ โ”‚
โ”‚ VaultysId โ”‚ Memory โ”‚ โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Core Componentsโ€‹

  • PeerService: Main service for peer management and operations
  • VaultysPeer: Individual peer connection handling with auto-reconnection
  • Storage Provider: Pluggable interface supporting any storage backend
  • Event Bus: Decoupled event system for reactive applications
  • Message Queue: Reliable message delivery with offline support
  • Health Monitor: Real-time connection health tracking

๐Ÿ“ˆ Performance & Scaleโ€‹

Benchmarksโ€‹

  • Connection Time: < 1 second average
  • Message Latency: 10-50ms typical (network dependent)
  • Concurrent Peers: 1000+ supported with lazy loading
  • Memory Usage: ~2MB base + ~100KB per active connection
  • File Transfer: Limited only by bandwidth

Optimization Featuresโ€‹

  • Connection pooling
  • Automatic reconnection with exponential backoff
  • Message queuing for offline peers
  • Lazy connection establishment
  • Efficient binary data transfer

๐Ÿ› ๏ธ Technology Stackโ€‹

  • WebRTC: For peer-to-peer communication
  • PeerJS: Simplified WebRTC wrapper
  • VaultysId: Decentralized identity management
  • TypeScript: Type-safe development
  • Node.js & Browser: Cross-platform support

๐ŸŽจ Design Principlesโ€‹

  1. Simple by Default, Powerful When Needed

    • Get started with minimal configuration
    • Advanced features available when required
  2. Interface-Based Architecture

    • Swap implementations without changing code
    • Extend functionality through plugins
  3. Developer Experience First

    • Comprehensive documentation
    • Clear error messages
    • Extensive examples
  4. Privacy & Security

    • No central servers for messages
    • End-to-end encryption support
    • User-controlled data
  5. Production Ready

    • Battle-tested in real applications
    • Automatic error recovery
    • Health monitoring

๐Ÿšฆ Getting Startedโ€‹

Quick Installationโ€‹

# npm
npm install @vaultys/peer-sdk

# yarn
yarn add @vaultys/peer-sdk

# pnpm
pnpm add @vaultys/peer-sdk

Your First P2P Appโ€‹

import { setupVaultysPeerSDK } from '@vaultys/peer-sdk';
import { VaultysId } from '@vaultys/id';

// Authenticate with passkey - incredibly simple!
const identity = await VaultysId.authenticate({
passkey: true // That's it! Biometric/security key auth
});

// Initialize with authenticated identity
const peer = setupVaultysPeerSDK({ identity });
await peer.initialize(identity.did);

// Connect to a friend (lazy - no connection yet!)
const friend = await peer.addContact('did:vaultys:bob');

// Send a message (connection established now!)
await peer.sendMessage(friend.did, 'Hello P2P World! ๐ŸŒ');

// Listen for messages
peer.on('message-received', (msg) => {
console.log(`${msg.from}: ${msg.content}`);
});

๐Ÿ“š Documentationโ€‹

๐Ÿค Community & Supportโ€‹

Get Helpโ€‹

Stay Updatedโ€‹

๐Ÿ† Why Choose Vaultys Peer SDK?โ€‹

FeatureVaultys Peer SDKTraditional WebRTCOther P2P SDKs
Passkey/FIDO2 Authโœ… One-line setupโŒ Not includedโŒ Not included
DID Integrationโœ… Built-in VaultysIdโŒ Manual setupโš ๏ธ Limited
Lazy Loadingโœ… 1000+ peersโŒ Not supportedโš ๏ธ Limited scale
Custom Signalingโœ… Full controlโœ… Manual configโŒ Locked-in
TypeScriptโœ… Nativeโš ๏ธ Variesโš ๏ธ Varies
Storage Flexibilityโœ… PluggableโŒ DIYโŒ Fixed
Documentationโœ… Comprehensiveโš ๏ธ Technicalโš ๏ธ Basic
Enterprise Readyโœ… Production testedโš ๏ธ Requires workโŒ Limited

๐Ÿ“„ Licenseโ€‹

MIT License - See LICENSE for details.


Ready to build amazing P2P applications? Get Started Now โ†’