abstrak
v0.1.1
Published
Client SDK for Abstrak — gates, accounts, and per-user data over Firebase.
Maintainers
Readme
abstrak
Client SDK for Abstrak — verified sign-in, code-driven permissions, and per-user data on top of your own Firebase.
npm install abstrakimport { abstrak } from "abstrak";
const gate = abstrak("pk_live_...");
const user = await gate.signIn(); // { id, email }, verified silently
await gate.tag({ role: "student" }); // set from your own app data
if (await gate.is({ role: "admin" })) showAdminPanel(); // cosmetic
await gate.require({ role: "admin" }); // server-enforced; throws AbstrakDenied
await user.data.set({ purchases: 3 }); // per-user store in your Firebase
const profile = await user.data.get();Sign-in uses Google Identity Services; include its script once on the page:
<script src="https://accounts.google.com/gsi/client" async></script>API
abstrak(publicKey, { baseUrl? })→ clientsignIn()→{ id, email, data }tag(attrs)— set tags on the current useris(match)→ boolean (cosmetic checks)require(match)— throwsAbstrakDeniedif not satisfieduser.data.get()/user.data.set(value)signOut()
