| 143 | } |
| 144 | |
| 145 | static bool is_valid_hf_token(const std::string & token) { |
| 146 | if (token.length() < 37 || token.length() > 256 || |
| 147 | !string_starts_with(token, "hf_")) { |
| 148 | return false; |
| 149 | } |
| 150 | for (size_t i = 3; i < token.length(); ++i) { |
| 151 | if (!is_alphanum(token[i])) { |
| 152 | return false; |
| 153 | } |
| 154 | } |
| 155 | return true; |
| 156 | } |
| 157 | |
| 158 | static bool is_valid_commit(const std::string & hash) { |
| 159 | return is_hex_string(hash, 40); |
no test coverage detected