Playground Guide
Welcome to the Vaultys Playground! This interactive environment lets you test and experiment with P2P features directly in your browser without writing any code.
๐ฎ What is the Playground?โ
The Vaultys Playground is a fully-featured demo application that showcases:
- Identity Management: Create and manage decentralized identities (DIDs)
- P2P Chat: End-to-end encrypted messaging with file sharing
- Collaborative Canvas: Real-time collaborative drawing
- Document Collaboration: Shared document editing with live cursors
Access it at: /playground
๐ Getting Startedโ
Step 1: Create Your Identityโ
When you first open the playground, you'll need to create a decentralized identity:
- Navigate to /playground
- Enter a name for your identity (e.g., "Alice", "Bob", "Test User")
- Choose identity type:
- ๐ Software Key: Uses cryptographic keys stored locally
- ๐ Passkey: Uses WebAuthn/biometrics for enhanced security
- Click "Create Identity"
Your identity will be saved locally and can be reused across sessions.
Step 2: Select an Identityโ
Once you have identities created:
- Click on any identity from the list to select it
- The selected identity will be highlighted in blue
- You can manage multiple identities and switch between them
Step 3: Choose a Featureโ
With an identity selected, you can access two main features:
๐ฌ P2P Chatโ
Real-time encrypted messaging with:
- Contact management
- File and image sharing
- Read receipts
- Typing indicators
- Message history
๐จ Collaborative Canvas & Docsโ
Real-time collaboration with:
- Shared drawing canvas
- Rich text document editing
- Live cursor tracking
- Auto-save functionality
๐ฌ Using P2P Chatโ
Opening the Chatโ
- Select an identity in the playground
- Click "Open โ" next to P2P Chat
- The chat interface will open with your identity loaded
Adding Contactsโ
To chat with someone, you need to add them as a contact:
- Click the "โ" button in the contacts section
- Enter their DID (starts with
did:vaultys:) - Optionally add a nickname
- Click "Add Contact"
Tip: To test between two identities, open the playground in two different browser windows or tabs!
Sending Messagesโ
- Select a contact from your contact list
- Type your message in the input field
- Press Enter or click Send
Features:
- Text Messages: Regular text communication
- File Sharing: Click ๐ to attach files
- Images: Paste or upload images directly
- Emojis: Full emoji support ๐
Message Featuresโ
- Read Receipts: See when messages are delivered and read
- Typing Indicators: See when contacts are typing
- Timestamps: Hover over messages for exact time
- Status Indicators:
- ๐ข Contact online
- ๐ก Message pending
- โ Message delivered
- โโ Message read
File Sharingโ
To share files:
- Click the ๐ attachment button
- Select file(s) to share
- Files are encrypted and sent directly P2P
Supported:
- Documents (PDF, Word, Excel)
- Images (JPEG, PNG, GIF, WebP)
- Videos (MP4, WebM)
- Any file type up to 10MB
๐จ Using Collaborative Featuresโ
Creating/Joining a Roomโ
- Select an identity in the playground
- Click "Open โ" next to Collaborative Canvas & Docs
- Enter a room name or use the generated one
- Click "Connect"
Share the room name with others to collaborate!
Canvas Drawingโ
The collaborative canvas allows real-time drawing with multiple users:
Tools:
- Color Picker: Choose from 8 colors
- Brush Sizes: Small, medium, large
- Clear Canvas: Reset the drawing (owner only)
How to Draw:
- Select a color and brush size
- Click and drag to draw
- All participants see changes in real-time
- Live cursors show where others are drawing
Document Collaborationโ
Switch to "Document" mode for rich text editing:
Features:
- Rich Formatting: Bold, italic, underline
- Lists: Bullet points and numbered lists
- Headers: Multiple heading levels
- Colors: Text and background colors
- Live Cursors: See where others are typing
- Auto-save: Changes saved automatically
Collaborative Editing:
- Multiple users can edit simultaneously
- Each user has a unique cursor color
- Names appear above cursors
- Changes sync in real-time
Room Managementโ
As Room Owner:
- Clear the canvas
- Remove participants
- Control room settings
As Participant:
- View and edit content
- See other participants
- Leave room anytime
๐ง Advanced Featuresโ
Identity Managementโ
Creating Multiple Identities:
// Each identity has:
{
did: "did:vaultys:5GrwvaEF...", // Unique identifier
name: "Alice", // Display name
type: "software" | "webauthn", // Key type
createdAt: "2024-01-15T10:30:00Z", // Creation time
secret: "..." // Private key (encrypted)
}
Switching Identities:
- Click on any identity in the list
- The selected identity becomes active
- Open features with that identity
Deleting Identities:
- Click the ๐๏ธ icon next to an identity
- Confirm deletion
- Identity and associated data are removed
Network Configurationโ
The playground uses default settings, but in your own implementation you can configure:
{
relay: {
host: 'peerjs.92k.de', // Signaling server
secure: true, // Use HTTPS/WSS
port: 443, // Server port
path: '/' // Server path
},
storage: {
provider: 'browser', // Storage type
encryption: true // Encrypt stored data
}
}
Testing Scenariosโ
Single User Testing:
- Create two identities
- Open playground in two tabs
- Select different identity in each
- Test features between them
Multi-User Testing:
- Share your DID with others
- Have them add you as contact
- Test real P2P communication
- Try collaborative features
Network Testing:
- Test on different networks
- Test with mobile devices
- Test with VPNs
- Test offline/online scenarios
๐ Understanding the Displayโ
Status Indicatorsโ
- ๐ข Connected: Successfully connected to relay server
- ๐ก Connecting: Establishing connection
- ๐ด Disconnected: No connection to relay
- ๐ Reconnecting: Attempting to reconnect
Contact Statesโ
- Online: Contact is currently connected
- Offline: Contact is not connected
- Away: Contact is idle (future feature)
- Busy: Do not disturb (future feature)
Message Statesโ
- Sending: Message being transmitted
- Sent: Message left your device
- Delivered: Message reached recipient
- Read: Recipient viewed message
- Failed: Message couldn't be sent
๐ฏ Use Casesโ
Personal Chatโ
- Private conversations
- File sharing between devices
- Secure messaging
Team Collaborationโ
- Brainstorming on canvas
- Document collaboration
- Quick file transfers
Educationโ
- Interactive whiteboards
- Shared note-taking
- Real-time tutoring
Developmentโ
- Testing P2P features
- Debugging connections
- API exploration
๐ Troubleshootingโ
Can't Connectโ
- Check internet connection
- Verify browser supports WebRTC
- Try refreshing the page
- Check browser console for errors
Can't See Contact Onlineโ
- Ensure both users are connected
- Verify correct DIDs are used
- Check if contact was added properly
- Try reconnecting both clients
Messages Not Sendingโ
- Verify recipient is online
- Check connection status
- Ensure proper contact setup
- Look for error messages
Canvas Not Syncingโ
- Verify room name matches
- Check all users are connected
- Try rejoining the room
- Clear browser cache
Identity Issuesโ
- Backup identity secrets
- Don't clear browser data
- Export identities regularly
- Use consistent identity
๐ก Tips & Tricksโ
Performanceโ
- Close unused tabs
- Use modern browsers
- Clear old messages periodically
- Limit file sizes to < 10MB
Securityโ
- Never share your secret key
- Use passkeys when possible
- Verify contact DIDs
- Backup important identities
Collaborationโ
- Use descriptive room names
- Coordinate colors in canvas
- Take turns in documents
- Use chat for coordination
๐ Integration Examplesโ
Embedding in Your Appโ
<!-- Add to your HTML -->
<iframe
src="/playground/chat#did:vaultys:yourDID"
width="100%"
height="600px"
frameborder="0">
</iframe>
Programmatic Accessโ
// Use the same libraries
import { setupVaultysPeerSDK } from '@vaultys/peer-sdk';
import { VaultysId } from '@vaultys/id';
// Implement similar features
const identity = await VaultysId.generatePerson();
const peer = setupVaultysPeerSDK({
vaultysId: identity,
// ... configuration
});
API Compatibilityโ
The playground uses the same SDK APIs:
peerService.sendMessage()peerService.addContact()space.getArray()space.awareness
๐ Next Stepsโ
After exploring the playground:
- Build Your Own: Use the Quick Start Guide to build similar features
- Study the Code: Review the playground source code
- API Deep Dive: Explore the API Reference
- Deploy: Follow the Production Guide
๐ค Communityโ
- Share your playground creations
- Report bugs or issues
- Suggest new features
- Join our Discord
Happy experimenting! ๐