Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/you21979/node-simple-verify
GENERATE SECRET AND HMAC VERIFY
https://github.com/you21979/node-simple-verify
Last synced: 3 days ago
JSON representation
GENERATE SECRET AND HMAC VERIFY
- Host: GitHub
- URL: https://github.com/you21979/node-simple-verify
- Owner: you21979
- License: mit
- Created: 2016-05-31T06:36:29.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-08-15T06:45:02.000Z (about 8 years ago)
- Last Synced: 2024-10-29T21:21:29.443Z (14 days ago)
- Language: JavaScript
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# simple-verify
* GENERATE SECRET AND HMAC VERIFY
## install
```
npm i @you21979/simple-verify
```## usage
### create Key and Secret
```
var verify = require('@you21979/simple-verify')
verify.createKeyPair().then(function(res){
// result data save
console.log(res)
})
```### sign and verify
```
var verify = require('@you21979/simple-verify')
var argo = 'sha256'
var pair = {
key: '6b47121a-cfd5-4875-8345-da7517730afa',
secret: 'b4d31b0d9be238da31a3fdb2afccd31d803341810c66d82d8b5ca53f35d41609'
}var data = JSON.stringify({
key : pair.key,
message : "test desu",
nonce : new Date().getTime(),
})var signdata = verify.sign(argo, pair.secret, data)
if(verify.check(argo, signdata, pair.secret, data)){
console.log("check ok");
}else{
console.log("check ng");
}
```