declare module '@encryptid/sdk/server' {
	export function verifyEncryptIDToken(token: string): Promise<EncryptIDClaims>;
	export function evaluateSpaceAccess(
		slug: string,
		token: string | null,
		method: string,
		options: { getSpaceConfig: (slug: string) => Promise<SpaceAuthConfig | null> },
	): Promise<{ allowed: boolean; readOnly: boolean; reason?: string; claims?: EncryptIDClaims }>;
	export function extractToken(headers: Headers): string | null;
	export function authenticateWSUpgrade(req: Request): Promise<EncryptIDClaims | null>;

	export interface EncryptIDClaims {
		sub: string;
		username?: string;
		iat?: number;
		exp?: number;
		[key: string]: unknown;
	}

	export interface SpaceAuthConfig {
		spaceSlug: string;
		visibility: string;
		ownerDID?: string;
		app?: string;
	}
}
