
- Complete NestJS TypeScript implementation with WebSocket support - Direct messaging (DM) and group chat functionality - End-to-end encryption with AES encryption and key pairs - Media file support (images, videos, audio, documents) up to 100MB - Push notifications with Firebase Cloud Messaging integration - Mention alerts and real-time typing indicators - User authentication with JWT and Passport - SQLite database with TypeORM entities and relationships - Comprehensive API documentation with Swagger/OpenAPI - File upload handling with secure access control - Online/offline status tracking and presence management - Message editing, deletion, and reply functionality - Notification management with automatic cleanup - Health check endpoint for monitoring - CORS configuration for cross-origin requests - Environment-based configuration management - Structured for Flutter SDK integration Features implemented: ✅ Real-time messaging with Socket.IO ✅ User registration and authentication ✅ Direct messages and group chats ✅ Media file uploads and management ✅ End-to-end encryption ✅ Push notifications ✅ Mention alerts ✅ Typing indicators ✅ Message read receipts ✅ Online status tracking ✅ File access control ✅ Comprehensive API documentation Ready for Flutter SDK development and production deployment.
76 lines
1.5 KiB
JavaScript
76 lines
1.5 KiB
JavaScript
var tape = require('tape')
|
|
var Hash = require('../hash')
|
|
var hex = '0A1B2C3D4E5F6G7H'
|
|
|
|
function equal (t, a, b) {
|
|
t.equal(a.length, b.length)
|
|
t.equal(a.toString('hex'), b.toString('hex'))
|
|
}
|
|
|
|
var hexBuf = Buffer.from('0A1B2C3D4E5F6G7H', 'utf8')
|
|
var count16 = {
|
|
strings: ['0A1B2C3D4E5F6G7H'],
|
|
buffers: [
|
|
hexBuf,
|
|
Buffer.from('80000000000000000000000000000080', 'hex')
|
|
]
|
|
}
|
|
|
|
var empty = {
|
|
strings: [''],
|
|
buffers: [
|
|
Buffer.from('80000000000000000000000000000000', 'hex')
|
|
]
|
|
}
|
|
|
|
var multi = {
|
|
strings: ['abcd', 'efhijk', 'lmnopq'],
|
|
buffers: [
|
|
Buffer.from('abcdefhijklmnopq', 'ascii'),
|
|
Buffer.from('80000000000000000000000000000080', 'hex')
|
|
]
|
|
}
|
|
|
|
var long = {
|
|
strings: [hex + hex],
|
|
buffers: [
|
|
hexBuf,
|
|
hexBuf,
|
|
Buffer.from('80000000000000000000000000000100', 'hex')
|
|
]
|
|
}
|
|
|
|
function makeTest (name, data) {
|
|
tape(name, function (t) {
|
|
var h = new Hash(16, 8)
|
|
var hash = Buffer.alloc(20)
|
|
var n = 2
|
|
var expected = data.buffers.slice()
|
|
// t.plan(expected.length + 1)
|
|
|
|
h._update = function (block) {
|
|
var e = expected.shift()
|
|
equal(t, block, e)
|
|
|
|
if (n < 0) {
|
|
throw new Error('expecting only 2 calls to _update')
|
|
}
|
|
}
|
|
h._hash = function () {
|
|
return hash
|
|
}
|
|
|
|
data.strings.forEach(function (string) {
|
|
h.update(string, 'ascii')
|
|
})
|
|
|
|
equal(t, h.digest(), hash)
|
|
t.end()
|
|
})
|
|
}
|
|
|
|
makeTest('Hash#update 1 in 1', count16)
|
|
makeTest('empty Hash#update', empty)
|
|
makeTest('Hash#update 1 in 3', multi)
|
|
makeTest('Hash#update 2 in 1', long)
|