How to use the orbit-db-identity-provider.addIdentityProvider function in orbit-db-identity-provider

To help you get started, we’ve selected a few orbit-db-identity-provider examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github orbitdb / orbit-core / src / Orbit.js View on Github external
'use strict'

const path = require('path')
const EventEmitter = require('events').EventEmitter
const OrbitDB = require('orbit-db')
const Logger = require('logplease')

const Identities = require('orbit-db-identity-provider')
const MetamaskIdentityProvider = require('./IdentityProviders/purser-metamask-identity-provider')

Identities.addIdentityProvider(MetamaskIdentityProvider)

const OrbitUser = require('./orbit-user')

const Channel = require('./Channel')

const logger = Logger.create('Orbit', { color: Logger.Colors.Green })

Logger.setLogLevel(
  process.env.NODE_ENV === 'development' ? Logger.LogLevels.DEBUG : Logger.LogLevels.ERROR
)

const getAppPath = () =>
  process.type && process.env.ENV !== 'dev' ? process.resourcesPath + '/app/' : process.cwd()

const defaultOptions = {
  dbOptions: {
github 3box / 3box-js / src / __mocks__ / 3ID.js View on Github external
const didJWT = require('did-jwt')
const Identities = require('orbit-db-identity-provider')
const { OdbIdentityProvider } = require('3box-orbitdb-plugins')
Identities.addIdentityProvider(OdbIdentityProvider)

const pubKey = '044f5c08e2150b618264c4794d99a22238bf60f1133a7f563e74fcf55ddb16748159872687a613545c65567d2b7a4d4e3ac03763e1d9a5fcfe512a371faa48a781'
const privKey = '95838ece1ac686bde68823b21ce9f564bc536eebb9c3500fa6da81f17086a6be'

const didResolverMock = async (did) => {
  return {
    '@context': 'https://w3id.org/did/v1',
    'id': did,
    'publicKey': [{
      'id': `${did}#signingKey`,
      'type': 'Secp256k1VerificationKey2018',
      'publicKeyHex': pubKey
    }],
    'authentication': [{
      'type': 'Secp256k1SignatureAuthentication2018',
      'publicKey': `${did}#signingKey`
github 3box / 3box-js / src / 3id / index.js View on Github external
const { mnemonicToSeed, entropyToMnemonic } = require('@ethersproject/hdnode')
const EventEmitter = require('events')
const didJWT = require('did-jwt')
const DidDocument = require('ipfs-did-document')
const IpfsMini = require('ipfs-mini')
const localstorage = require('store')
const Identities = require('orbit-db-identity-provider')
const { OdbIdentityProvider } = require('3box-orbitdb-plugins')
Identities.addIdentityProvider(OdbIdentityProvider)
const utils = require('../utils/index')
const Keyring = require('./keyring')
const config = require('../config.js')

const DID_METHOD_NAME = '3'
const STORAGE_KEY = 'serialized3id_'
const MUPORT_IPFS = { host: config.muport_ipfs_host, port: config.muport_ipfs_port, protocol: config.muport_ipfs_protocol}
const POLL_INTERVAL = 500

class ThreeId {
  constructor (provider, ipfs, opts = {}) {
    this.events = new EventEmitter()
    this._provider = provider
    this._has3idProv = Boolean(opts.has3idProv)
    this._ipfs = ipfs
    this._muportIpfs = opts.muportIpfs || MUPORT_IPFS

orbit-db-identity-provider

Default identity provider for OrbitDB

MIT
Latest version published 2 years ago

Package Health Score

45 / 100
Full package analysis