mirror of
https://github.com/orbitdb/orbitdb.git
synced 2025-03-30 15:08:28 +00:00
Merge pull request #8 from haydenyoung/refactor/identity-store
refactor: Move identity store to identities subpath.
This commit is contained in:
commit
18b81aadcc
@ -4,7 +4,7 @@ import OrbitDBIdentityProvider from './providers/orbitdb.js'
|
|||||||
// import DIDIdentityProvider from './identity-providers/did.js'
|
// import DIDIdentityProvider from './identity-providers/did.js'
|
||||||
// import EthIdentityProvider from './identity-providers/ethereum.js'
|
// import EthIdentityProvider from './identity-providers/ethereum.js'
|
||||||
import KeyStore from '../key-store.js'
|
import KeyStore from '../key-store.js'
|
||||||
import IdentityStorage from '../storage/identity.js'
|
import IdentityStore from './identity-store.js'
|
||||||
import LRU from 'lru'
|
import LRU from 'lru'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
|
||||||
@ -140,11 +140,11 @@ class Identities {
|
|||||||
|
|
||||||
let identityStore
|
let identityStore
|
||||||
if (options.storage) {
|
if (options.storage) {
|
||||||
identityStore = await IdentityStorage({ storage: options.storage })
|
identityStore = await IdentityStore({ storage: options.storage })
|
||||||
} else if (options.ipfs) {
|
} else if (options.ipfs) {
|
||||||
identityStore = await IdentityStorage({ ipfs: options.ipfs })
|
identityStore = await IdentityStore({ ipfs: options.ipfs })
|
||||||
} else {
|
} else {
|
||||||
identityStore = await IdentityStorage()
|
identityStore = await IdentityStore()
|
||||||
}
|
}
|
||||||
|
|
||||||
options = Object.assign({}, { type: defaultType, identityStore }, options)
|
options = Object.assign({}, { type: defaultType, identityStore }, options)
|
||||||
|
@ -8,7 +8,7 @@ import * as Block from 'multiformats/block'
|
|||||||
const codec = dagCbor
|
const codec = dagCbor
|
||||||
const hasher = sha256
|
const hasher = sha256
|
||||||
|
|
||||||
const IdentityStorage = async ({ ipfs, storage } = {}) => {
|
const IdentityStore = async ({ ipfs, storage } = {}) => {
|
||||||
storage = storage || (ipfs
|
storage = storage || (ipfs
|
||||||
? await IPFSBlockStorage({ ipfs, pin: true })
|
? await IPFSBlockStorage({ ipfs, pin: true })
|
||||||
: await MemoryStorage())
|
: await MemoryStorage())
|
||||||
@ -35,4 +35,4 @@ const IdentityStorage = async ({ ipfs, storage } = {}) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default IdentityStorage
|
export default IdentityStore
|
@ -1,5 +1,4 @@
|
|||||||
export { default as ComposedStorage } from './composed.js'
|
export { default as ComposedStorage } from './composed.js'
|
||||||
export { default as IdentityStorage } from './identity.js'
|
|
||||||
export { default as IPFSBlockStorage } from './ipfs-block.js'
|
export { default as IPFSBlockStorage } from './ipfs-block.js'
|
||||||
export { default as LevelStorage } from './level.js'
|
export { default as LevelStorage } from './level.js'
|
||||||
export { default as LRUStorage } from './lru.js'
|
export { default as LRUStorage } from './lru.js'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user