npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

edge-core-js

v2.20.2

Published

Edge account & wallet management library

Downloads

2,111

Readme

Edge Core

This library implements the Edge login system. It runs inside a client application, and provides zero-knowledge backup for cryptographic keys and other secrets via a familiar password-based login system.

Build Status JavaScript Style Guide code style: prettier

Documentation

We have documentation at https://developer.airbitz.co/javascript/, but our Flow types are the best, most up-to-date reference for what this library contains.

Account Management UI

To quickly get up and running with the UI for account creation, login, and management, use edge-login-ui-web for the web or edge-login-ui-rn for React Native.

Setup

Add this library to your project using npm install --save edge-core-js.

Node.js & Browsers

To create an EdgeContext object, which provides various methods for logging in and creating account, do something like this:

const context = await makeEdgeContext({
  apiKey: '...', // Get this from our support team
  appId: 'com.your-app',
  plugins: {
    // Configure currencies, exchange rates, and swap providers you want to use:
    'bitcoin': true
  }
})

The core uses various plugins to provide its currency, exchange rate, and swap features. These plugins ship separately, and are designed to load in parallel with the core:

import { addEdgeCorePlugins, lockEdgeCorePlugins } from 'edge-core-js'
import exchangePlugins from 'edge-exchange-plugins'
import bitcoinPlugins from 'edge-currency-bitcoin'
import currencyPlugins from 'edge-currency-accountbased'

addEdgeCorePlugins(exchangePlugins)
addEdgeCorePlugins(bitcoinPlugins)
addEdgeCorePlugins(currencyPlugins)
lockEdgeCorePlugins()

If the core seems to hang forever when logging in, you probably forgot to call lockEdgeCorePlugins.

Please note that edge-core-js uses modern JavaScript syntax features such as async, so you may need to run the library through Babel if you plan to run it in a browser. Node 10+ supports these features natively.

React Native

Edge-core-js directly supports React Native v0.60+ with autolinking. Simply add edge-core-js to your application, and React Native will link the necessary native modules & assets.

To create an EdgeContext object, you need to mount a component:

<MakeEdgeContext
  // Get this from our support team:
  apiKey="..."
  appId="com.your-app"

  // Configure currencies and swap providers you want to use:
  plugins={{
    'bitcoin': true
  }}
  pluginUris={[
    "edge-currency-plugins.js",
    "edge-exchange-plugins.js"
  ]}

  // Called when the core is done loading:
  onLoad={edgeContext => {}}
  onError={error => {}}
/>

The core itself runs inside a hidden WebView, which this MakeEdgeContext component mounts & manages.

The core creates a <script> tag for each source file in the pluginUris array. For this to work, you need to add these plugin files to your app's native asset bundle, which is located at /android/app/src/main/assets/ on Android. For iOS, drag these files into the "Resources" section of your Xcode project.

To debug the core, run yarn start inside the edge-core-js project, and then pass a debug={true} property to the MakeEdgeContext component. This tells the WebView to load the core from a local development server.

Contributing

Run yarn to download dependencies, and then run yarn prepare to build the library.

Use yarn verify to run all our code-quality tools. All sources are in the JavaScript Standard Style + Prettier. We check files prior to each commit, so if you have formatting issues, you can run yarn fix to fix them automatically.

If you use Visual Studio Code, consider installing the ESLint extension. This will give you nice error highlighting as you work, along with quick fixes for formatting issues.