New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@rx-frontend/php-sign

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rx-frontend/php-sign

用于与PHP端对接使用的接口参数(`json`或`form`)签名生成工具

latest
npmnpm
Version
0.4.3
Version published
Maintainers
1
Created
Source

PHP对接签名

用于与PHP端对接使用的接口参数(jsonform)签名生成工具

支持浏览器和uni小程序

使用

安装

pnpm i @rx-frontend/php-sign
yarn add @rx-frontend/php-sign
npm i @rx-frontend/php-sign

基本用法

import { sign } from '@rx-frontend/php-sign';

const SIGN_KEY = 'sepveneto';
sign.SIGN_KEY = SIGN_KEY;

const mock = { id: 1, name: 'vv' };
sign(mock)

可配置参数

名称类型必填默认值说明
SIGN_KEYstring-签名密钥
logboolean-是否需要在控制台输出md5加密前的结果
reserveFalseboolean-签名时是否保留false
reserveEmptyStringboolean-签名时是否保留空字符串
reserveNullboolean-签名时是否保留null
normalizeTruestring | number | boolean1签名时将true转换成其它内容

生成结果

除原始参数外,会额外附带随机字符串nonce和时间戳timestamp

{
  ...res,
  nonce: string,
  timestamp: string,
}

说明

  • 生成结果默认会带有timestampnonce,因此如果原始参数中带有timestampnonce会覆盖原始参数的内容
  • 如果需要添加签名的数据是表单类型,那么只有非Blob的值会参与签名,比如
const file = new File(['foo'], 'foo.txt', {
  type: 'text/plain',
})
const form = new FormData()
form.append('file', file)
form.append('name', 'sepveneto')

最终参与签名的字段是name,noncetimestamp

FAQs

Package last updated on 07 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts