Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@jswork/next-fanyi-api-sign

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jswork/next-fanyi-api-sign

Get baidu translate api sign.

  • 1.0.0
  • npm
  • Socket score

Version published
Weekly downloads
6
increased by200%
Maintainers
1
Weekly downloads
 
Created
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.

Keywords

FAQs

Package last updated on 22 Nov 2020

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc