UNPKG
qiniu-auth
Version:
latest (1.0.3)
1.0.3
1.0.2
1.0.1
1.0.0
为七牛云操作提供加密支持
github.com/SunGg12138/qiniu-auth
qiniu-auth
/
lib
/
hmac_sha1.js
12 lines
(11 loc)
•
297 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
const
crypto =
require
(
'crypto'
);
/** * HMAC-SHA1签名 * 官方文档:https://developer.qiniu.com/linking/glossary/5287/linking-hmac-sha1 */
module
.
exports
=
function
(
key, str
){
const
hmac = crypto.
createHmac
(
'sha1'
, key); hmac.
update
(str);
let
sign = hmac.
digest
();
return
sign; };