mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-24 20:26:24 +00:00
New attachment storage system
This commit is contained in:
@@ -11,7 +11,10 @@ export const MAC_KEY_SIZE = 32;
|
||||
|
||||
export const MAC_SIZE = 32;
|
||||
|
||||
export function appendMacStream(macKey: Uint8Array): Duplex {
|
||||
export function appendMacStream(
|
||||
macKey: Uint8Array,
|
||||
onMac?: (mac: Uint8Array) => undefined
|
||||
): Duplex {
|
||||
if (macKey.byteLength !== MAC_KEY_SIZE) {
|
||||
throw new Error('appendMacStream: invalid macKey length');
|
||||
}
|
||||
@@ -28,7 +31,9 @@ export function appendMacStream(macKey: Uint8Array): Duplex {
|
||||
},
|
||||
flush(callback) {
|
||||
try {
|
||||
callback(null, hmac.digest());
|
||||
const mac = hmac.digest();
|
||||
onMac?.(mac);
|
||||
callback(null, mac);
|
||||
} catch (error) {
|
||||
callback(error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user