campose-api / src /utils /hasValidAuthorization.mts
jbilcke-hf's picture
jbilcke-hf HF staff
initial commit
5b3c62d
raw
history blame
318 Bytes
import { IncomingHttpHeaders } from "node:http"
export const hasValidAuthorization = (headers: IncomingHttpHeaders) => {
const [_, token] = `${headers.authorization || ""}`.split(" ")
if (typeof token === "string" && token.trim() === process.env.SECRET_ACCESS_TOKEN.trim()) {
return true
}
return false
}