Media / foldkit-media/server
fileReadPolicy
function · packages/media/src/server/files.ts:78
function fileReadPolicy<Asker>(policy: {
readonly resolve: (
request: HttpServerRequest.HttpServerRequest,
) => Effect.Effect<Asker, FileUnauthenticated>
readonly read: (asker: Asker, key: string) => Effect.Effect<boolean>
}): Layer.Layer<FileReadPolicy>A FileReadPolicy in its two steps: resolve says who is asking (a
principal, a visitor) or fails FileUnauthenticated; read says whether
they may read a key, typically by finding the application's row that holds
it. A no is a 404, as an unknown key is.