Skip to content

Commit

Permalink
fix: Lint errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
haydenyoung committed May 26, 2024
1 parent eae36c1 commit 43b1a39
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions src/lib/commands/daemon.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Orbiter from '../orbiter.js'
import { Access } from './authentication.js'

export default async (argv) => {
const options = {}
Expand Down
12 changes: 6 additions & 6 deletions src/lib/commands/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import { orbiter, controller, orbiterPath, controllerPath } from '../utils/id.js

export default async (argv) => {
const id = orbiter

const directory = orbiterPath(argv.directory)
const path = join(directory, 'keystore')
const keystore = await KeyStore({ path })
const identities = await Identities({ keystore })
const identity = await identities.createIdentity({ id })
await identities.createIdentity({ id })

const blockstore = new LevelBlockstore(join(directory, 'ipfs', 'blocks'))
const datastore = new LevelDatastore(join(directory, 'ipfs', 'data'))
Expand All @@ -25,19 +25,19 @@ export default async (argv) => {
const orbitdb = await createOrbitDB({ ipfs, directory, identities, id })

const addresses = libp2p.getMultiaddrs()

const controllerPubKey = await initController({ addresses, rootDir: argv.directory })

const config = await orbitdb.open('config', { type: 'keyvalue' })
await config.put('controller-pubkey', controllerPubKey)
await orbitdb.stop()

return { addresses }
}

const initController = async ({ addresses, rootDir }) => {
const id = controller

const directory = controllerPath(rootDir)
const path = join(directory, 'keystore')
const keystore = await KeyStore({ path })
Expand Down
5 changes: 3 additions & 2 deletions src/lib/controller/handlers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const handleControllerRequest = (orbiter) => source => {
const { auth, orbitdb } = orbiter

const config = await orbitdb.open('config', { type: 'keyvalue' })
const controllerPubKey = await config.get('controller-pubkey')
const controllerPubKey = await config.get('controller-pubkey')
await config.close()

// check that the user is authorized to store their dbs on this orbiter.
Expand All @@ -36,10 +36,11 @@ export const handleControllerRequest = (orbiter) => source => {
await handleAuthDelRequest({ auth, addresses })
response = createResponseMessage(Responses.OK)
break
case ControllerRequests.AUTH_LIST:
case ControllerRequests.AUTH_LIST: {
const list = await handleAuthListRequest({ auth })
response = createResponseMessage(Responses.OK, list)
break
}
default:
throw Object.assign(new Error(`unknown message type ${type}`), { type: Responses.E_INTERNAL_ERROR })
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/orbiter.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default async ({ directory, verbose, defaultAccess } = {}) => {
if (verbose > 0) {
enable('orbitdb:voyager:orbiter' + (verbose > 1 ? '*' : ':error'))
}

log('app:', app)
log('id:', id)
log('directory:', directory)
Expand Down
1 change: 0 additions & 1 deletion src/lib/utils/id.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@ export const controllerPath = (rootDir) => {
rootDir = rootDir || '.'
return join(rootDir, app, controller)
}

0 comments on commit 43b1a39

Please sign in to comment.