# civic-sip-api

> Server-side library for the Civic Secure Identity platform.

Latest version **1.2.1** (published 2021-02-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install civic-sip-api
pnpm add civic-sip-api
yarn add civic-sip-api
bun add civic-sip-api
```

## Health

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

Positive: no vulnerabilities.

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

Negative: insecure dependencies; abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.1 |
| Published | 2021-02-12 |
| First published | 2017-05-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 6.10.x |
| Dependencies | 12 |
| Unpacked size | 17.8 KB |
| Known vulnerabilities | 0 (+18 in 4 direct dependencies) |
| Install scripts | no |
| GitHub stars | 25 |
| Author | civic |
| Maintainers | dmelosantos, dankelleher, jonthepilot, iainfra27, npmsteve |

## Links

- npm: https://www.npmjs.com/package/civic-sip-api
- Repository: https://github.com/civicteam/npm-civic-sip-api
- Issues: https://github.com/civicteam/npm-civic-sip-api/issues
- npm.io page: https://npm.io/package/civic-sip-api

## Dependencies (12)

- [sjcl](https://npm.io/package/sjcl.md) github:civicteam/sjcl
- [uuid](https://npm.io/package/uuid.md) ^3.0.1
- [promise](https://npm.io/package/promise.md) ^7.1.1
- [request](https://npm.io/package/request.md) ^2.88.0
- [crypto-js](https://npm.io/package/crypto-js.md) ^3.1.9-1
- [jsrsasign](https://npm.io/package/jsrsasign.md) ^7.1.5
- [lodash.merge](https://npm.io/package/lodash.merge.md) ^4.6.0
- [jsrsasign-util](https://npm.io/package/jsrsasign-util.md) ^1.0.0
- [unix-timestamp](https://npm.io/package/unix-timestamp.md) ^0.2.0
- [xmlhttprequest](https://npm.io/package/xmlhttprequest.md) ^1.8.0
- [json-stable-stringify](https://npm.io/package/json-stable-stringify.md) ^1.0.1
- [request-promise-native](https://npm.io/package/request-promise-native.md) ^1.0.5

## Recent versions

- 1.2.1 (latest) — 2021-02-12
- 1.2.0 — 2019-06-25
- 1.1.0 — 2018-12-03
- 1.0.2 — 2018-08-21
- 1.0.1 — 2017-12-14
- 1.0.0 — 2017-12-11
- 0.4.4 — 2017-10-17
- 0.4.3 — 2017-09-14
- 0.4.2 — 2017-07-10
- 0.4.1 — 2017-06-08
- 0.4.0 — 2017-06-07
- 0.2.0 — 2017-06-02
- 0.1.3 — 2017-05-18
- 0.1.2 — 2017-05-18
- 0.1.1 — 2017-05-14
- … 1 more at https://npm.io/package/civic-sip-api/versions

## README

[![NPM version](http://img.shields.io/npm/v/civic-sip-api.svg?style=flat-square)](https://www.npmjs.com/package/civic-sip-api)
[![NPM downloads](http://img.shields.io/npm/dm/civic-sip-api.svg?style=flat-square)](https://www.npmjs.com/package/civic-sip-api)
[![node version](http://img.shields.io/node/v/civic-sip-api.svg?style=flat-square)](https://www.npmjs.com/package/civic-sip-api)

Node.js wrapper for the Civic hosted SIP API.  For best results, be sure that you're using the latest version.

Please see [docs.civic.com](https://docs.civic.com) for a more details.

### Installation

`civic-sip-api` can be installed from npm:

```shell
npm install civic-sip-api --save
```

### Basic Usage
```javascript
const civicSip = require('civic-sip-api');

const civicClient = civicSip.newClient({
    appId: 'ABC123',
    appSecret: APP_SECRET,
    prvKey: PRV_KEY,
});

civicClient.exchangeCode(jwtToken)
    .then((userData) => {
        // store user data and userId as appropriate
        console.log('userData = ', JSON.stringify(userData, null, 4));
    }).catch((error) => {
        console.log(error);
    });
```
Example of data returned for a `ScopeRequest` of `BASIC_SIGNUP`
```javascript
userData =  {
    "data": [
        {
            "label": "contact.personal.email",
            "value": "user.test@gmail.com",
            "isValid": true,
            "isOwner": true
        },
        {
            "label": "contact.personal.phoneNumber",
            "value": "+1 5556187380",
            "isValid": true,
            "isOwner": true
        }
    ],
    "userId": "c6d5795f8a059ez5ad29a33a60f8b402a172c3e0bbe50fd230ae8e0303609b42"
}
```

### Proxy Usage
There is basic proxy support. The server address and port is set as a url.

`rejectUnauthorized` Setting this to `false` is optional and can be used when testing in development and needing to use a self signed cerificate. We do *not* recommend setting this to `false` in a production environment as it will compromise security.

```javascript
const civicSip = require('civic-sip-api');

const civicClient = civicSip.newClient({
    appId: 'ABC123',
    appSecret: APP_SECRET,
    prvKey: PRV_KEY,
    proxy: {
      url: 'http://10.0.0.6:8080',
      rejectUnauthorized: false, // Do not make false in production
    },
});

civicClient.exchangeCode(jwtToken)
    .then((userData) => {
        // store user data and userId as appropriate
        console.log('userData = ', JSON.stringify(userData, null, 4));
    }).catch((error) => {
        console.log(error);
    });
```

---
Copyright &copy; 2018 Civic.com

Released under the MIT License, which can be found in the repository in `LICENSE.txt`.

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