check-sign-fbmc-light
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

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);
})();

Readme

Keywords

Package Sidebar

Install

npm i check-sign-fbmc-light

Weekly Downloads

2

Version

1.0.2

License

ISC

Unpacked Size

23.6 kB

Total Files

11

Last publish

Collaborators

  • allfornaruto