mirror of
https://github.com/empayre/fleet.git
synced 2024-11-07 17:28:54 +00:00
24 lines
837 B
TypeScript
24 lines
837 B
TypeScript
export const isAcceptableStatus = (filter: string): boolean => {
|
|
return (
|
|
filter === "new" ||
|
|
filter === "online" ||
|
|
filter === "offline" ||
|
|
filter === "missing"
|
|
);
|
|
};
|
|
|
|
export const isValidPolicyResponse = (filter: string): boolean => {
|
|
return filter === "pass" || filter === "fail";
|
|
};
|
|
|
|
// Performs a grossly oversimplied validation that subject string includes substrings
|
|
// that would be expected in a textual encoding of a certificate chain per the PEM spec
|
|
// (see https://datatracker.ietf.org/doc/html/rfc7468#section-2)
|
|
// Consider using a third-party library if more robust validation is desired
|
|
export const isValidPemCertificate = (cert: string): boolean => {
|
|
const regexPemHeader = /-----BEGIN/;
|
|
const regexPemFooter = /-----END/;
|
|
|
|
return regexPemHeader.test(cert) && regexPemFooter.test(cert);
|
|
};
|