From 1d277b632911f52f40d1784beb4b7247e775f536 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20=C4=8Cerm=C3=A1k?= Date: Thu, 5 Dec 2024 14:48:20 +0100 Subject: [PATCH] Update README.md --- README.md | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 6bbb151..7d92559 100644 --- a/README.md +++ b/README.md @@ -3,23 +3,36 @@ Bear auth contains a set of methods for managing JWT tokens in single page applications. ## Features -- ðŸŠķ Ultra-light +- ðŸŠķ __Ultra-light__ - `@bear-auth/core`: [7.1 kB (min + gzip)](https://bundlephobia.com/package/@bear-auth/core) - `@bear-auth/react`: [0.55 kB (min + gzip)](https://bundlephobia.com/package/@bear-auth/react) - `@bear-auth/storage`: [0.44 kB (min + gzip)](https://bundlephobia.com/package/@bear-auth/storage) -- â™ŧïļ Auto access token refreshment -- 🛜 Network status detection -- 🏗ïļ Highly customizable. -- ðŸ’Ļ Tree-shakeable & side-effect free -- ✅ Strongly typed. +- â™ŧïļ __Auto access token refreshment__ + - If the `authenticate` method returns `expiresIn` and `refreshToken`, the `@bear-auth/core` will use the refresh token hook to maintain fresh access token. +- 🛜 __Network status detection__ + - To avoid refreshing access token while the app is offline. + - By default it uses `navigator.onLine` flag and the `online` event but can be changed via the `setContinueWhenOnline` method. +- 🏗ïļ __Highly customizable__ + - You can override almost all the default behaviour – storage, network, etc. +- ðŸ’Ļ __Tree-shakeable & side-effect free__ + - The API has been designed as pure functions (rather than one heavy object) to support tree-shaking. +- 🙈 __Framework agnostic__ + - The `@bear-auth/core` consists of just (promised-based) TypeScript vanilla methods. No attachment to library/framework. + - There is currently one official integration for [React](./packages/react) but others can be easily implemented. +- ✅ __Strongly typed__ +- âœĻ __Multiple instances per origin__ +- ðŸ‘Ļ‍🚒 __Custom error & guard functions for easier error handling__ + - `isBearAuthError(error: unknown): error is BearAuthError` + - `isBearAuthError(error: unknown, ['bear-auth/retrieve-auth-session-failed']): error is BearAuthError<'bear-auth/retrieve-auth-session-failed'>` + ## Packages -- [`@bear-auth/core`](./packages/core/README.md) -- [`@bear-auth/react`](./packages/react/README.md) -- [`@bear-auth/storage`](./packages/storage/README.md) +- [`@bear-auth/core`](./packages/core) +- [`@bear-auth/react`](./packages/react) +- [`@bear-auth/storage`](./packages/storage) ## Examples -- [`@bear-auth/core` example](./examples/core/README.md) -- [`@bear-auth/react` example](./examples/react/README.md) +- [`@bear-auth/core` example](./examples/core) +- [`@bear-auth/react` example](./examples/react)