diff --git a/lib/utils/services-utils.js b/lib/utils/services-utils.js index 684f44431..c22609665 100644 --- a/lib/utils/services-utils.js +++ b/lib/utils/services-utils.js @@ -1,52 +1,52 @@ // @flow import base64 from 'base-64'; import type { AuthMetadata } from '../shared/identity-client-context.js'; // If this is true then we're using the identity service for auth. After we // auth, the identity service gives us a CSAT, which we can use to auth with // other Comm services. -const usingCommServicesAccessToken = false; +const usingCommServicesAccessToken = true; // If this is true, then the app is able to support multiple keyservers. This // requires the use of Tunnelbroker and the backup service to persist and sync // the KeyserverStore. const supportingMultipleKeyservers = false; // If this is false, then the app no longer needs to rely on being connected to // an authoritative keyserver for things like DMs. const relyingOnAuthoritativeKeyserver = true; function handleHTTPResponseError(response: Response): void { if (!response.ok) { const { status, statusText } = response; throw new Error(`Server responded with HTTP ${status}: ${statusText}`); } } function createHTTPAuthorizationHeader(authMetadata: AuthMetadata): string { // explicit destructure to make it future-proof const { userID, deviceID, accessToken } = authMetadata; const payload = JSON.stringify({ userID, deviceID, accessToken }); const base64EncodedPayload = base64.encode(payload); return `Bearer ${base64EncodedPayload}`; } function createDefaultHTTPRequestHeaders(authMetadata: AuthMetadata): { [string]: string, } { const authorization = createHTTPAuthorizationHeader(authMetadata); return { Authorization: authorization, }; } export { handleHTTPResponseError, usingCommServicesAccessToken, supportingMultipleKeyservers, relyingOnAuthoritativeKeyserver, createHTTPAuthorizationHeader, createDefaultHTTPRequestHeaders, };