# jsonpasswordtoken

> # Install

Latest version **1.9.1** (published 2020-07-27) · ISC license · 0 weekly downloads

## Install

```sh
npm install jsonpasswordtoken
pnpm add jsonpasswordtoken
yarn add jsonpasswordtoken
bun add jsonpasswordtoken
```

## 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.9.1 |
| Published | 2020-07-27 |
| First published | 2020-07-27 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 9.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Arihant |
| Maintainers | arihant_dev |
| Keywords | jpt, jwt, crypto, encryptpassword, decryptpassword, token, jws |

## Links

- npm: https://www.npmjs.com/package/jsonpasswordtoken
- Repository: https://git.devtechnosys.tech/arihant_bhugari/jsonwebtoken
- npm.io page: https://npm.io/package/jsonpasswordtoken

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.9.1 (latest) — 2020-07-27
- 1.9.0 — 2020-07-27
- 1.8.0 — 2020-07-27
- 1.7.0 — 2020-07-27
- 1.6.0 — 2020-07-27
- 1.5.0 — 2020-07-27
- 1.4.0 — 2020-07-27
- 1.3.0 — 2020-07-27
- 1.2.0 — 2020-07-27
- 1.1.0 — 2020-07-27
- 1.0.0 — 2020-07-27

## README

# node-jsonpasswordtoken

# Install

```bash
$ npm install jsonpasswordtoken
```

# Usage

## jsonpasswordtoken.sign(payload,secret,expiryTime,iv)

(Synchronous) Return a token.

Options:

* `payload`
* `secret` (secret must be 32bit long)
* `expiryTime` (Optional, defaults to 7day, format will be [4,'day/minute'])
* `iv` (iv must be 16bit long)

If `payload` is not a buffer or a string, it will be coerced into a string
using `JSON.stringify`.

Example

```js
const signature = jsonpasswordtoken.sign({name:'jsonpasswordtoken'},'testhmkiltyofgntghylqwertyuilmnv',[5,'day'],'absvuitlgrthifbr');

//it will return d587f74978e9fc8bc25e47cd2b8d2e2b18fc9590b60935e25f997946036b1dbc4534d83474d4e690b236eda46a1dc9a2e5ab261b660795208a41b2e67fbd5b08ad9d08b9a60e36a17a904c4037ed3a08.PY2GqN0Rlkr_uSYGEzH_HJsWpWWyFDnzCXJp1LvTH-Q
```

## jsonpasswordtoken.verify(token, secret, iv)

(Synchronous) Returns Object of verified `true` or `false` for whether a signature matches a
secret or iv.

`token` is a JPT Token.

Example

```js
const signature = jsonpasswordtoken.verify('d587f74978e9fc8bc25e47cd2b8d2e2b18fc9590b60935e25f997946036b1dbc4534d83474d4e690b236eda46a1dc9a2e5ab261b660795208a41b2e67fbd5b08ad9d08b9a60e36a17a904c4037ed3a08.PY2GqN0Rlkr_uSYGEzH_HJsWpWWyFDnzCXJp1LvTH-Q','testhmkiltyofgntghylqwertyuilmnv','absvuitlgrthifbr');

// Returns an object with two child properties, e.g.

// { decryptedData: { name: 'jsonpasswordtoken' }, verified: true }

```


## jsonpasswordtoken.encryptPass(secret,password)

Returns the encrypted password.

Example:

```js

const encryptedPassword = jsonpasswordtoken.encryptPass("test123456", "123456789");

```

## jsonpasswordtoken.verifyPass(secret,encryptedpassword,password)

Returns `true` or `false`

Example:

```js

const isVerifiedPassword = jsonpasswordtoken.verifyPass("test123456","dbd3c46e07b2eb78a7cca5ca0154b7872c490288c1c133f86840a4a848b04e34", "123456789");

```

# License

ISC

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