mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-24 12:19:41 +00:00
@@ -1,21 +1,14 @@
|
||||
/* global dcodeIO, crypto */
|
||||
/* global crypto */
|
||||
|
||||
const { isFunction, isNumber } = require('lodash');
|
||||
const { createLastMessageUpdate } = require('../../../ts/types/Conversation');
|
||||
const { arrayBufferToBase64, base64ToArrayBuffer } = require('../crypto');
|
||||
|
||||
async function computeHash(arraybuffer) {
|
||||
const hash = await crypto.subtle.digest({ name: 'SHA-512' }, arraybuffer);
|
||||
return arrayBufferToBase64(hash);
|
||||
}
|
||||
|
||||
function arrayBufferToBase64(arraybuffer) {
|
||||
return dcodeIO.ByteBuffer.wrap(arraybuffer).toString('base64');
|
||||
}
|
||||
|
||||
function base64ToArrayBuffer(base64) {
|
||||
return dcodeIO.ByteBuffer.wrap(base64, 'base64').toArrayBuffer();
|
||||
}
|
||||
|
||||
function buildAvatarUpdater({ field }) {
|
||||
return async (conversation, data, options = {}) => {
|
||||
if (!conversation) {
|
||||
|
||||
Reference in New Issue
Block a user