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

fxa-pairing-channel

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fxa-pairing-channel

TLS for FxA Pairing

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
158
increased by23.44%
Maintainers
1
Weekly downloads
 
Created
Source

fxa-pairing-channel CircleCI

This repo implements a shared library for two javascript environments to create an encrypted and authenticated communication channel, by sharing a secret key and by relaying messages through a websocket server.

It will be used by the Firefox Accounts pairing flow, with one side of the channel being web content from https://accounts.firefox.com and the other side of the channel being a signed-in Firefox instance.

API

The main abstraction is the PairingChannel class. One side of the connection can create a new channel like this:

const channel = await PairingChannel.create(CHANNEL_SERVER_URL);
console.log(channel.channelId, channel.channelKey);

The channelId and channelKey then need to be transferred to the intended client, perhaps by scanning a QR code. It can then connect to the channel like this:

const channel = await PairingChannel.connect(CHANNEL_SERVER_URL, channelId, channelKey);

Both ends of the channel can then send and receive messages using a websocket-like interface:

channel.send("ping")

channel.addEventListener("message", event => {
  const {msg} = event.detail.data;
  console.log(msg); // "pong"
}

You can try out a more complete demo of this API by loading ./demo/test_client.html and ./demo/test_server.html in parallel webpages and watching them pass messages back and forth.

Crypto

Under the hood, the PairingChannel implements the "externally-provisioned pre-shared key" mode of TLS1.3. Each side of the channel can thus be assured that its peer is in posession of the channelKey, and that their traffic is protected from anyone who does not possess this key.

FAQs

Package last updated on 25 Feb 2019

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