https://github.com/orbitdb/orbitdb-identity-provider-ethereum
Provides creation and signing of identities using an Ethereum wallet.
https://github.com/orbitdb/orbitdb-identity-provider-ethereum
Last synced: 8 months ago
JSON representation
Provides creation and signing of identities using an Ethereum wallet.
- Host: GitHub
- URL: https://github.com/orbitdb/orbitdb-identity-provider-ethereum
- Owner: orbitdb
- License: mit
- Created: 2023-07-09T21:20:36.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2025-03-03T21:48:59.000Z (over 1 year ago)
- Last Synced: 2025-04-09T07:39:51.661Z (about 1 year ago)
- Language: JavaScript
- Size: 781 KB
- Stars: 5
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# OrbitDB Ethereum Identity Provider
[](https://app.element.io/#/room/#orbit-db:matrix.org) [](https://www.npmjs.com/package/%40orbitdb/identity-provider-ethereum) [](https://www.npmjs.com/package/@orbitdb/identity-provider-ethereum)
Create and sign OrbitDB identities using an Ethereum wallet.
## Install
This project uses [npm](http://npmjs.com/) and [nodejs](https://nodejs.org/).
```sh
npm i @orbitdb/identity-provider-ethereum
```
## Usage
Start by registering the OrbitDBIdentityProviderEthereum 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 { createOrbitDB, useIdentityProvider } from '@orbitdb/core'
import * as OrbitDBIdentityProviderEthereum from '@orbitdb/identity-provider-ethereum'
import { Wallet } from '@ethersproject/wallet'
const wallet = Wallet.createRandom()
useIdentityProvider(OrbitDBIdentityProviderEthereum)
const provider = OrbitDBIdentityProviderEthereum({ wallet })
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 * as OrbitDBIdentityProviderEthereum from '@orbitdb/identity-provider-ethereum'
const libp2pOptions = libp2pDefaults()
const ipfs = await createHelia({ libp2p: libp2pOptions })
useIdentityProvider(OrbitDBIdentityProviderEthereum)
const provider = OrbitDBIdentityProviderEthereum({ wallet })
const identities = await Identities({ ipfs })
const identity = await identities.createIdentity({ id: 'userA', provider })
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