API Keys for Postgres RLS

KeyHippo extends your Row Level Security policies to enable API key authentication and Role-Based Access Control (RBAC).

Built to work magically with Supabase.

-- Use API keys within your existing policy:
CREATE POLICY "allow_owner_access" ON "public"."table_name"
USING (
  (SELECT "auth"."uid"() = "table_name"."owner_id")
  OR (SELECT user_id FROM keyhippo.current_user_context()) = "table_name"."owner_id"
);
Backed by

Oh yeah, it's fast too.

key validation ops / year

key creation
ops / sec

create role
ops / sec

create scope
ops / sec

create group
ops / sec

key validation
ops / sec

RBAC auth
ops / sec

assign role
ops / sec

Single core p99 benchmark on AMD Threadripper 3960X