diff --git a/scripts/makeNativeHeaders.ts b/scripts/makeNativeHeaders.ts index cbdb35277b8..b60653f9ea0 100644 --- a/scripts/makeNativeHeaders.ts +++ b/scripts/makeNativeHeaders.ts @@ -7,7 +7,7 @@ function makeNativeHeaders() { // Grab the API key: let apiKey = 'Error: Set up env.json & re-run scripts/makeNativeHeaders.js' try { - apiKey = require('../env.json').AIRBITZ_API_KEY + apiKey = require('../env.json').EDGE_API_KEY } catch (e) { console.log(apiKey) } diff --git a/src/actions/NotificationActions.ts b/src/actions/NotificationActions.ts index 5c72ac2644c..1131a1bb692 100644 --- a/src/actions/NotificationActions.ts +++ b/src/actions/NotificationActions.ts @@ -46,7 +46,7 @@ export function registerNotificationsV2(changeFiat: boolean = false): ThunkActio .catch(() => '') const body = { - apiKey: ENV.AIRBITZ_API_KEY, + apiKey: ENV.EDGE_API_KEY, deviceId: state.core.context.clientId, deviceToken, loginId: base64.stringify(base58.parse(state.core.account.rootLoginId)) @@ -193,7 +193,7 @@ async function updateServerSettings(context: EdgeContext, data: DeviceUpdatePayl .catch(() => '') const body = { - apiKey: ENV.AIRBITZ_API_KEY, + apiKey: ENV.EDGE_API_KEY, deviceId, deviceToken, data: { ...data, loginIds } @@ -279,7 +279,7 @@ async function legacyGet(path: string) { method: 'GET', headers: { 'Content-Type': 'application/json', - 'X-Api-Key': ENV.AIRBITZ_API_KEY + 'X-Api-Key': ENV.EDGE_API_KEY } }) if (response != null && response.ok) { diff --git a/src/components/services/EdgeCoreManager.tsx b/src/components/services/EdgeCoreManager.tsx index d4669143962..294201b6cdb 100644 --- a/src/components/services/EdgeCoreManager.tsx +++ b/src/components/services/EdgeCoreManager.tsx @@ -29,7 +29,8 @@ const SYNC_TEST_SERVER = 'https://sync-tester-us1.edge.app' interface Props {} const contextOptions: EdgeContextOptions = { - apiKey: ENV.AIRBITZ_API_KEY, + apiKey: ENV.EDGE_API_KEY, + apiSecret: ENV.EDGE_API_SECRET, appId: '', deviceDescription: `${getBrand()} ${getDeviceId()}`, diff --git a/src/envConfig.ts b/src/envConfig.ts index 5231e1a7fa3..4bf3d927afa 100644 --- a/src/envConfig.ts +++ b/src/envConfig.ts @@ -1,5 +1,7 @@ import { asArray, asBoolean, asEither, asNumber, asObject, asOptional, asString, asValue, Cleaner } from 'cleaners' +import { asBase16 } from './util/cleaners/asHex' + function asNullable(cleaner: Cleaner): Cleaner { return function asNullable(raw) { if (raw == null) return null @@ -29,7 +31,9 @@ const asEvmApiKeys = asObject({ export const asEnvConfig = asObject({ // API keys: - AIRBITZ_API_KEY: asOptional(asString, ''), + EDGE_API_KEY: asOptional(asString, ''), + EDGE_API_SECRET: asOptional(asBase16), + COINGECKO_API_KEY: asOptional(asString, 'a0000000000000000000000000000000'), IP_API_KEY: asOptional(asString, ''), SENTRY_DSN_URL: asOptional(asString, 'SENTRY_DSN_URL'), diff --git a/src/util/PushClient/PushClient.ts b/src/util/PushClient/PushClient.ts index 33ba7def846..6500f8e6e4c 100644 --- a/src/util/PushClient/PushClient.ts +++ b/src/util/PushClient/PushClient.ts @@ -13,7 +13,7 @@ import { import { ENV } from '../../env' import { base58 } from '../encoding' -const { ACTION_QUEUE, AIRBITZ_API_KEY } = ENV +const { ACTION_QUEUE, EDGE_API_KEY } = ENV const { pushServerUri } = ACTION_QUEUE export interface PushClient { @@ -46,7 +46,7 @@ export const makePushClient = (account: EdgeAccount, clientId: string): PushClie getPushRequestBody(payload?: LoginUpdatePayload): PushRequestBody { const data = payload != null ? wasLoginUpdatePayload(payload) : undefined return { - apiKey: AIRBITZ_API_KEY, + apiKey: EDGE_API_KEY, deviceId: clientId, loginId: base58.parse(account.rootLoginId), data