# @galaxie/authorizer

> This simple library will allow you to perform registration and authorization on your website using [authorizer.app](https://authorizer.app)'s flow.

Latest version **1.1.0** (published 2021-08-03) · 0 weekly downloads

## Install

```sh
npm install @galaxie/authorizer
pnpm add @galaxie/authorizer
yarn add @galaxie/authorizer
bun add @galaxie/authorizer
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2021-08-03 |
| First published | 2021-04-04 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 85.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | jsmrcaga |

## Links

- npm: https://www.npmjs.com/package/@galaxie/authorizer
- npm.io page: https://npm.io/package/@galaxie/authorizer

## Dependencies (1)

- [cbor-js](https://npm.io/package/cbor-js.md) ^0.1.0

## Recent versions

- 1.1.0 (latest) — 2021-08-03
- 1.0.0 — 2021-08-03
- 0.3.0 — 2021-07-29
- 0.2.2 — 2021-04-24
- 0.2.1 — 2021-04-24
- 0.2.0 — 2021-04-24
- 0.1.8 — 2021-04-18
- 0.1.7 — 2021-04-16
- 0.1.6 — 2021-04-16
- 0.1.5 — 2021-04-14
- 0.1.4 — 2021-04-11
- 0.1.3 — 2021-04-11
- 0.1.2 — 2021-04-08
- 0.1.1 — 2021-04-07
- 0.1.0 — 2021-04-04

## README

# /authorizer Core

This simple library will allow you to perform registration and authorization on your website
using [authorizer.app](https://authorizer.app)'s flow.

## General
### Methods
| Name | Description |
|:----:|:-----------:|
| `isSupported()` | Returns a boolean indicating if WebauthN is supported on this navigator |
| `check_params({ state, client_id, user_id })` | Checks if all the parameters are correct |

## Registration
### Methods
| Name | Description |
|:----:|:-----------:|
| `register(params)` | Calls `fetch_registration_params` and `webauthn_register` one after the other. Parameters are transformed using `get_registration_params` |
| `fetch_registration_params(params)` | Fetches registration parameters from the server |
| `get_registration_params(response, params)` | Transforms the server response so the browser can understand it. Accepts extra parameters in order to get `user_name`, `user_display_name` and `user_id` |
| `webauthn_register` | Performs browser credential registration and transforms output to be "server-ready"|

## Authorization
### Methods
| Name | Description |
|:----:|:-----------:|
| `authorize(params)` | Calls `fetch_authorization_params` and `webauthn_authorize` one after the other. Parameters are transformed using `get_authorization_params` |
| `fetch_authorization_params(params)` | Fetches authorization parameters from the server |
| `get_authorization_params(response)` | Transforms the server response so the browser can understand it. |
| `webauthn_authorize` | Performs browser credential authorization and transforms output to be "server-ready"|

## Example

### Registration
```js
WebauthN.register({
	client_id: my_client_id,
	user_id: an_id_to_match_my_user,
	state: a_unique_state
}).then(result => {
	// Send result to authorizer.app or your server (which will verrify with authorizer.app later anyway)
});
```

### Authorization
```js
WebauthN.authorize({
	client_id: my_client_id,
	user_id: an_id_to_match_my_user,
	state: a_unique_state
}).then(result => {
	// Send result to authorizer.app or your server (which will verrify with authorizer.app later anyway)
});
```

---
_Source: https://npm.io/package/@galaxie/authorizer · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
