core/predicates/ssh.predicate.ts
core/predicates/ssh.predicate.ts is a file in Secrets. 7 lines of code and 2 definitions.
import { SSH_MIN_BODY, SSH_PREFIXES } from "#configuration/constants/detector.constants";
import { defineDetector } from "#core/registries/detector.registry";
const hasKeyBody = function hasKeyBody(value: string, prefix: string): boolean {
const [body = ""] = value.slice(prefix.length).split(" ");
return value.startsWith(prefix) && body.length >= SSH_MIN_BODY;
};
defineDetector({ detects: (value) => SSH_PREFIXES.some((prefix) => hasKeyBody(value, prefix)), kind: "ssh" });