0.3.3 • Published 3 years ago

@dabit3/decentralized-identity v0.3.3

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

npm.io

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.

0.3.3

3 years ago

0.3.1

3 years ago

0.3.0

3 years ago

0.2.3

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.9

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago