Merge pull request #8 from haydenyoung/refactor/identity-store

refactor: Move identity store to identities subpath.
This commit is contained in:
Hayden Young 2023-02-16 21:49:36 +08:00 committed by GitHub
commit 18b81aadcc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 7 deletions

View File

@ -4,7 +4,7 @@ import OrbitDBIdentityProvider from './providers/orbitdb.js'
// import DIDIdentityProvider from './identity-providers/did.js'
// import EthIdentityProvider from './identity-providers/ethereum.js'
import KeyStore from '../key-store.js'
import IdentityStorage from '../storage/identity.js'
import IdentityStore from './identity-store.js'
import LRU from 'lru'
import path from 'path'
@ -140,11 +140,11 @@ class Identities {
let identityStore
if (options.storage) {
identityStore = await IdentityStorage({ storage: options.storage })
identityStore = await IdentityStore({ storage: options.storage })
} else if (options.ipfs) {
identityStore = await IdentityStorage({ ipfs: options.ipfs })
identityStore = await IdentityStore({ ipfs: options.ipfs })
} else {
identityStore = await IdentityStorage()
identityStore = await IdentityStore()
}
options = Object.assign({}, { type: defaultType, identityStore }, options)

View File

@ -8,7 +8,7 @@ import * as Block from 'multiformats/block'
const codec = dagCbor
const hasher = sha256
const IdentityStorage = async ({ ipfs, storage } = {}) => {
const IdentityStore = async ({ ipfs, storage } = {}) => {
storage = storage || (ipfs
? await IPFSBlockStorage({ ipfs, pin: true })
: await MemoryStorage())
@ -35,4 +35,4 @@ const IdentityStorage = async ({ ipfs, storage } = {}) => {
}
}
export default IdentityStorage
export default IdentityStore

View File

@ -1,5 +1,4 @@
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 LevelStorage } from './level.js'
export { default as LRUStorage } from './lru.js'