Something went wrong. Try again.
WIP: A simple cli for daily tangled use cases and AI integration. This is for my personal use right now, but happy if others get mileage fro
Something went wrong. Try again.
618 B · 22 lines
TypeScript
1234567891011121314151617181920212223import type { TangledApiClient } from '../lib/api-client.js';
/** * Validate that the client is authenticated and has an active session * @throws Error if not authenticated or no session found * @returns The current session with did and handle */export async function requireAuth(client: TangledApiClient): Promise<{ did: string; handle: string;}> { if (!(await client.isAuthenticated())) { throw new Error('Must be authenticated. Run "tangled auth login" first.'); }
const session = client.getSession(); if (!session) { throw new Error('No active session found'); }
return session;}