diff --git a/src/lib/libp2p/config.js b/src/lib/libp2p/config.js index 609cb7e..31116cc 100644 --- a/src/lib/libp2p/config.js +++ b/src/lib/libp2p/config.js @@ -7,9 +7,13 @@ import { createFromPrivKey } from '@libp2p/peer-id-factory' import { unmarshalPrivateKey } from '@libp2p/crypto/keys' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' -const encoded = uint8ArrayFromString(process.env.PRIVATE_KEY, 'hex') -const privateKey = await unmarshalPrivateKey(encoded) -const peerId = await createFromPrivKey(privateKey) +let peerId + +if (process.env.PRIVATE_KEY) { + const encoded = uint8ArrayFromString(process.env.PRIVATE_KEY, 'hex') + const privateKey = await unmarshalPrivateKey(encoded) + peerId = await createFromPrivKey(privateKey) +} export default { peerId, diff --git a/test/authorization.test.js b/test/authorization.test.js index 83a0d8d..d6182dc 100644 --- a/test/authorization.test.js +++ b/test/authorization.test.js @@ -12,7 +12,7 @@ describe('Authorization', function () { after(async function () { await orbiter.stop() - await rimraf('./orbiter') + await rimraf('./voyager') }) it('defaults access to deny all', function () { diff --git a/test/messages.test.js b/test/messages.test.js index e235f0e..2041c8a 100644 --- a/test/messages.test.js +++ b/test/messages.test.js @@ -36,7 +36,7 @@ describe('Messages', function () { await lander.orbitdb.stop() await lander.orbitdb.ipfs.stop() await rimraf('./lander') - await rimraf('./orbiter') + await rimraf('./voyager') }) it('pins a database with OK response', async function () { diff --git a/test/pin.test.js b/test/pin.test.js index ea682be..fa8ae28 100644 --- a/test/pin.test.js +++ b/test/pin.test.js @@ -18,7 +18,7 @@ describe('Pin', function () { afterEach(async function () { await orbiter.stop() - await rimraf('./orbiter') + await rimraf('./voyager') }) describe('Single Transient Peer', function () { @@ -37,14 +37,14 @@ describe('Pin', function () { }) it('pins a database', async function () { - const { pinned, dbs } = await createPins(1, lander, orbiter) + const { pinned, dbs } = await createPins(1, lander) strictEqual(pinned, true) strictEqual(Object.values(orbiter.dbs).pop().address, dbs.pop().address) }) it('pins multiple databases', async function () { - const { pinned, dbs } = await createPins(2, lander, orbiter) + const { pinned, dbs } = await createPins(2, lander) strictEqual(pinned, true) strictEqual(Object.values(orbiter.dbs)[0].address, dbs[0].address) @@ -84,8 +84,8 @@ describe('Pin', function () { }) it('pins a database', async function () { - const { dbs: dbs1 } = await createPins(1, lander1, orbiter) - const { dbs: dbs2 } = await createPins(1, lander2, orbiter) + const { dbs: dbs1 } = await createPins(1, lander1) + const { dbs: dbs2 } = await createPins(1, lander2) strictEqual(Object.values(orbiter.dbs)[0].address, dbs1.pop().address) strictEqual(Object.values(orbiter.dbs)[1].address, dbs2.pop().address) diff --git a/test/unpin.test.js b/test/unpin.test.js index 1520a9d..9d48e80 100644 --- a/test/unpin.test.js +++ b/test/unpin.test.js @@ -18,7 +18,7 @@ describe('Unpin', function () { afterEach(async function () { await orbiter.stop() - await rimraf('./orbiter') + await rimraf('./voyager') }) describe('Single Transient Peer', function () { @@ -37,7 +37,7 @@ describe('Unpin', function () { }) it('unpins a database', async function () { - const { dbs } = await createPins(1, lander, orbiter) + const { dbs } = await createPins(1, lander) const unpinned = await lander.unpin(dbs) @@ -47,7 +47,7 @@ describe('Unpin', function () { }) it('unpins multiple databases', async function () { - const { dbs } = await createPins(2, lander, orbiter) + const { dbs } = await createPins(2, lander) const unpinned = await lander.unpin(dbs) @@ -57,7 +57,7 @@ describe('Unpin', function () { }) it('unpins a database when multiple databases have been pinned', async function () { - const { dbs } = await createPins(2, lander, orbiter) + const { dbs } = await createPins(2, lander) const unpinned = await lander.unpin(dbs.slice(0, 1))