<commit_before>/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

var P = require('../promise')
var crypto = require('crypto')

var TOKEN_LENGTH = 66

/**
 *
 * @param {String} token Hex content token
 * @param {Object} headers Request headers
 * @param {Object} contentTokenConfig Configuration object for the content token
 * @returns {Promise} resolve to 'true' if token is valid, 'false' if not.
 */
function validateContentToken(token, headers, contentTokenConfig) {
  // if contentToken check is not required then we say check is valid
  if (! contentTokenConfig.required) {<commit_msg>fix(contentToken): fix docs<commit_after>/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

var P = require('../promise')
var crypto = require('crypto')

var TOKEN_LENGTH = 66

/**
 *
 * @param {String} token Hex content token
 * @param {Object} headers Request headers
 * @param {Object} contentTokenConfig Configuration object for the content token
 * @returns {Promise} resolves Object 'valid' and 'reason'
 *
 */
function validateContentToken(token, headers, contentTokenConfig) {
  // if contentToken check is not required then we say check is valid
  if (! contentTokenConfig.required) {
{'fraction_non_alphanumeric': 0.10434782608695652, 'fraction_numerical': 0.008026755852842809, 'mean_word_length': 4.1058020477815695, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4893882', 'n_tokens_mistral': 426, 'n_tokens_neox': 408, 'n_words': 185}