Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eldoy/apilock
Check if API key is valid based on encrypted timestamp
https://github.com/eldoy/apilock
Last synced: 6 days ago
JSON representation
Check if API key is valid based on encrypted timestamp
- Host: GitHub
- URL: https://github.com/eldoy/apilock
- Owner: eldoy
- Created: 2020-01-11T22:27:15.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-01-11T22:38:29.000Z (almost 5 years ago)
- Last Synced: 2024-11-07T01:04:13.244Z (8 days ago)
- Language: JavaScript
- Size: 42 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# API Lock
Time stamped API key decrypter and checker.### Install
```bash
npm i apilock
```### Usage
```javascript
// Create password and salt
const password = '5dbac068-f55f-4ccb-862d-8753fe341e09'
const salt = 'fc96256c-b16c-4e66-862c-ce4c0ea5be1e'// Encrypt key based on today's date
const wcrypt = require('wcrypt')
const locker = wcrypt({ password, salt })
const time = new Date().getTime().toString()
const key = await locker.encrypt(time)// Check if it's invalid
const apilock = require('apilock')(password, salt)
const invalid = await apilock(key)
```
MIT Licensed. Enjoy!