# @odczynflnpm/totam-illum-necessitatibus

> [//]: # ( ) [//]: # (This file is automatically generated by a `metapak`) [//]: # (module. Do not change it except between the) [//]: # (`content:start/end` flags, your changes would) [//]: # (be overridden.) [//]: # ( ) # @odczynflnpm/totam-illum-necess

Latest version **1.0.0** (published 2024-04-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install @odczynflnpm/totam-illum-necessitatibus
pnpm add @odczynflnpm/totam-illum-necessitatibus
yarn add @odczynflnpm/totam-illum-necessitatibus
bun add @odczynflnpm/totam-illum-necessitatibus
```

## 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.0.0 |
| Published | 2024-04-25 |
| First published | 2024-04-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 15 |
| Unpacked size | 42.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | odczynFL |
| Maintainers | ducvinh101011z |
| Keywords | babel-core, exit-code, ECMAScript 2020, compile less, less compiler, urls, cmd, zod, ascii, handlers, class-validator, typescript, env, nested css, codes, bootstrap css, Array.prototype.flatMap, styleguide, indicator, bootstrap less, recursive, flat, date, deepclone, variables in css, find, typeerror, watcher, east-asian-width, optimizer, redact, fullwidth, sigterm, map, BigUint64Array, picomatch, exit, bundling, key, figlet, sort, es-shim API, Uint32Array, setter, streams2, getintrinsic, readablestream, parser, ECMAScript 3, Array.prototype.includes, jasmine, encryption, parent, rangeerror, higher-order, less css, assign, datastructure, redux, gradients css, String.prototype.matchAll, spec, Reflect.getPrototypeOf, push, some, zero, once, Stream, shell, argv, inference, es2016, take, stateless, loading, invariant, names, [[Prototype]], mkdirs, open, tostringtag, sham, uuid, a11y, text, react pose, awesomesauce, ansi, browserlist, eventDispatcher, fast-deep-clone, uninstall, es2017, argument, reducer, buffer, setPrototypeOf, status, electron, async, stringifier, trimStart, weakmap, scheme-validation, drag, deepcopy, trimEnd, matchAll, watching, ender, less.js, ArrayBuffer#slice, typanion, react-hooks, warning, ramda, rm, https, length, byteOffset, limited, has, sanitization, command, jsonschema, Object.values, readable, 0, RegExp#flags, protobuf, read, format, Array.prototype.findLastIndex, Object.is, point-free, Float32Array, util.inspect, search, reuse, path, from, xdg, scheme, Uint16Array, valid, type, preprocessor, idle, colour, app, debugger, mocha, telephone, child, utility, assert, watchFile, functional, tacit, syntax, circular, arktype, pyyaml, functions, three, browser, require, art, operating-system, URLSearchParams, walk, api, slice, entries, sameValueZero, directory, transpile, dom, chai, getPrototypeOf, deep-copy, accessibility, Float64Array, arguments, style, rfc4122, ast, i18n, karma, dom-testing-library, cors, parse, deterministic, es2018, settings, styled-components, pipe, javascript, collection.es6, safe, trimLeft, values, sanitize, web, generics, json-schema-validator, Symbol, visual, toArray, folder, rm -rf, _.extend, ECMAScript 2022, schema, ECMAScript 2019, Int32Array, move, inspect, String.prototype.trim, iteration, start, ES, core, YAML, fast-copy, data, shebang, HyBi, airbnb, keys, ts, properties, number, intrinsic, regular expression, mime, debug, query, serialize, look-up, input, jsdiff, Object.assign, io-ts, getter, optimist, Iterator, iterator, expression, moment, polyfill, spinner, es, symbols, dayjs, collection, serializer, animation, dataView, extra, enumerable, extend, jsdom, getopt, validator, irq, log, make, pnpm9, starter, pose, channel, japanese, tc39, equal, css nesting, ECMAScript 7, var, drop, extension, hooks, dependencies, forEach, mkdir, hasOwn, ECMAScript 2017, Symbol.toStringTag, lesscss, colors, es8, find-up, queue, Observable, Observables, assertion, persistent, editor, writable, framer, less, Object.fromEntries, querystring, code points, rm -fr, create, typed, helpers, name, Int8Array, link, fp, mobile, macos, events, regular, rapid, jsonpath, es5, mru, prototype, xterm, command-line, tap, URL, copy, computed-types, callbound, is, CSS, mkdirp, config, Object.entries, RxJS, styling, callbind, xdg-open, sharedarraybuffer, ponyfill, curl, full-width, shared, fastclone, concat, lockfile, task, yup, ES2021, 6to5, exec, eventEmitter, sigint, look, arraybuffer, language, url, tester, columns, findup, private data, includes, estree, Set, sequence, tslib, fast, jwt, modules, import, gestures, regular expressions, react-testing-library, minimal, tdd, ie, file system, typeof, bdd, real-time, check, robust, term, column, fast-clone, css, rate, vest, groupBy, jest, findLast, windows, Function.prototype.name, spawn, console, description, util, validation, delete, qs, duplex, call, escape, full, group, serialization, whatwg, password, nodejs, pure, negative, Uint8Array, plugin, WeakSet, babel, Push, ECMAScript 2018, weakset, wrap, opens, yaml, define, value, output, make dir, forms, harmony, parents, StyleSheet, wget, opener, TypeBox, let, Object.keys, ES2023, set, eslintplugin, interrupts, stylesheet, ES3, argparse, fixed-width, redux-toolkit, accessor, ECMAScript 2021, error-handling, proto, es-shims, rgb, metadata, offset, banner, korean, immer, remove, time, asserts, typedarrays, negative zero, prefix, authentication, workspace:*, option, function, matches, chrome, protocol-buffers, variables, censor, descriptor, watch, lazy, joi, string, match, stream, every, default, chinese, id, Streams, logging, toStringTag, tty, ecmascript, character, ES7, ECMAScript 2015, express, logger, node, Array.prototype.contains, await, promise, phone, fastcopy, fs, connect, mime-db, website, installer, eslintconfig, es6, native, fastify, progress, clone, npm, environment, es2015, eslint, mimetypes, packages, styles, superagent, file, dir, testing, -0, symlinks |

## Links

- npm: https://www.npmjs.com/package/@odczynflnpm/totam-illum-necessitatibus
- Repository: https://github.com/odczynflnpm/totam-illum-necessitatibus
- Homepage: https://github.com/odczynflnpm/totam-illum-necessitatibus/#readme
- Issues: https://github.com/odczynflnpm/totam-illum-necessitatibus/issues
- npm.io page: https://npm.io/package/@odczynflnpm/totam-illum-necessitatibus

## Dependencies (15)

- [@odczynflnpm/error-laborum-ab](https://npm.io/package/@odczynflnpm/error-laborum-ab.md) ^1.0.0
- [@odczynflnpm/iste-adipisci-sit](https://npm.io/package/@odczynflnpm/iste-adipisci-sit.md) ^1.0.0
- [@lambrioanpm/tenetur-aut-fugiat](https://npm.io/package/@lambrioanpm/tenetur-aut-fugiat.md) ^1.0.0
- [@odczynflnpm/quas-inventore-quam](https://npm.io/package/@odczynflnpm/quas-inventore-quam.md) ^1.0.0
- [@odczynflnpm/sequi-placeat-earum](https://npm.io/package/@odczynflnpm/sequi-placeat-earum.md) ^1.0.0
- [@odczynflnpm/voluptas-odit-illum](https://npm.io/package/@odczynflnpm/voluptas-odit-illum.md) ^1.0.0
- [@odczynflnpm/hic-laboriosam-dolore](https://npm.io/package/@odczynflnpm/hic-laboriosam-dolore.md) ^1.0.0
- [@odczynflnpm/repellendus-modi-quas](https://npm.io/package/@odczynflnpm/repellendus-modi-quas.md) ^1.0.0
- [@odczynflnpm/alias-aperiam-accusamus](https://npm.io/package/@odczynflnpm/alias-aperiam-accusamus.md) ^1.0.0
- [@odczynflnpm/assumenda-adipisci-nulla](https://npm.io/package/@odczynflnpm/assumenda-adipisci-nulla.md) ^1.0.0
- [@odczynflnpm/repellendus-commodi-sunt](https://npm.io/package/@odczynflnpm/repellendus-commodi-sunt.md) ^1.0.0
- [@odczynflnpm/aliquid-expedita-repellat](https://npm.io/package/@odczynflnpm/aliquid-expedita-repellat.md) ^1.0.0
- [@odczynflnpm/voluptatibus-blanditiis-non](https://npm.io/package/@odczynflnpm/voluptatibus-blanditiis-non.md) ^1.0.0
- [@odczynflnpm/mollitia-praesentium-deserunt](https://npm.io/package/@odczynflnpm/mollitia-praesentium-deserunt.md) ^1.0.0
- [@odczynflnpm/exercitationem-molestiae-maxime](https://npm.io/package/@odczynflnpm/exercitationem-molestiae-maxime.md) ^1.0.0

## Alternatives

- [@regle/core](https://npm.io/package/@regle/core.md) — 47.0K weekly downloads
- [typeof-arguments](https://npm.io/package/typeof-arguments.md) — 12.5K weekly downloads
- [@lokalise/projects-engine-contracts](https://npm.io/package/@lokalise/projects-engine-contracts.md) — 978 weekly downloads
- [@osjwnpm/nam-laboriosam-quibusdam](https://npm.io/package/@osjwnpm/nam-laboriosam-quibusdam.md) — 70 weekly downloads
- [@oridune/validator](https://npm.io/package/@oridune/validator.md) — 16 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2024-04-25

## README

[//]: # ( )
[//]: # (This file is automatically generated by a `metapak`)
[//]: # (module. Do not change it  except between the)
[//]: # (`content:start/end` flags, your changes would)
[//]: # (be overridden.)
[//]: # ( )
# @odczynflnpm/totam-illum-necessitatibus
> Parse, build and deal with HTTP authorization headers.

[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/odczynflnpm/totam-illum-necessitatibus/blob/main/LICENSE)
[![Coverage Status](https://coveralls.io/repos/github/nfroidure/@odczynflnpm/totam-illum-necessitatibus/badge.svg?branch=main)](https://coveralls.io/github/nfroidure/@odczynflnpm/totam-illum-necessitatibus?branch=main)


[//]: # (::contents:start)

This library provide several utilities to parse and build WWW-Authenticate and
Authorization headers as described per the HTTP RFC.

It is intended to be framework agnostic and could be used either on the server
and the client side. It is also pure functions only, no side effect here. The
functions are synchronous since only parsing headers of small size so no need
for streams or anything asynchronous.

The module is easily extensible with new mechanisms, one very common way to
extend it is to create a `FAKE_TOKEN` mechanism for development only that allows
to directly provide the userId that should be authenticated. You can find
[an sample implementation](https://github.com/nfroidure/whook/blob/master/packages/whook-example/src/services/MECHANISMS.ts)
in the Whook's framework repository.

[//]: # (::contents:end)

# API
## Modules

<dl>
<dt><a href="#module_@odczynflnpm/totam-illum-necessitatibus">@odczynflnpm/totam-illum-necessitatibus</a></dt>
<dd></dd>
<dt><a href="#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/basic">@odczynflnpm/totam-illum-necessitatibus/mechanisms/basic</a></dt>
<dd></dd>
<dt><a href="#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/bearer">@odczynflnpm/totam-illum-necessitatibus/mechanisms/bearer</a></dt>
<dd></dd>
<dt><a href="#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/digest">@odczynflnpm/totam-illum-necessitatibus/mechanisms/digest</a></dt>
<dd></dd>
</dl>

<a name="module_@odczynflnpm/totam-illum-necessitatibus"></a>

## @odczynflnpm/totam-illum-necessitatibus

* [@odczynflnpm/totam-illum-necessitatibus](#module_@odczynflnpm/totam-illum-necessitatibus)
    * _static_
        * [.parseWWWAuthenticateHeader(header, [authMechanisms], [options])](#module_@odczynflnpm/totam-illum-necessitatibus.parseWWWAuthenticateHeader) ⇒ <code>Object</code>
        * [.parseAuthorizationHeader(header, [authMechanisms], [options])](#module_@odczynflnpm/totam-illum-necessitatibus.parseAuthorizationHeader) ⇒ <code>Object</code>
        * [.buildWWWAuthenticateHeader(authMechanism, The)](#module_@odczynflnpm/totam-illum-necessitatibus.buildWWWAuthenticateHeader) ⇒ <code>string</code>
        * [.buildAuthorizationHeader(authMechanism, The)](#module_@odczynflnpm/totam-illum-necessitatibus.buildAuthorizationHeader) ⇒ <code>string</code>
    * _inner_
        * [~mechanisms](#module_@odczynflnpm/totam-illum-necessitatibus..mechanisms) : <code>Array</code>

<a name="module_@odczynflnpm/totam-illum-necessitatibus.parseWWWAuthenticateHeader"></a>

### @odczynflnpm/totam-illum-necessitatibus.parseWWWAuthenticateHeader(header, [authMechanisms], [options]) ⇒ <code>Object</code>
Parse HTTP WWW-Authenticate header contents.

**Kind**: static method of [<code>@odczynflnpm/totam-illum-necessitatibus</code>](#module_@odczynflnpm/totam-illum-necessitatibus)  
**Returns**: <code>Object</code> - Result of the contents parse.  
**Api**: public  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| header | <code>string</code> |  | The WWW-Authenticate header contents |
| [authMechanisms] | <code>Array</code> | <code>[BASIC, DIGEST, BEARER]</code> | Allow providing custom authentication mechanisms. |
| [options] | <code>Object</code> |  | Parsing options |
| [options.strict] | <code>boolean</code> | <code>true</code> | Strictly detect the mechanism type (case sensitive) |

**Example**  
```js
assert.deepEqual(
  parseWWWAuthenticateHeader('Basic realm="test"'), {
    type: 'Basic',
    data: {
      realm: 'test'
    }
  }
);
```
<a name="module_@odczynflnpm/totam-illum-necessitatibus.parseAuthorizationHeader"></a>

### @odczynflnpm/totam-illum-necessitatibus.parseAuthorizationHeader(header, [authMechanisms], [options]) ⇒ <code>Object</code>
Parse HTTP Authorization header contents.

**Kind**: static method of [<code>@odczynflnpm/totam-illum-necessitatibus</code>](#module_@odczynflnpm/totam-illum-necessitatibus)  
**Returns**: <code>Object</code> - Result of the contents parse.  
**Api**: public  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| header | <code>string</code> |  | The Authorization header contents |
| [authMechanisms] | <code>Array</code> | <code>[BASIC, DIGEST, BEARER]</code> | Allow custom authentication mechanisms. |
| [options] | <code>Object</code> |  | Parsing options |
| [options.strict] | <code>boolean</code> | <code>true</code> | Strictly detect the mechanism type (case sensitive) |

**Example**  
```js
assert.deepEqual(
  parseAuthorizationHeader('Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=='), {
    type: 'Basic',
    data: {
      hash: 'QWxhZGRpbjpvcGVuIHNlc2FtZQ=='
    }
  }
);
```
<a name="module_@odczynflnpm/totam-illum-necessitatibus.buildWWWAuthenticateHeader"></a>

### @odczynflnpm/totam-illum-necessitatibus.buildWWWAuthenticateHeader(authMechanism, The) ⇒ <code>string</code>
Build HTTP WWW-Authenticate header value.

**Kind**: static method of [<code>@odczynflnpm/totam-illum-necessitatibus</code>](#module_@odczynflnpm/totam-illum-necessitatibus)  
**Returns**: <code>string</code> - The header value.  
**Api**: public  

| Param | Type | Description |
| --- | --- | --- |
| authMechanism | <code>Object</code> | The mechanism to use |
| The | <code>Object</code> | WWW-Authenticate header contents to base the value on. |

**Example**  
```js
assert.deepEqual(
  buildWWWAuthenticateHeader(BASIC, {
    realm: 'test'
  }),
  'Basic realm="test"'
);
```
<a name="module_@odczynflnpm/totam-illum-necessitatibus.buildAuthorizationHeader"></a>

### @odczynflnpm/totam-illum-necessitatibus.buildAuthorizationHeader(authMechanism, The) ⇒ <code>string</code>
Build HTTP Authorization header value.

**Kind**: static method of [<code>@odczynflnpm/totam-illum-necessitatibus</code>](#module_@odczynflnpm/totam-illum-necessitatibus)  
**Returns**: <code>string</code> - The header value.  
**Api**: public  

| Param | Type | Description |
| --- | --- | --- |
| authMechanism | <code>Object</code> | The mechanism to use |
| The | <code>Object</code> | Authorization header contents to base the value on. |

**Example**  
```js
assert.deepEqual(
  buildAuthorizationHeader(BASIC, {
    realm: 'test'
  }),
  'Basic realm="test"'
);
```
<a name="module_@odczynflnpm/totam-illum-necessitatibus..mechanisms"></a>

### @odczynflnpm/totam-illum-necessitatibus~mechanisms : <code>Array</code>
Natively supported authentication mechanisms.

**Kind**: inner constant of [<code>@odczynflnpm/totam-illum-necessitatibus</code>](#module_@odczynflnpm/totam-illum-necessitatibus)  
<a name="module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/basic"></a>

## @odczynflnpm/totam-illum-necessitatibus/mechanisms/basic

* [@odczynflnpm/totam-illum-necessitatibus/mechanisms/basic](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/basic)
    * [~BASIC](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/basic..BASIC) : <code>Object</code>
        * [.type](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/basic..BASIC.type) : <code>String</code>
        * [.parseWWWAuthenticateRest(rest)](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/basic..BASIC.parseWWWAuthenticateRest) ⇒ <code>Object</code>
        * [.buildWWWAuthenticateRest(data)](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/basic..BASIC.buildWWWAuthenticateRest) ⇒ <code>String</code>
        * [.parseAuthorizationRest(rest)](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/basic..BASIC.parseAuthorizationRest) ⇒ <code>Object</code>
        * [.buildAuthorizationRest(content)](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/basic..BASIC.buildAuthorizationRest) ⇒ <code>String</code>
        * [.computeHash(credentials)](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/basic..BASIC.computeHash) ⇒ <code>String</code>
        * [.decodeHash(hash)](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/basic..BASIC.decodeHash) ⇒ <code>Object</code>

<a name="module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/basic..BASIC"></a>

### @odczynflnpm/totam-illum-necessitatibus/mechanisms/basic~BASIC : <code>Object</code>
Basic authentication mechanism.

**Kind**: inner constant of [<code>@odczynflnpm/totam-illum-necessitatibus/mechanisms/basic</code>](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/basic)  
**See**: http://tools.ietf.org/html/rfc2617#section-2  

* [~BASIC](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/basic..BASIC) : <code>Object</code>
    * [.type](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/basic..BASIC.type) : <code>String</code>
    * [.parseWWWAuthenticateRest(rest)](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/basic..BASIC.parseWWWAuthenticateRest) ⇒ <code>Object</code>
    * [.buildWWWAuthenticateRest(data)](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/basic..BASIC.buildWWWAuthenticateRest) ⇒ <code>String</code>
    * [.parseAuthorizationRest(rest)](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/basic..BASIC.parseAuthorizationRest) ⇒ <code>Object</code>
    * [.buildAuthorizationRest(content)](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/basic..BASIC.buildAuthorizationRest) ⇒ <code>String</code>
    * [.computeHash(credentials)](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/basic..BASIC.computeHash) ⇒ <code>String</code>
    * [.decodeHash(hash)](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/basic..BASIC.decodeHash) ⇒ <code>Object</code>

<a name="module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/basic..BASIC.type"></a>

#### BASIC.type : <code>String</code>
The Basic auth mechanism prefix.

**Kind**: static property of [<code>BASIC</code>](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/basic..BASIC)  
<a name="module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/basic..BASIC.parseWWWAuthenticateRest"></a>

#### BASIC.parseWWWAuthenticateRest(rest) ⇒ <code>Object</code>
Parse the WWW Authenticate header rest.

**Kind**: static method of [<code>BASIC</code>](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/basic..BASIC)  
**Returns**: <code>Object</code> - Object representing the result of the parse operation.  
**Api**: public  

| Param | Type | Description |
| --- | --- | --- |
| rest | <code>String</code> | The header rest (string after the authentication mechanism prefix). |

**Example**  
```js
assert.deepEqual(
  BASIC.parseWWWAuthenticateRest('realm="perlinpinpin"'), {
    realm: 'perlinpinpin'
  }
);
```
<a name="module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/basic..BASIC.buildWWWAuthenticateRest"></a>

#### BASIC.buildWWWAuthenticateRest(data) ⇒ <code>String</code>
Build the WWW Authenticate header rest.

**Kind**: static method of [<code>BASIC</code>](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/basic..BASIC)  
**Returns**: <code>String</code> - The built rest.  
**Api**: public  

| Param | Type | Description |
| --- | --- | --- |
| data | <code>Object</code> | The content from wich to build the rest. |

**Example**  
```js
assert.equal(
  BASIC.buildWWWAuthenticateRest({
    realm: 'perlinpinpin'
  }),
  'realm="perlinpinpin"'
);
```
<a name="module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/basic..BASIC.parseAuthorizationRest"></a>

#### BASIC.parseAuthorizationRest(rest) ⇒ <code>Object</code>
Parse the Authorization header rest.

**Kind**: static method of [<code>BASIC</code>](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/basic..BASIC)  
**Returns**: <code>Object</code> - Object representing the result of the parse operation {hash}.  
**Api**: public  

| Param | Type | Description |
| --- | --- | --- |
| rest | <code>String</code> | The header rest (string after the authentication mechanism prefix).) |

**Example**  
```js
assert.deepEqual(
  BASIC.parseAuthorizationRest('QWxpIEJhYmE6b3BlbiBzZXNhbWU='), {
    hash: 'QWxpIEJhYmE6b3BlbiBzZXNhbWU=',
    username: 'Ali Baba',
    password: 'open sesame'
  }
);
```
<a name="module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/basic..BASIC.buildAuthorizationRest"></a>

#### BASIC.buildAuthorizationRest(content) ⇒ <code>String</code>
Build the Authorization header rest.

**Kind**: static method of [<code>BASIC</code>](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/basic..BASIC)  
**Returns**: <code>String</code> - The rest built.  
**Api**: public  

| Param | Type | Description |
| --- | --- | --- |
| content | <code>Object</code> | The content from wich to build the rest. |

**Example**  
```js
assert.equal(
  BASIC.buildAuthorizationRest({
    hash: 'QWxpIEJhYmE6b3BlbiBzZXNhbWU='
  }),
  'QWxpIEJhYmE6b3BlbiBzZXNhbWU='
);
```
<a name="module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/basic..BASIC.computeHash"></a>

#### BASIC.computeHash(credentials) ⇒ <code>String</code>
Compute the Basic authentication hash from the given credentials.

**Kind**: static method of [<code>BASIC</code>](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/basic..BASIC)  
**Returns**: <code>String</code> - The hash representing the credentials.  
**Api**: public  

| Param | Type | Description |
| --- | --- | --- |
| credentials | <code>Object</code> | The credentials to encode {username, password}. |

**Example**  
```js
assert.equal(
  BASIC.computeHash({
    username: 'Ali Baba',
    password: 'open sesame'
  }),
  'QWxpIEJhYmE6b3BlbiBzZXNhbWU='
);
```
<a name="module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/basic..BASIC.decodeHash"></a>

#### BASIC.decodeHash(hash) ⇒ <code>Object</code>
Decode the Basic hash and return the corresponding credentials.

**Kind**: static method of [<code>BASIC</code>](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/basic..BASIC)  
**Returns**: <code>Object</code> - Object representing the credentials {username, password}.  
**Api**: public  

| Param | Type | Description |
| --- | --- | --- |
| hash | <code>String</code> | The hash. |

**Example**  
```js
assert.deepEqual(
  BASIC.decodeHash('QWxpIEJhYmE6b3BlbiBzZXNhbWU='), {
    username: 'Ali Baba',
    password: 'open sesame'
  }
);
```
<a name="module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/bearer"></a>

## @odczynflnpm/totam-illum-necessitatibus/mechanisms/bearer

* [@odczynflnpm/totam-illum-necessitatibus/mechanisms/bearer](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/bearer)
    * [~BEARER](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/bearer..BEARER) : <code>Object</code>
        * [.type](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/bearer..BEARER.type) : <code>String</code>
        * [.parseWWWAuthenticateRest(rest)](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/bearer..BEARER.parseWWWAuthenticateRest) ⇒ <code>Object</code>
        * [.buildWWWAuthenticateRest(data)](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/bearer..BEARER.buildWWWAuthenticateRest) ⇒ <code>String</code>
        * [.parseAuthorizationRest(rest)](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/bearer..BEARER.parseAuthorizationRest) ⇒ <code>Object</code>
        * [.buildAuthorizationRest(content)](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/bearer..BEARER.buildAuthorizationRest) ⇒ <code>String</code>

<a name="module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/bearer..BEARER"></a>

### @odczynflnpm/totam-illum-necessitatibus/mechanisms/bearer~BEARER : <code>Object</code>
Bearer authentication mechanism.

**Kind**: inner constant of [<code>@odczynflnpm/totam-illum-necessitatibus/mechanisms/bearer</code>](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/bearer)  
**See**: https://tools.ietf.org/html/rfc6750#section-3  

* [~BEARER](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/bearer..BEARER) : <code>Object</code>
    * [.type](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/bearer..BEARER.type) : <code>String</code>
    * [.parseWWWAuthenticateRest(rest)](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/bearer..BEARER.parseWWWAuthenticateRest) ⇒ <code>Object</code>
    * [.buildWWWAuthenticateRest(data)](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/bearer..BEARER.buildWWWAuthenticateRest) ⇒ <code>String</code>
    * [.parseAuthorizationRest(rest)](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/bearer..BEARER.parseAuthorizationRest) ⇒ <code>Object</code>
    * [.buildAuthorizationRest(content)](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/bearer..BEARER.buildAuthorizationRest) ⇒ <code>String</code>

<a name="module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/bearer..BEARER.type"></a>

#### BEARER.type : <code>String</code>
The Bearer auth mechanism prefix.

**Kind**: static property of [<code>BEARER</code>](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/bearer..BEARER)  
<a name="module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/bearer..BEARER.parseWWWAuthenticateRest"></a>

#### BEARER.parseWWWAuthenticateRest(rest) ⇒ <code>Object</code>
Parse the WWW Authenticate header rest.

**Kind**: static method of [<code>BEARER</code>](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/bearer..BEARER)  
**Returns**: <code>Object</code> - Object representing the result of the parse operation.  
**Api**: public  

| Param | Type | Description |
| --- | --- | --- |
| rest | <code>String</code> | The header rest (string after the authentication mechanism prefix). |

**Example**  
```js
assert.deepEqual(
  BEARER.parseWWWAuthenticateRest(
    'realm="testrealm@host.com", ' +
    'scope="openid profile email"'
  ), {
    realm: 'testrealm@host.com',
    scope: 'openid profile email',
  }
);
```
<a name="module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/bearer..BEARER.buildWWWAuthenticateRest"></a>

#### BEARER.buildWWWAuthenticateRest(data) ⇒ <code>String</code>
Build the WWW Authenticate header rest.

**Kind**: static method of [<code>BEARER</code>](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/bearer..BEARER)  
**Returns**: <code>String</code> - The built rest.  
**Api**: public  

| Param | Type | Description |
| --- | --- | --- |
| data | <code>Object</code> | The content from wich to build the rest. |

**Example**  
```js
assert.equal(
  BEARER.buildWWWAuthenticateRest({
    realm: 'testrealm@host.com',
    error: 'invalid_request',
    error_description: 'The access token expired',
  }),
  'realm="testrealm@host.com", ' +
  'error="invalid_request", ' +
  'error_description="The access token expired"'
);
```
<a name="module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/bearer..BEARER.parseAuthorizationRest"></a>

#### BEARER.parseAuthorizationRest(rest) ⇒ <code>Object</code>
Parse the Authorization header rest.

**Kind**: static method of [<code>BEARER</code>](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/bearer..BEARER)  
**Returns**: <code>Object</code> - Object representing the result of the parse operation {hash}.  
**Api**: public  

| Param | Type | Description |
| --- | --- | --- |
| rest | <code>String</code> | The header rest (string after the authentication mechanism prefix).) |

**Example**  
```js
assert.deepEqual(
  BEARER.parseAuthorizationRest('mF_9.B5f-4.1JqM'), {
    hash: 'mF_9.B5f-4.1JqM',
  }
);
```
<a name="module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/bearer..BEARER.buildAuthorizationRest"></a>

#### BEARER.buildAuthorizationRest(content) ⇒ <code>String</code>
Build the Authorization header rest.

**Kind**: static method of [<code>BEARER</code>](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/bearer..BEARER)  
**Returns**: <code>String</code> - The rest built.  
**Api**: public  

| Param | Type | Description |
| --- | --- | --- |
| content | <code>Object</code> | The content from wich to build the rest. |

**Example**  
```js
assert.equal(
  BEARER.buildAuthorizationRest({
    hash: 'mF_9.B5f-4.1JqM'
  }),
  'mF_9.B5f-4.1JqM=='
);
```
<a name="module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/digest"></a>

## @odczynflnpm/totam-illum-necessitatibus/mechanisms/digest

* [@odczynflnpm/totam-illum-necessitatibus/mechanisms/digest](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/digest)
    * [~DIGEST](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/digest..DIGEST) : <code>Object</code>
        * [.type](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/digest..DIGEST.type) : <code>String</code>
        * [.parseWWWAuthenticateRest(rest)](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/digest..DIGEST.parseWWWAuthenticateRest) ⇒ <code>Object</code>
        * [.buildWWWAuthenticateRest(data)](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/digest..DIGEST.buildWWWAuthenticateRest) ⇒ <code>String</code>
        * [.parseAuthorizationRest(rest)](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/digest..DIGEST.parseAuthorizationRest) ⇒ <code>Object</code>
        * [.buildAuthorizationRest(data)](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/digest..DIGEST.buildAuthorizationRest) ⇒ <code>String</code>
        * [.computeHash(data)](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/digest..DIGEST.computeHash) ⇒ <code>String</code>

<a name="module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/digest..DIGEST"></a>

### @odczynflnpm/totam-illum-necessitatibus/mechanisms/digest~DIGEST : <code>Object</code>
Digest authentication mechanism.

**Kind**: inner constant of [<code>@odczynflnpm/totam-illum-necessitatibus/mechanisms/digest</code>](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/digest)  
**See**

- http://tools.ietf.org/html/rfc2617#section-3
- http://tools.ietf.org/html/rfc2069#section-2


* [~DIGEST](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/digest..DIGEST) : <code>Object</code>
    * [.type](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/digest..DIGEST.type) : <code>String</code>
    * [.parseWWWAuthenticateRest(rest)](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/digest..DIGEST.parseWWWAuthenticateRest) ⇒ <code>Object</code>
    * [.buildWWWAuthenticateRest(data)](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/digest..DIGEST.buildWWWAuthenticateRest) ⇒ <code>String</code>
    * [.parseAuthorizationRest(rest)](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/digest..DIGEST.parseAuthorizationRest) ⇒ <code>Object</code>
    * [.buildAuthorizationRest(data)](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/digest..DIGEST.buildAuthorizationRest) ⇒ <code>String</code>
    * [.computeHash(data)](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/digest..DIGEST.computeHash) ⇒ <code>String</code>

<a name="module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/digest..DIGEST.type"></a>

#### DIGEST.type : <code>String</code>
The Digest auth mechanism prefix.

**Kind**: static property of [<code>DIGEST</code>](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/digest..DIGEST)  
<a name="module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/digest..DIGEST.parseWWWAuthenticateRest"></a>

#### DIGEST.parseWWWAuthenticateRest(rest) ⇒ <code>Object</code>
Parse the WWW Authenticate header rest.

**Kind**: static method of [<code>DIGEST</code>](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/digest..DIGEST)  
**Returns**: <code>Object</code> - Object representing the result of the parse operation.  
**Api**: public  

| Param | Type | Description |
| --- | --- | --- |
| rest | <code>String</code> | The header rest (string after the authentication mechanism prefix). |

**Example**  
```js
assert.deepEqual(
  DIGEST.parseWWWAuthenticateRest(
    'realm="testrealm@host.com", ' +
    'qop="auth, auth-int", ' +
    'nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093", ' +
    'opaque="5ccc069c403ebaf9f0171e9517f40e41"'
  ), {
    realm: 'testrealm@host.com',
    qop: 'auth, auth-int',
    nonce: 'dcd98b7102dd2f0e8b11d0f600bfb0c093',
    opaque: '5ccc069c403ebaf9f0171e9517f40e41'
  }
);
```
<a name="module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/digest..DIGEST.buildWWWAuthenticateRest"></a>

#### DIGEST.buildWWWAuthenticateRest(data) ⇒ <code>String</code>
Build the WWW Authenticate header rest.

**Kind**: static method of [<code>DIGEST</code>](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/digest..DIGEST)  
**Returns**: <code>String</code> - The built rest.  
**Api**: public  

| Param | Type | Description |
| --- | --- | --- |
| data | <code>Object</code> | The content from which to build the rest. |

**Example**  
```js
assert.equal(
  DIGEST.buildWWWAuthenticateRest({
    realm: 'testrealm@host.com',
    qop: 'auth, auth-int',
    nonce: 'dcd98b7102dd2f0e8b11d0f600bfb0c093',
    opaque: '5ccc069c403ebaf9f0171e9517f40e41'
  }),
  'realm="testrealm@host.com", ' +
  'qop="auth, auth-int", ' +
  'nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093", ' +
  'opaque="5ccc069c403ebaf9f0171e9517f40e41"'
);
```
<a name="module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/digest..DIGEST.parseAuthorizationRest"></a>

#### DIGEST.parseAuthorizationRest(rest) ⇒ <code>Object</code>
Parse the Authorization header rest.

**Kind**: static method of [<code>DIGEST</code>](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/digest..DIGEST)  
**Returns**: <code>Object</code> - Object representing the result of the parse operation {hash}.  
**Api**: public  

| Param | Type | Description |
| --- | --- | --- |
| rest | <code>String</code> | The header rest (string after the authentication mechanism prefix).) |

**Example**  
```js
assert.deepEqual(
  DIGEST.parseAuthorizationRest(
    'username="Mufasa",' +
    'realm="testrealm@host.com",' +
    'nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093",' +
    'uri="/dir/index.html",' +
    'qop="auth",' +
    'nc="00000001",' +
    'cnonce="0a4f113b",' +
    'response="6629fae49393a05397450978507c4ef1",' +
    'opaque="5ccc069c403ebaf9f0171e9517f40e41"'
  ), {
    username: "Mufasa",
    realm: 'testrealm@host.com',
    nonce: "dcd98b7102dd2f0e8b11d0f600bfb0c093",
    uri: "/dir/index.html",
    qop: 'auth',
    nc: '00000001',
    cnonce: "0a4f113b",
    response: "6629fae49393a05397450978507c4ef1",
    opaque: "5ccc069c403ebaf9f0171e9517f40e41"
  }
);
```
<a name="module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/digest..DIGEST.buildAuthorizationRest"></a>

#### DIGEST.buildAuthorizationRest(data) ⇒ <code>String</code>
Build the Authorization header rest.

**Kind**: static method of [<code>DIGEST</code>](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/digest..DIGEST)  
**Returns**: <code>String</code> - The rest built.  
**Api**: public  

| Param | Type | Description |
| --- | --- | --- |
| data | <code>Object</code> | The content from which to build the rest. |

**Example**  
```js
assert.equal(
  DIGEST.buildAuthorizationRest({
    username: "Mufasa",
    realm: 'testrealm@host.com',
    nonce: "dcd98b7102dd2f0e8b11d0f600bfb0c093",
    uri: "/dir/index.html",
    qop: 'auth',
    nc: '00000001',
    cnonce: "0a4f113b",
    response: "6629fae49393a05397450978507c4ef1",
    opaque: "5ccc069c403ebaf9f0171e9517f40e41"
  }),
  'username="Mufasa", ' +
  'realm="testrealm@host.com", ' +
  'nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093", ' +
  'uri="/dir/index.html", ' +
  'response="6629fae49393a05397450978507c4ef1", ' +
  'cnonce="0a4f113b", ' +
  'opaque="5ccc069c403ebaf9f0171e9517f40e41", ' +
  'qop="auth", ' +
  'nc="00000001"'
);
```
<a name="module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/digest..DIGEST.computeHash"></a>

#### DIGEST.computeHash(data) ⇒ <code>String</code>
Compute the Digest authentication hash from the given credentials.

**Kind**: static method of [<code>DIGEST</code>](#module_@odczynflnpm/totam-illum-necessitatibus/mechanisms/digest..DIGEST)  
**Returns**: <code>String</code> - The hash representing the credentials.  
**Api**: public  

| Param | Type | Description |
| --- | --- | --- |
| data | <code>Object</code> | The credentials to encode and other encoding details. |

**Example**  
```js
assert.equal(
  DIGEST.computeHash({
    username: 'Mufasa',
    realm: 'testrealm@host.com',
    password: 'Circle Of Life',
    method: 'GET',
    uri: '/dir/index.html',
    nonce: 'dcd98b7102dd2f0e8b11d0f600bfb0c093',
    nc: '00000001',
    cnonce: '0a4f113b',
    qop: 'auth',
    algorithm: 'md5'
  }),
  '6629fae49393a05397450978507c4ef1'
);
```

# Authors
- [Nicolas Froidure](https://insertafter.com/en/index.html)
- [Jake Pruitt](https://github.com/jakepruitt)
- [Corentin Girard](https://github.com/Drarig29)
- [Roman Sokolov](https://github.com/Stillness-2)

# License
[MIT](https://github.com/odczynflnpm/totam-illum-necessitatibus/blob/main/LICENSE)

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