Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/posquit0/node-identif
:key: Helper class to verify one's identity via personal channels(SMS, Phone, E-Mail and more!)
https://github.com/posquit0/node-identif
2fa authentication email email-verification identification identify identity phone sms sms-verification verification
Last synced: about 2 months ago
JSON representation
:key: Helper class to verify one's identity via personal channels(SMS, Phone, E-Mail and more!)
- Host: GitHub
- URL: https://github.com/posquit0/node-identif
- Owner: posquit0
- License: mit
- Created: 2017-04-22T16:00:01.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-05-30T04:09:43.000Z (over 4 years ago)
- Last Synced: 2024-05-12T06:42:01.529Z (8 months ago)
- Topics: 2fa, authentication, email, email-verification, identification, identify, identity, phone, sms, sms-verification, verification
- Language: JavaScript
- Homepage:
- Size: 105 KB
- Stars: 26
- Watchers: 3
- Forks: 3
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
A Helper to verify one's identity via personal channels
**Identif** is an abstract helper class to easily implement the identity verification logic via personal channels like SMS, Phone, E-Mail, and more.
- It was written for use on [**CARPLAT**](https://carplat.co.kr) which is the platform service for the car rental.
## Installation
[![Greenkeeper badge](https://badges.greenkeeper.io/posquit0/node-identif.svg)](https://greenkeeper.io/)
```bash
# NPM
$ npm install --save identif
# Yarn
$ yarn add identif
```### Dependencies
- [**Redis**](https://redis.io): if you use `RedisStore`, the connection to redis server is required.
## Usage
```node
const { Identif, RedisStore } = require('identif');// Create an instance of Identif with RedisStore
const identif = new Identif({
store: new RedisStore({
redis: { host: 'my.redis.com', port: 6379 },
ttl: 3 * 60
})
});// Request the verification
const { requestId, code, createdAt } = await identif.request();
/*
Output
{
requestId: 'e89c3600-6ac7-469e-8d7e-e6e7847b346d',
code: '1274',
createdAt: '2017-04-23T14:47:24.173Z'
}
*/// Respond to the client including `requestId`, `createdAt`
// Send `code` via a personal secure channel like SMS, E-Mail// Verify the request
const data = await identif.verify(requestId, code);
if (!data) {
// Failed to verify one's identity
} else {
// Verifed one's identity
}
```## API
### Identif([options])
#### Methods
* `request([extra])`
* `verify(requestId, code)`### MemoryStore()
#### Methods
* `get(key)`
* `set(key, data)`### RedisStore([options])
#### Methods
* `get(key)`
* `set(key, data)`## Contributing
This project follows the [**Contributor Covenant**](http://contributor-covenant.org/version/1/4/) Code of Conduct.
#### Bug Reports & Feature Requests
Please use the [issue tracker](https://github.com/posquit0/node-identif/issues) to report any bugs or ask feature requests.
## Self Promotion
Like node-identif? Follow the repository on [GitHub](https://github.com/posquit0/node-identif). And if you're feeling especially charitable, follow [posquit0](https://posquit0.com) on [GitHub](https://github.com/posquit0).
## Contact
If you have any questions, feel free to join me at [`#posquit0` on Freenode](irc://irc.freenode.net/posquit0) and ask away. Click [here](https://kiwiirc.com/client/irc.freenode.net/posquit0) to connect.
## License
Provided under the terms of the [MIT License](https://github.com/posquit0/node-identif/blob/master/LICENSE).
Copyright © 2017-2018, [Byungjin Park](http://www.posquit0.com).