@glinr/theauth-svelte
v0.1.0
Published
Svelte stores for TheAuth auth
Readme
@glinr/theauth-svelte
Svelte stores for TheAuth authentication.
Install
npm install @glinr/@glinr/theauth-svelteUsage
Create a client and stores at the top of your app, then subscribe in any component.
// lib/kavach.ts
import { createKavachClient, createAgentStore } from '@glinr/theauth-svelte';
export const kavach = createKavachClient({
apiUrl: 'https://auth.yourapp.com',
tenantId: 'your-tenant-id',
});
export const agents = createAgentStore({ client: kavach });<script>
import { kavach, agents } from '$lib/kavach';
const { session, user } = kavach;
</script>
{#if $session}
<p>Welcome, {$user?.email}</p>
<button on:click={() => kavach.signOut()}>Sign out</button>
{:else}
<button on:click={() => kavach.signIn({ email, password })}>Sign in</button>
{/if}Exports
createKavachClient: creates a reactive Svelte store clientcreateAgentStore: creates a store for managing AI agents
Docs
License
MIT
