# node-radius-client

> A simple promise based client library for radius built on top of node-radius and node-radius-utils.

Latest version **1.0.0** (published 2019-02-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install node-radius-client
pnpm add node-radius-client
yarn add node-radius-client
bun add node-radius-client
```

## 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 | 2019-02-25 |
| First published | 2019-02-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 8.8 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | w3cj |
| Maintainers | w3cj |

## Links

- npm: https://www.npmjs.com/package/node-radius-client
- Repository: https://github.com/w3cj/node-radius-client
- Homepage: https://github.com/w3cj/node-radius-client#readme
- Issues: https://github.com/w3cj/node-radius-client/issues
- npm.io page: https://npm.io/package/node-radius-client

## Dependencies (3)

- [joi](https://npm.io/package/joi.md) ^14.3.1
- [radius](https://npm.io/package/radius.md) ^1.1.4
- [node-radius-utils](https://npm.io/package/node-radius-utils.md) ^1.2.0

## Recent versions

- 1.0.0 (latest) — 2019-02-25

## README

# node-radius-client

A simple promise based client library for radius built on top of node-radius and node-radius-utils.

## Install

```sh
npm i node-radius-client
```

## Options

Options passed into a client instance use the following schema:

```js
Joi.object().keys({
  host: Joi.string().trim().required(),
  hostPort: Joi.number().min(0).optional(), // default 1812
  localPort: Joi.number().min(0).optional(), // default random between 49152 and 65535
  timeout: Joi.number().min(0).optional(), // default 2500
  retries: Joi.number().min(0).optional(), // default 3
  dictionaries: Joi.array().items(Joi.string().trim()).optional(), // default ones included with node-radius
});
```

## Methods

### `client.accessRequest`
* Accepts an object with a secret and attributes.
* Attributes can be an object like the example below which will be converted to an array of arrays using the `attributesToArray` function from `node-radius-utils`.
* If the response recieved is an `Access-Reject` the promise will reject.

### `client.send`

* Accepts an object with a secret, code and attributes.
* Attributes can be an object like the example below which will be converted to an array of arrays using the `attributesToArray` function from `node-radius-utils`.
* If the request reaches the maximum number of retries with no response, the promise will reject.

## Example Usage

```js
const Client = require('node-radius-client');
const {
  dictionaries: {
    rfc2865: {
      file,
      attributes,
    },
  },
} = require('node-radius-utils');

const client = new Client({
  host: '10.0.0.123',
  dictionaries: [
    file,
  ],
});

client.accessRequest({
  secret: 'super-secret',
  attributes: [
    [attributes.USER_NAME, 'bobross'],
    [attributes.USER_PASSWORD, 'hunter2'],
  ],
}).then((result) => {
  console.log('result', result);
}).catch((error) => {
  console.log('error', error);
});
```

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