studiocms
Version:
Astro Native CMS for AstroDB. Built from the ground up by the Astro community.
18 lines (17 loc) • 968 B
TypeScript
import type { APIContext } from 'astro';
import { Effect } from '../../../../../effect.js';
/**
* Verifies the authentication token from the request header in the given API context.
*
* This generator function attempts to extract an authentication token from the request header,
* verifies it using the SDK's REST API, and returns the associated user if verification succeeds.
* If the token is missing or invalid, it returns a 401 Unauthorized API response.
*
* @param context - The API context containing the request information.
* @returns The verified user object if authentication succeeds, or a 401 Unauthorized response if it fails.
*/
export declare const verifyAuthTokenFromHeader: (context: APIContext) => Effect.Effect<Response | {
userId: string;
key: string;
rank: "unknown" | "owner" | "admin" | "editor" | "visitor";
}, import("effect/Cause").UnknownException | import("../../../../../virtuals/sdk/errors.js").SDKCoreError, never>;