.cursor/skills/signal-protocol-integration/SKILL.md
--- name: signal-protocol-integration description: Guides Signal protocol integration: encryption/decryption, key management, session management, FFI bindings, security best practices. Use when implementing encryption, secure communication, or Signal protocol features. --- # Signal Protocol Integration ## Core Purpose Signal protocol provides end-to-end encryption for secure communication in AI2AI system. ## Key Components ### Signal Protocol Service - Encryption/decryption - Key management
npx skillsauth add avra-cadavra/avrai .cursor/skills/signal-protocol-integrationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Signal protocol provides end-to-end encryption for secure communication in AI2AI system.
import 'package:avrai/core/crypto/signal/signal_protocol_service.dart';
class SecureCommunicationService {
final SignalProtocolService _signalService;
SecureCommunicationService({
required SignalProtocolService signalService,
}) : _signalService = signalService;
/// Encrypt message using Signal protocol
Future<EncryptedMessage> encryptMessage({
required String recipientId,
required String message,
}) async {
// Get or create session with recipient
await _signalService.ensureSession(recipientId);
// Encrypt message
final encrypted = await _signalService.encryptMessage(
recipientId: recipientId,
plaintext: message,
);
return EncryptedMessage(
recipientId: recipientId,
ciphertext: encrypted,
timestamp: DateTime.now(),
);
}
/// Decrypt message using Signal protocol
Future<String> decryptMessage({
required String senderId,
required String ciphertext,
}) async {
final decrypted = await _signalService.decryptMessage(
senderId: senderId,
ciphertext: ciphertext,
);
return decrypted;
}
}
/// Signal Key Manager
///
/// Manages Signal protocol keys: identity keys, pre-keys, signed pre-keys
class SignalKeyManager {
final SignalProtocolService _signalService;
/// Generate and store identity key pair
Future<void> initializeKeys() async {
await _signalService.generateIdentityKeyPair();
}
/// Get pre-key bundle for new session
Future<PreKeyBundle> getPreKeyBundle(String userId) async {
return await _signalService.getPreKeyBundle(userId);
}
/// Rotate pre-keys (security best practice)
Future<void> rotatePreKeys() async {
await _signalService.rotatePreKeys();
}
}
/// Signal Session Manager
///
/// Manages Signal protocol sessions with other devices
class SignalSessionManager {
final SignalProtocolService _signalService;
/// Establish session with device
Future<void> establishSession({
required String deviceId,
required PreKeyBundle preKeyBundle,
}) async {
await _signalService.createSession(
deviceId: deviceId,
preKeyBundle: preKeyBundle,
);
}
/// Check if session exists
Future<bool> hasSession(String deviceId) async {
return await _signalService.hasSession(deviceId);
}
}
Signal protocol uses Rust FFI bindings:
import 'package:avrai/core/crypto/signal/signal_ffi_bindings.dart';
/// Use FFI bindings for Signal protocol operations
final bindings = SignalFFIBindings.instance;
// Initialize Signal protocol
await bindings.initialize();
// Use Signal protocol functions
final encrypted = await bindings.encrypt(plaintext, recipientId);
lib/core/crypto/signal/signal_protocol_service.dartlib/core/crypto/signal/signal_key_manager.dartlib/core/crypto/signal/signal_session_manager.dartlib/core/crypto/signal/signal_ffi_bindings.dartdevelopment
--- name: world-model-development description: Guides world model development patterns: state/action encoders, ONNX inference, feature extraction pipeline, latency budgets. Use when implementing world model components, state encoders, action encoders, feature extractors, or ONNX models. Core skill for Phases 3-6. --- # World Model Development Patterns ## Core Principle All world model components follow LeCun's autonomous machine intelligence framework. State observations flow through a percep
tools
Implements base workflow controller patterns for multi-step processes. Use when creating complex workflows that require orchestration of multiple steps with error handling and rollback.
testing
--- name: widget-test-patterns description: Guides widget test patterns: BLoC testing, user interactions, state changes, material app setup. Use when writing widget tests, testing UI components, or validating widget behavior. --- # Widget Test Patterns ## Core Pattern Widget tests verify UI behavior: user interactions, state changes, and visual display. ## Basic Widget Test Setup ```dart testWidgets('widget displays correctly', (WidgetTester tester) async { // Arrange: Create widget awa
testing
--- name: test-template-generation description: Generates test templates: unit, widget, integration, service tests following project patterns. Use when creating new tests or ensuring tests follow project standards. --- # Test Template Generation ## Available Templates Test templates are located in `test/templates/`: - `unit_test_template.dart` - `widget_test_template.dart` - `integration_test_template.dart` - `service_test_template.dart` ## Unit Test Template ```dart /// SPOTS Component Uni