0.15.0 • Published 5 months ago

@kilpi/core v0.15.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

🐢 Kilpi — Authorization made simple

Read the docs to get started

Kilpi is the open-source TypeScript authorization library designed for developers who need flexible, powerful, and intuitive authorization.

Designed and created by Jussi Nevavuori with ❤️ in Brisbane & Helsinki

NPM Downloads NPM Version GitHub Repo stars

Features

  • Server-first authorization
  • Framework agnostic
  • Auth provider agnostic
  • Policies as code
  • Async policies
  • Supports any authorization model
  • Protected queries
  • Plugin API & Library
  • Developer friendly API
  • 100% Type-safe

Installation guides

...or any other framework - Kilpi is easy to integrate into any TypeScript application.

Examples

Define policies declaratively

// Kilpi.ts
export const Kilpi = createKilpi({ 
  getSubject, 
  policies: {
    documents: {
      update(user, doc: Document) {
        if (!user) return deny("Unauthenticated");
        return user.id === doc.ownerId ? grant(user) : deny();
      }
    }
  }
})

Authorize actions with one line

const user = await Kilpi.authorize("documents:update", document);

Protect your data right at the source

const getDocument = Kilpi.query(
  async (id: string) => await db.documents.get(id),
  {
    async protector({ output: doc }) {
      if (doc) await Kilpi.authorize("documents:read", doc);
      return doc;
    }
  }
);

await getDocument.protect("1");

And much more.

Read the docs to get started

0.15.0

5 months ago

0.14.0

6 months ago

0.13.0

7 months ago

0.12.1

7 months ago

0.12.0

7 months ago

0.11.0

7 months ago

0.10.2

7 months ago

0.10.1

7 months ago

0.10.0

7 months ago

0.9.1

7 months ago

0.9.0

7 months ago

0.8.2

7 months ago

0.8.1

7 months ago

0.8.0

7 months ago

0.7.1

8 months ago

0.7.0

8 months ago

0.6.3

8 months ago

0.6.2

8 months ago

0.6.1

8 months ago

0.6.0

8 months ago

0.5.2

8 months ago

0.5.1

8 months ago

0.5.0

8 months ago

0.4.0

8 months ago

0.1.1

8 months ago

0.2.3

10 months ago

0.2.0

10 months ago

0.1.0

10 months ago