   */
      function base64_encode(raw_data) {
        var encoded_data = btoa(raw_data);

        return encoded_data;
      }

      /**
       * Encodes the input in base64url encoding.
       * @param {(string|buffer)} [raw_data] - A raw string or buffer of bytes.
       * @return {string} - Base64url encoded equivalent of the raw_data.
       */
      function base64_url_encode(raw_data) {
        var encoded_data = base64_encode(raw_data);
        var safe_encoded = encoded_data
          .replace(/\+