Skip to content

Commit

Permalink
Merge pull request #5321 from EdgeApp/william/hmac-api-keys
Browse files Browse the repository at this point in the history
HMAC API keys
  • Loading branch information
swansontec authored Oct 25, 2024
2 parents ca17e75 + aa63545 commit b65a544
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion scripts/makeNativeHeaders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
6 changes: 3 additions & 3 deletions src/actions/NotificationActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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 }
Expand Down Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion src/components/services/EdgeCoreManager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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()}`,

Expand Down
6 changes: 5 additions & 1 deletion src/envConfig.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { asArray, asBoolean, asEither, asNumber, asObject, asOptional, asString, asValue, Cleaner } from 'cleaners'

import { asBase16 } from './util/cleaners/asHex'

function asNullable<T>(cleaner: Cleaner<T>): Cleaner<T | null> {
return function asNullable(raw) {
if (raw == null) return null
Expand Down Expand Up @@ -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'),
Expand Down
4 changes: 2 additions & 2 deletions src/util/PushClient/PushClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b65a544

Please sign in to comment.