Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3357826
D12446.id41377.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D12446.id41377.diff
View Options
diff --git a/native/media/encryption-utils.js b/native/media/encryption-utils.js
--- a/native/media/encryption-utils.js
+++ b/native/media/encryption-utils.js
@@ -22,7 +22,10 @@
import { isBlobServiceURI } from 'lib/utils/blob-service.js';
import { getMessageForException } from 'lib/utils/errors.js';
import { pad, unpad, calculatePaddedLength } from 'lib/utils/pkcs7-padding.js';
-import { createDefaultHTTPRequestHeaders } from 'lib/utils/services-utils.js';
+import {
+ createDefaultHTTPRequestHeaders,
+ usingCommServicesAccessToken,
+} from 'lib/utils/services-utils.js';
import { temporaryDirectoryPath } from './file-utils.js';
import { getFetchableURI } from './identifier-utils.js';
@@ -407,10 +410,27 @@
) => Promise<FetchAndDecryptMediaOutput> {
const identityContext = React.useContext(IdentityClientContext);
invariant(identityContext, 'Identity context should be set');
-
- return React.useCallback(async (blobURI, encryptionKey, options) => {
- return fetchAndDecryptMedia(blobURI, encryptionKey, undefined, options);
- }, []);
+ const { getAuthMetadata } = identityContext;
+
+ return React.useCallback(
+ async (blobURI, encryptionKey, options) => {
+ let authMetadata;
+ if (usingCommServicesAccessToken) {
+ try {
+ authMetadata = await getAuthMetadata();
+ } catch (err) {
+ console.warn('Failed to get auth metadata:', err);
+ }
+ }
+ return fetchAndDecryptMedia(
+ blobURI,
+ encryptionKey,
+ authMetadata,
+ options,
+ );
+ },
+ [getAuthMetadata],
+ );
}
function encryptBase64(
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 25, 1:49 AM (19 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2577745
Default Alt Text
D12446.id41377.diff (1 KB)
Attached To
Mode
D12446: [native] Send CSAT when fetching blob service media
Attached
Detach File
Event Timeline
Log In to Comment