This commit is contained in:
@ -33,14 +33,14 @@ export class SignalClient {
|
||||
this.authKey = authKey;
|
||||
}
|
||||
|
||||
static async create(userId) {
|
||||
static create(userId) {
|
||||
const client = new SignalClient(userId);
|
||||
console.log(`SignalClient initialized for user: ${userId}`);
|
||||
return client;
|
||||
}
|
||||
|
||||
// Encrypt using AES-GCM with authentication
|
||||
async encrypt(message) {
|
||||
encrypt(message) {
|
||||
try {
|
||||
// Generate a random IV
|
||||
const iv = crypto.randomBytes(12);
|
||||
@ -75,7 +75,7 @@ export class SignalClient {
|
||||
}
|
||||
|
||||
// Decrypt the message
|
||||
async decrypt(encryptedMessage) {
|
||||
decrypt(encryptedMessage) {
|
||||
try {
|
||||
const payload = JSON.parse(
|
||||
Buffer.from(encryptedMessage.body, "base64").toString(),
|
||||
|
Reference in New Issue
Block a user