An open API service indexing awesome lists of open source software.

https://github.com/orbitdb/orbitdb-identity-provider-did

Create, sign and verify OrbitDB identities using Decentralized Identifiers (DIDs).
https://github.com/orbitdb/orbitdb-identity-provider-did

Last synced: 11 months ago
JSON representation

Create, sign and verify OrbitDB identities using Decentralized Identifiers (DIDs).

Awesome Lists containing this project

README

          

# OrbitDB DID Identity Provider



[![Matrix](https://img.shields.io/matrix/orbit-db:matrix.org?label=chat%20on%20matrix)](https://app.element.io/#/room/#orbit-db:matrix.org) [![npm (scoped)](https://img.shields.io/npm/v/%40orbitdb/identity-provider-did)](https://www.npmjs.com/package/%40orbitdb/identity-provider-did) [![node-current (scoped)](https://img.shields.io/node/v/%40orbitdb/identity-provider-did)](https://www.npmjs.com/package/%40orbitdb/identity-provider-did)

Create and sign OrbitDB identities using a Decentralized IDentifier (DID). See https://www.w3.org/TR/did-core/.

## Install

This project uses [npm](http://npmjs.com/) and [nodejs](https://nodejs.org/).

```sh
npm i @orbitdb/identity-provider-did
```

## Usage

Start by registering the OrbitDBIdentityProviderDID identity provider with [useIdentityProvider](https://api.orbitdb.org/module-Identities.html#.useIdentityProvider).

Once registered, you can simply pass in the identity provider when creating an OrbitDB instance:

```js
import { createHelia, libp2pDefaults } from 'helia'
import { createOrbitDB, useIdentityProvider } from '@orbitdb/core'
import * as OrbitDBIdentityProviderDID from '@orbitdb/identity-provider-did'
import KeyDidResolver from 'key-did-resolver'
import { Ed25519Provider } from 'key-did-provider-ed25519'

const libp2pOptions = libp2pDefaults()
const ipfs = await createHelia({ libp2p: libp2pOptions })

const seed = new Uint8Array(/* some private seed */)

OrbitDBIdentityProviderDID.setDIDResolver(KeyDidResolver.getResolver())
useIdentityProvider(OrbitDBIdentityProviderDID)
const didProvider = new Ed25519Provider(seed)
const provider = OrbitDBIdentityProviderDID({ didProvider })
await createOrbitDB({ ipfs, identity: { provider } })
```

If you require a more custom approach to managing identities, you can create an identity by passing the identity provider to [createIdentity](https://api.orbitdb.org/module-Identities-Identities.html#createIdentity) then use the resulting identity with OrbitDB:

```js
import { createHelia, libp2pDefaults } from 'helia'
import { createOrbitDB, Identities, useIdentityProvider } from '@orbitdb/core'
import OrbitDBIdentityProviderDID from '@orbitdb/identity-provider-did'
import KeyDidResolver from 'key-did-resolver'
import { Ed25519Provider } from 'key-did-provider-ed25519'

const libp2pOptions = libp2pDefaults()
const ipfs = await createHelia({ libp2p: libp2pOptions })

const seed = new Uint8Array(/* some private seed */)

OrbitDBIdentityProviderDID.setDIDResolver(KeyDidResolver.getResolver())
useIdentityProvider(OrbitDBIdentityProviderDID)

const didProvider = new Ed25519Provider(seed)

const identities = await Identities({ ipfs })
const identity = await identities.createIdentity({ provider: OrbitDBIdentityProviderDID({ didProvider }) })

await createOrbitDB({ ipfs, identities, identity })
```

## Contributing

**Take a look at our organization-wide [Contributing Guide](https://github.com/orbitdb/welcome/blob/master/contributing.md).** You'll find most of your questions answered there. Some questions may be answered in the [FAQ](FAQ.md), as well.

If you want to code but don't know where to start, check out the issues labelled ["help wanted"](https://github.com/orbitdb/orbitdb/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22+sort%3Areactions-%2B1-desc).

## License

[MIT](LICENSE) Haja Networks Oy, OrbitDB Community