Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bakaoh/zpi-ifind
https://github.com/bakaoh/zpi-ifind
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/bakaoh/zpi-ifind
- Owner: bakaoh
- License: mit
- Created: 2019-04-22T04:25:13.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-05-17T10:41:25.000Z (over 5 years ago)
- Last Synced: 2024-11-09T12:41:15.102Z (about 1 month ago)
- Language: JavaScript
- Size: 31.3 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ZPI IFIND
[![Build Status](https://travis-ci.org/bakaoh/zpi-ifind.svg?branch=master)](https://travis-ci.org/bakaoh/zpi-ifind) [![npm version](https://badge.fury.io/js/zpi-ifind.svg)](https://badge.fury.io/js/zpi-ifind) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
## Usage
1. Install package
```bash
$ npm i zpi-ifind
```2. Generate key
```node
const { generateKey } = require('zpi-ifind');
generateKey('ifind.private.pem', 'ifind.public.pem');
```3. Exchange public key file with zpi
4. Get data from query param `d`
```node
let data = req.query.d;
```5. Decrypt and verify data to get user info
```node
const {
loadPrivateKey,
loadPublicKey,
decryptAndVerify
} = require('zpi-ifind');const ifindPrivate = loadPrivateKey('ifind.private.pem');
const zpiPublic = loadPublicKey('zpi.public.pem');const message = decryptAndVerify(
data,
ifindPrivate,
zpiPublic
);
```