diff --git a/lib/actions/upload-actions.js b/lib/actions/upload-actions.js --- a/lib/actions/upload-actions.js +++ b/lib/actions/upload-actions.js @@ -174,7 +174,7 @@ const { uploadInput, callbacks, keyserverOrThreadID } = input; const { encryptionKey, loop, dimensions, thumbHash, blobInput } = uploadInput; - const blobHolder = await generateBlobHolder(); + const blobHolder = generateBlobHolder(authMetadata.deviceID); const blobHash = toBase64URL(uploadInput.blobHash); const defaultHeaders = createDefaultHTTPRequestHeaders(authMetadata); diff --git a/lib/utils/blob-service.js b/lib/utils/blob-service.js --- a/lib/utils/blob-service.js +++ b/lib/utils/blob-service.js @@ -4,7 +4,6 @@ import uuid from 'uuid'; import { toBase64URL } from './base64.js'; -import { getContentSigningKey } from './crypto-utils.js'; import { replacePathParams, type URLPathParams } from './url-utils.js'; import type { BlobServiceHTTPEndpoint } from '../facts/blob-service.js'; import blobServiceConfig from '../facts/blob-service.js'; @@ -54,17 +53,15 @@ } /** - * Generates random blob holder prefixed by current device ID + * Generates random blob holder prefixed by current device ID if present */ -async function generateBlobHolder(): Promise { +function generateBlobHolder(deviceID?: ?string): string { const randomID = uuid.v4(); - try { - const deviceID = await getContentSigningKey(); - const urlSafeDeviceID = toBase64URL(deviceID); - return `${urlSafeDeviceID}:${randomID}`; - } catch { + if (!deviceID) { return randomID; } + const urlSafeDeviceID = toBase64URL(deviceID); + return `${urlSafeDeviceID}:${uuid.v4()}`; } export {