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).
- Host: GitHub
- URL: https://github.com/orbitdb/orbitdb-identity-provider-did
- Owner: orbitdb
- License: mit
- Created: 2023-07-10T11:56:31.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2025-03-03T21:44:56.000Z (over 1 year ago)
- Last Synced: 2025-05-17T13:47:19.622Z (about 1 year ago)
- Language: JavaScript
- Size: 1.77 MB
- Stars: 6
- Watchers: 4
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# OrbitDB DID Identity Provider
[](https://app.element.io/#/room/#orbit-db:matrix.org) [](https://www.npmjs.com/package/%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