# simple-api-sign

> A simple-api-signature module

Latest version **1.0.2** (published 2022-02-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install simple-api-sign
pnpm add simple-api-sign
yarn add simple-api-sign
bun add simple-api-sign
```

## 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.2 |
| Published | 2022-02-20 |
| First published | 2022-02-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 3.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | pebm |
| Maintainers | pebm |
| Keywords | api sign, api signature, api, sign, signature |

## Links

- npm: https://www.npmjs.com/package/simple-api-sign
- npm.io page: https://npm.io/package/simple-api-sign

## Dependencies (1)

- [js-md5](https://npm.io/package/js-md5.md) ^0.7.3

## Recent versions

- 1.0.2 (latest) — 2022-02-20
- 1.0.1 — 2022-02-20
- 1.0.0 — 2022-02-20

## README

# simple-api-sign

![npm version](https://img.shields.io/badge/version-1.0.0-brightgreen)

Simple API sign is a simple implementation of API signature. It now includes JS and PHP versions with corresponding create and check methods.General projects can be used out of the box, but I do not guarantee the security of this method and the repair of future events.this module is very simple. You might as well look at the source code.Finally, I would like to thank the author of [js-md5](https://www.npmjs.com/package/js-md5).

## Others

The module also has PHP version and python version, which have the same implementation. See [github](https://github.com/pebm/simple-api-sign).


## Install

```
npm install simple-api-sign
```

## Usage

```javascript
const apiSign = require('simple-api-sign');

const token = 'xxx';

let data = {
    source: 'products',
    pk: 1003443,
    ext: [
        'sales',
        'pv',
        'uv'
    ]
};

// create sign of data
const signData = apiSign.create(data, token);

/** signData like this
 {
    source: 'products',
    pk: 1003443,
    ext: [
        'sales',
        'pv',
        'uv'
    ],
    timestamp: 1645253321,
    randstr: '2jfL#J#OjLD'
    _sign: 'D853EA4AD57F929E1A8A9FCD30ED8FD9'
}
 */

// check sign of signData
const isValid = apiSign.check(signData, token);

// ...your code
```

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