static async startChallenge()

in source/client/src/liveness/utils/APIUtils.ts [45:66]


  static async startChallenge(challengeType: string): Promise<ChallengeMetadata> {
    const path = ConfigUtils.getConfig().API_START_ENDPOINT;
    const init = {
      headers: await APIUtils.getAuthorizationHeader(),
      body: {
        imageWidth: MediaUtils.getMediaStreamInfo().actualWidth,
        imageHeight: MediaUtils.getMediaStreamInfo().actualHeight
      }
    };

    if (challengeType) {
      // @ts-ignore
      init.body["challengeType"] = challengeType;
    }

    LogUtils.info("startChallenge:");
    LogUtils.info(init);
    return API.post(ConfigUtils.getConfig().API_NAME, path, init).then(result => {
      LogUtils.info(result);
      return result;
    });
  }