@kavachos/svelte
v0.1.0
Published
Svelte stores for KavachOS auth
Readme
@kavachos/svelte
Svelte stores for KavachOS authentication.
Install
npm install @kavachos/svelteUsage
Create a client and stores at the top of your app, then subscribe in any component.
// lib/kavach.ts
import { createKavachClient, createAgentStore } from '@kavachos/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
