Media / foldkit-media/server

uploadPolicyBearer

function · packages/media/src/server/upload.ts:183

function uploadPolicyBearer(
  token: string | undefined,
): Layer.Layer<UploadPolicy>

Admits a request whose Authorization is Bearer <token>, and with no token (unset or empty) admits nobody, whatever it sends. The two are compared by digest, every byte, so the time taken says nothing of the token. For a deployment's secret (wrangler secret put); who may upload by session is the application's own UploadPolicy.