ramda#split TypeScript Examples

The following examples show how to use ramda#split. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: vaccinationQRHelper.ts    From back-home-safe with GNU General Public License v3.0 6 votes vote down vote up
qrDecode = async (input: string): Promise<DecodedJSON | null> => {
  try {
    const splitData = split("|", input);
    console.log("input:", splitData);

    // Invalid QR Code length
    if (splitData.length < 3) return null;

    const parseResult = parseData(splitData);
    console.log("CODE_SCANNER", "parseResult: ", parseResult);
    if (!parseResult) return null;
    const { schemaVersion, digitalSignature, stringToBeSigned } = parseResult;

    const publicKey = getPublicKey(schemaVersion) || digitalSignature;

    console.log("CODE_SCANNER", "digitalSignature: " + digitalSignature);
    console.log("CODE_SCANNER", "stringToBeSigned: " + stringToBeSigned);
    console.log("CODE_SCANNER", "publicKey: " + publicKey);

    const validationPass = await ecdsaVerify(
      stringToBeSigned,
      publicKey,
      digitalSignature
    );
    console.log("CODE_SCANNER", "validationPass: " + validationPass);
    if (!validationPass) return null;

    return parseResult;
  } catch (e) {
    console.log(e);
    return null;
  }
}