Socket
Book a DemoInstallSign in
Socket

@dabit3/decentralized-identity

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dabit3/decentralized-identity

Authentication provider with Ceramic and IDX

latest
npmnpm
Version
0.3.3
Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Decentralized Identity (alpha)

Single Sign-On with an Ethereum wallet (for now, other blockchains in the future)

Decentralized identity using Ceramic, IDX, and DIDs.

Learn more about IDX:

Installation

npm install @dabit3/decentralized-identity

Usage

Reading records

// uses basicProfile schema by default
const { record } = await getRecord()

console.log('Default user profile: ', record)

Reading records with a custom IDX schema

const { record } = await getRecord({ schema: 'mySchema' })

Default arguments to getRecord:

endpoint: string = "https://ceramic-clay.3boxlabs.com",
network: string = 'ethereum',
ceramicClient: CeramicClient = null,
schema: string = 'basicProfile'

Creating an authenticated client

import { client } from @dabit3/connectidx

const {
  ceramic, did, idx, error
} = await client()

/*
  Congrats!! You are now authenticated 🥳
*/

// reading profile
const data = await idx.get('basicProfile', did.id)

// writing to profile
const profile = {
  name: "Nader Dabit",
  bio: "DevRel at Edge & Node",
  twitter: "dabit3"
}

await idx.set('basicProfile', profile)

Default arguments to client:

endpoint: string = "https://ceramic-clay.3boxlabs.com",
resolvers:[] = null,
address: string = '',
provider: EthereumProfiver = null,
ceramicClient: CeramicClient = null

Creating a read only client

import { readOnlyClient } from @dabit3/connectidx

const { idx, ceramic } = await readOnlyClient()

const addresses = await ethereum.request({ method: 'eth_requestAccounts' })
const address = addresses[0]

const profile = await idx.get('basicProfile', `${address}@eip155:1`)

Default arguments to readOnlyClient:

endpoint: string = "https://ceramic-clay.3boxlabs.com",
ceramicClient: CeramicClient = null,

Example project

Example project

Check out the example project.

FAQs

Package last updated on 15 Jun 2021

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