@15ms/secure 中文文档教程
15ms-secure
15ms 服务器和客户端的安全实用程序。
Usage
npm install --save @15ms/secure
const Secure = require('@15ms/secure');
const secure = new Secure({
secret: 'your-15ms-server-secret',
maxage: 30 * 1000
});
// create hash at client
const data = { 'your': 'data' };
const hash = secure.createHMAC(data);
// verify hash at server
const { data, hash } = request;
if (secure.verifyHMAC(data, hash)) {
// do something
}
15ms-secure
The secure utility for 15ms server and client.
Usage
npm install --save @15ms/secure
const Secure = require('@15ms/secure');
const secure = new Secure({
secret: 'your-15ms-server-secret',
maxage: 30 * 1000
});
// create hash at client
const data = { 'your': 'data' };
const hash = secure.createHMAC(data);
// verify hash at server
const { data, hash } = request;
if (secure.verifyHMAC(data, hash)) {
// do something
}