2022-02-14 22:11:12 +00:00
|
|
|
export const isAcceptableStatus = (filter: string): boolean => {
|
2022-10-14 20:21:30 +00:00
|
|
|
return (
|
|
|
|
filter === "new" ||
|
|
|
|
filter === "online" ||
|
|
|
|
filter === "offline" ||
|
|
|
|
filter === "missing"
|
|
|
|
);
|
2021-09-30 19:32:06 +00:00
|
|
|
};
|
|
|
|
|
2022-02-14 22:11:12 +00:00
|
|
|
export const isValidPolicyResponse = (filter: string): boolean => {
|
2021-10-18 18:29:48 +00:00
|
|
|
return filter === "pass" || filter === "fail";
|
|
|
|
};
|
|
|
|
|
2021-12-24 00:12:08 +00:00
|
|
|
// 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);
|
|
|
|
};
|