1.0.2 • Published 4 years ago

check-sign-fbmc-light v1.0.2

Weekly downloads
3
License
ISC
Repository
github
Last release
4 years ago

check-sign-fbmc-light

使用Hmac-MD5对请求和相应增加签名、验签

客户端使用方法

import { CheckSignFbmcClient } from "check-sign-fbmc-light";

(async function(){
	const secret = `123456`;
	const client = new CheckSignFbmcClient(secret, { debug: true });
	const request = { a: "1" };
	const requestWithSign = client.addSignToRequest(request);
	const responseWithSign = await axios.post("/api", requestWithSign);

	const clientCheckSignResult = client.checkSign(responseWithSign);
})();

服务端使用方法

import { CheckSignFbmcServer } from "check-sign-fbmc-light";

(async function(requestWithSign){
	const secret = `123456`;
	const server = new CheckSignFbmcServer(secret, { debug: true });
	const serverCheckSignResult = server.checkSign(requestWithSign);
	const response = { a: "1" };
	const responseWithSign = server.addSignToResponse(response);
})();
1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago