unchained / src /utils /hasValidAuthorization.mts
barton
Duplicate from jbilcke-hf/VideoChain-API
53aa97a
raw
history blame contribute delete
321 Bytes
import { IncomingHttpHeaders } from "node:http"
export const hasValidAuthorization = (headers: IncomingHttpHeaders) => {
const [_, token] = `${headers.authorization || ""}`.split(" ")
if (typeof token === "string" && token.trim() === process.env.VC_SECRET_ACCESS_TOKEN.trim()) {
return true
}
return false
}