src/index.js
/**
 * Base64 is an encoding to encode any set of bytes using only 64 characters. Usually this entails
 * the characters a-z, A-Z, 0-9, /, + and =. The characters /, + and = are not valid characters to be
 * used in URLs so Base64URL uses the _ instead of / and - instead of +. We also don't use any padding with
 * = because that character does not work in URLs.
 *
 * The function below checks that the string is Base64URL encoded and if not it will report the string to
 * the error log and die. This means that if any incorrect data is sent the execution will halt here and not
 * continue.
 */
Base64 is an encoding to encode any set of bytes using only 64 characters. Usually this entails
the characters a-z, A-Z, 0-9, /, + and =. The characters /, + and = are not valid characters to be
used in URLs so Base64URL uses the _ instead of / and - instead of +. We also don't use any padding with
= because that character does not work in URLs.

The function below checks that the string is Base64URL encoded and if not it will report the string to
the error log and die. This means that if any incorrect data is sent the execution will halt here and not
continue.
Base64 is an encoding to encode any set of bytes using only 64 characters . Usually this entails the characters a - z A - Z 0 - 9 / + and = . The characters / + and = are not valid characters to be used in URLs so Base64URL uses the _ instead of / and - instead of + . We also don ' t use any padding with = because that character does not work in URLs . The function below checks that the string is Base64URL encoded and if not it will report the string to the error log and die . This means that if any incorrect data is sent the execution will halt here and not continue .
function onlyAllowBase64URL(res, str) {
    if(!preg_match('/^[a-zA-Z0-9_-]*$/', str)) {
        console.log("Incorrect input " + str);
        exitWithErrorCode(res, TRANSIENT_ERROR);
    }
}
function onlyAllowBase64URL ( res , str ) { if ( ! preg_match ( '/^[a-zA-Z0-9_-]*$/' , str ) ) { console . log ( "Incorrect input " + str ) ; exitWithErrorCode ( res , TRANSIENT_ERROR ) ; } }
Base64 is an encoding to encode any set of bytes using only 64 characters.
Base64 is an encoding to encode any set of bytes using only 64 characters .