Socket
Socket
Sign inDemoInstall

@jswork/next-fanyi-api-sign

Package Overview
Dependencies
4
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @jswork/next-fanyi-api-sign

Get baidu translate api sign.


Version published
0
Maintainers
1
Install size
40.1 kB
Created
Weekly downloads
 

Readme

Source

next-fanyi-api-sign

Get baidu translate api sign.

version license size download

installation

npm install -S @jswork/next-fanyi-api-sign

usage

const options = { q: 'pear' };
const res = nx.fanyiApiSign(options);
const url = `http://api.fanyi.baidu.com/api/trans/vip/translate?from=en&to=zh&${nx.param(res)}`;

fetch(url)
  .then((response) => response.json())
  .then((response) => {
    expect(response).toEqual({
      from: 'en',
      to: 'zh',
      trans_result: [{ src: 'pear', dst: '梨' }]
    });
  });

descriptions

  1. 拼接字符串1
    1. appid=2015063000000001
    2. q=apple
    3. salt=1435660288
    4. 密钥=12345678
    5. 得到字符串1:“2015063000000001apple143566028812345678”
  2. 计算签名:(对字符串1做md5加密)
    1. sign=md5(2015063000000001apple143566028812345678)
    2. sign=f89f9594663708c1605f3d736d01d2d4

resources

license

Code released under the MIT license.

FAQs

Last updated on 17 May 2023

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc