Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

Commit

Permalink
Merge pull request #758 from cds-snc/feature/transmission_risk_level_…
Browse files Browse the repository at this point in the history
…refactoring

Removing TRANSMISSION_RISK_LEVEL from .env and setting it as a const.
  • Loading branch information
timarney committed Jul 17, 2020
2 parents ccf3fcf + c253559 commit d836997
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
1 change: 0 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ SUBMIT_URL=https://submission.covidshield.app
RETRIEVE_URL=https://retrieval.covidshield.app
HMAC_KEY=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
MCC_CODE=302
TRANSMISSION_RISK_LEVEL=2

TEST_MODE=false
MOCK_SERVER=false
2 changes: 0 additions & 2 deletions src/env/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ export const HMAC_KEY = Config.HMAC_KEY;

export const MCC_CODE = parseInt(Config.MCC_CODE, 10) || 302;

export const TRANSMISSION_RISK_LEVEL = parseInt(Config.TRANSMISSION_RISK_LEVEL, 10);

export const TEST_MODE = Config.TEST_MODE === 'true' || false;

export const MOCK_SERVER = Config.MOCK_SERVER === 'true' || false;
7 changes: 3 additions & 4 deletions src/services/BackendService/BackendService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {TemporaryExposureKey} from 'bridge/ExposureNotification';
import nacl from 'tweetnacl';
import {getRandomBytes, downloadDiagnosisKeysFile} from 'bridge/CovidShield';
import {blobFetch} from 'shared/fetch';
import {MCC_CODE, TRANSMISSION_RISK_LEVEL} from 'env';
import {MCC_CODE} from 'env';
import {captureMessage, captureException} from 'shared/log';
import {getMillisSinceUTCEpoch} from 'shared/date-fns';

Expand All @@ -18,6 +18,7 @@ import {BackendInterface, SubmissionKeySet} from './types';

const MAX_UPLOAD_KEYS = 14;
const FETCH_HEADERS = {headers: {'Cache-Control': 'no-store'}};
const TRANSMISSION_RISK_LEVEL = 1;

// See https://github.com/cds-snc/covid-shield-server/pull/176
const LAST_14_DAYS_PERIOD = '00000';
Expand Down Expand Up @@ -104,9 +105,7 @@ export class BackendService implements BackendInterface {
keys: exposureKeys.map(key =>
covidshield.TemporaryExposureKey.create({
keyData: Buffer.from(key.keyData, 'base64'),
transmissionRiskLevel:
TRANSMISSION_RISK_LEVEL ||
key.transmissionRiskLevel /* See transmissionRiskLevel https://developers.google.com/android/exposure-notifications/exposure-notifications-api#temporaryexposurekey */,
transmissionRiskLevel: TRANSMISSION_RISK_LEVEL,
rollingStartIntervalNumber: key.rollingStartIntervalNumber,
rollingPeriod: key.rollingPeriod,
}),
Expand Down

0 comments on commit d836997

Please sign in to comment.