js-3id
js-3id copied to clipboard
Authentication system for Ceramic apps that works with blockchain wallets.
3ID-Connect
3ID Connect provides 3ID user account management in a iframe, an easy way to access a DID provider, specifically ThreeIdProvider in the browser. It allows users to authenticate, manage, link and permission their 3ID keys to applications.
The library js-3id-did-provider handles most operations and the parent window (application) communicates with the iframe service over an RPC layer.
Getting started
Installation
npm install @3id/connect
Basic usage
import { EthereumAuthProvider, ThreeIdConnect } from '@3id/connect'
// ethProvider is an Ethereum provider and addresses an array of strings
const authProvider = new EthereumAuthProvider(ethProvider, addresses[0])
const threeIdConnect = new ThreeIdConnect()
await threeIdConnect.connect(authProvider)
See the example app for more details
Developement
Prerequisites
yarn v1 and lerna v4 should be installed globally:
npm install -g lerna yarn
Installation
Run yarn install
from the root folder, this will install the dependencies and build the packages
Scripts
In the root folder:
-
lint
: lints all apps and packages -
build
: builds all packages -
test:unit
: runs unit test -
test:management
: runs integration tests for the management lib with a Ceramic server -
test:integration
: runs integration tests from the integration app with a Ceramic server
Folders
Packages
-
@3id/common
: Common types and utilities used by packages -
@3id/connect
: 3ID Connect library -
@3id/connect-display
: 3ID Connect popup prompts -
@3id/manager
: 3ID accounts storage and management -
@3id/test-utils
: Testing utilities for apps and packages -
@3id/window-auth-provider
: cross-window AuthProvider
Apps
-
example
: Example usage of 3ID Connect with Ceramic and IDX -
iframe
: 3ID Connect iframe logic and UI -
integration
: 3ID Connect integration tests -
management
: 3ID accounts management UI used by 3ID Connect
Others
-
public
: build assets for 3idconnect.org
Licenses
- Apache-2.0 OR MIT for published packages
- UIs used by 3ID Connect may use dependencies under other licenses