New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bin-gateway

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bin-gateway

Binary Gateway Front End SDK

  • 0.0.1
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

二进制网关

前端二进制网关是一套通用代理,基于封装后的Protocol Buffer消息协议,主要解决前端开发中面临的如下诸多问题:

  1. 数据安全问题

    为了解决网络数据被劫持修改,爬虫抓取等问题:网关的所有消息交互都以protobuf二进制格式编码,在同时protobuf的基础上做了二次封装和压缩,没有任何工具或软件可以轻易解码,数据安全得到充分的保障

  2. CORS跨域问题

    只要在网关的白名单(需要设置)之内,自动处理所有的跨域问题,一劳永逸的解决众多后端业务新域名所导致的跨域问题

  3. Cookie问题

    全新浏览器针对Cookie的各种安全升级,如SameSite引入、跨域Credentials设置等,已经导致了无数的Bug类似:

    • Cookie毫无征兆的失效
    • 服务端明明已经下发了Cookie,请求时无法携带
    • 无法下发Cookie到指定域
    • ...

特色

  1. 强大无比的跨域能力,浏览器原生的网络请求都是受限于同源安全模型的,如XMLHttpRequestfetch图片跨域等,本网关提供的网络请求API是原生fetch的一个子集,兼容于原生fetch,但是却提供了WEB原生网络请求所不具备的超强跨域能力,如:

    • 你可以在网页上用网关的API在WEB上写爬虫程序,爬取其他站点的内容
    • 你可以在网页上通过网关的API,实现原来必须要借助服务器才能请求的API,如微信小程序的登录凭证API:auth.code2Session
  2. 远超jsonxml数据格式的编解码性能:

    关于protobuf的编解码性能,网络上有很多文章,请自行查阅

  3. 非破坏兼容性:

    • 由于网关以中间层的形式提供,在接收到前端小消息后会自动将消息解码为原来的数据格式,所以不需要原来的服务器逻辑做任何代码上的变更
    • 由于网关API签名尽可能的兼容于fetch,前端也几乎不需要做什么代码变更,只需要引入对应的库而已

Keywords

FAQs

Package last updated on 25 Feb 2022

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