# @3id/connect

> Account management for 3ID

Latest version **0.4.1** (published 2022-04-19) · (Apache-2.0 OR MIT) license · 0 weekly downloads

## Install

```sh
npm install @3id/connect
pnpm add @3id/connect
yarn add @3id/connect
bun add @3id/connect
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.4.1 |
| Published | 2022-04-19 |
| First published | 2021-04-16 |
| Weekly downloads | 0 |
| License | (Apache-2.0 OR MIT) |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=14.14 |
| Dependencies | 8 |
| Unpacked size | 12.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 104 |
| Author | 3Box Labs |
| Maintainers | paul_lecam, oed, zachferland |
| Keywords | ceramic, 3id, connect, did, provider, browser |

## Links

- npm: https://www.npmjs.com/package/@3id/connect
- Repository: https://github.com/ceramicstudio/js-3id
- Homepage: https://github.com/ceramicstudio/js-3id#readme
- Issues: https://github.com/ceramicstudio/js-3id/issues
- npm.io page: https://npm.io/package/@3id/connect

## Dependencies (8)

- [dids](https://npm.io/package/dids.md) ^3.0.0
- [rxjs](https://npm.io/package/rxjs.md) ^7.5.2
- [rpc-utils](https://npm.io/package/rpc-utils.md) ^0.6.1
- [@3id/common](https://npm.io/package/@3id/common.md) ^0.4.1
- [@3id/connect-display](https://npm.io/package/@3id/connect-display.md) ^0.4.1
- [@3id/window-auth-provider](https://npm.io/package/@3id/window-auth-provider.md) ^0.4.1
- [@ceramicnetwork/rpc-window](https://npm.io/package/@ceramicnetwork/rpc-window.md) ^0.6.0
- [@ceramicnetwork/blockchain-utils-linking](https://npm.io/package/@ceramicnetwork/blockchain-utils-linking.md) ^2.0.0

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 0.4.1 (latest) — 2022-04-19
- 0.4.1-rc.1 (next) — 2022-04-19
- 0.4.1-rc.0 — 2022-04-01
- 0.4.1-alpha.1 — 2022-03-28
- 0.4.1-alpha.0 — 2022-03-02
- 0.4.0-alpha.1 — 2022-03-02
- 0.2.5 — 2021-09-23
- 0.2.3 — 2021-09-15
- 0.2.2 — 2021-09-14
- 0.2.0 — 2021-08-31
- 0.1.6 — 2021-06-11
- 0.1.5 — 2021-06-09
- 0.1.4 — 2021-05-18
- 0.1.3 — 2021-05-10
- 0.1.2 — 2021-04-18
- … 1 more at https://npm.io/package/@3id/connect/versions

## README

# <a name="intro"></a> 3ID-Connect

3ID user account management in a iframe. An easy way to access a did provider, specifically [ThreeIdProvider](https://github.com/ceramicstudio/js-3id-did-provider) in the browser. It allows users to authenticate, manage, link and permission their 3ID keys to applications. The library [js-3id-did-provider](https://github.com/ceramicstudio/js-3id-did-provider) handles most operations and the parent window (application) communicates with the iframe service over an RPC layer. 3id-connect with Ceramic support is only available at 3id-connect@next and 3idconnect.org at the moment.

## <a name="use"></a> Use

```
npm install 3id-connect@next
```

Example usage with an ethereum provider and related auth provider.

```js
import { ThreeIdConnect, EthereumAuthProvider } from '@ceramicstudio/3id-connect'

// assuming ethereum provider available or on window
const addresses = await provider.enable()

const authProvider = new EthereumAuthProvider(provider, addresses[0])
await threeIdConnect.connect(authProvider)

const didProvider = await threeIdConnect.getDidProvider()

// now consume didProvider in ceramic clients, idx, dids libraries, etc
```

## <a name="structure"></a> Structure

- **/src** - Core logic and consumable interfaces for clients and iframe
  - **/threeIdConnect.ts** - Application interface (RPC client) to load iframe and return 3ID provider.
  - **/connectService.ts** - Identity wallet instance and RPC 'server' to handle requests
  - **/didProviderProxy.ts** - DID provider interface that relays request through RPC layer
  - **/authProvider** - 3ID connect (client) consumes an auth provider, auth providers can be implemented to support many different blockchain accounts and authentication methods
    - **/abstractAuthProvider.ts** - Interface used to implement a auth provider
    - **/ethereumAuthProvider.ts** - Ethereum auth provider, to link and authenticate with ethereum accounts
- **/iframe** - all html, css, js, design assets for iframe and flow
- **../public** - build assets deployed for iframe

## <a name="development"></a> Development

Clone and install dependencies

#### Run Iframe Locally

```
$ npm run start
```

The iframe will be served locally on port 30001. The iframe service also requires a Ceramic node, by default it will look for a locally running node. The quickest way to run a node is with the Ceramic CLI.

```
$ npm install -g @ceramicnetwork/cli
& ceramic daemon
```

You can also run the iframe and connect to a remote testnet Ceramic node.

```
$ npm run start:testnet
```

And lastly connect the iframe to any Ceramic node.

```
$ CERAMIC_API=https://yourceramicnode:port npm run start
```

#### Run Demo

The Demo application is served on port 30000, and connects to a locally running iframe, as described above. Demo application is found in the `/example` folder.

```
$ npm run start:demo
```

You can also pass the same options to the local iframe with similar commands.

```
$ npm run start:demo:testnet
// or
$ CERAMIC_API=https://yourceramicnode:port npm run start:demo
```

#### Build

```
$ npm run build
```

## Maintainers

[@zachferland](https://github.com/zachferland)

---
_Source: https://npm.io/package/@3id/connect · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
