Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
before(async () => {
rmrf.sync(ipfsConfig1.repo)
rmrf.sync(ipfsConfig2.repo)
rmrf.sync(identityKeysPath)
rmrf.sync(signingKeysPath)
await fs.copy(identityKeyFixtures, identityKeysPath)
await fs.copy(signingKeyFixtures, signingKeysPath)
// Start two IPFS instances
ipfs1 = await startIpfs(IPFS, ipfsConfig1)
ipfs2 = await startIpfs(IPFS, ipfsConfig2)
await connectPeers(ipfs1, ipfs2)
// Get the peer IDs
id1 = await getIpfsPeerId(ipfs1)
id2 = await getIpfsPeerId(ipfs2)
// Use mem-store for faster testing (no disk IO)
const memstore = new MemStore()
ipfs1.dag.put = memstore.put.bind(memstore)
ipfs1.dag.get = memstore.get.bind(memstore)
ipfs2.dag.put = memstore.put.bind(memstore)
ipfs2.dag.get = memstore.get.bind(memstore)
keystore = new Keystore(identityKeysPath)
signingKeystore = new Keystore(signingKeysPath)
before(async () => {
rmrf.sync(ipfsConfig1.repo)
rmrf.sync(ipfsConfig2.repo)
rmrf.sync(identityKeysPath)
rmrf.sync(signingKeysPath)
await fs.copy(identityKeyFixtures, identityKeysPath)
await fs.copy(signingKeyFixtures, signingKeysPath)
// Start two IPFS instances
ipfs1 = await startIpfs(IPFS, ipfsConfig1)
ipfs2 = await startIpfs(IPFS, ipfsConfig2)
await connectPeers(ipfs1, ipfs2)
// Get the peer IDs
id1 = await getIpfsPeerId(ipfs1)
id2 = await getIpfsPeerId(ipfs2)
// Use mem-store for faster testing (no disk IO)
const memstore = new MemStore()
ipfs1.dag.put = memstore.put.bind(memstore)
ipfs1.dag.get = memstore.get.bind(memstore)
ipfs2.dag.put = memstore.put.bind(memstore)
ipfs2.dag.get = memstore.get.bind(memstore)
keystore = new Keystore(identityKeysPath)
before(async () => {
rmrf.sync(ipfsConfig.repo)
rmrf.sync(identityKeysPath)
rmrf.sync(signingKeysPath)
await fs.copy(identityKeyFixtures, identityKeysPath)
await fs.copy(signingKeyFixtures, signingKeysPath)
keystore = new Keystore(identityKeysPath)
signingKeystore = new Keystore(signingKeysPath)
testIdentity = await IdentityProvider.createIdentity({ id: 'userA', keystore, signingKeystore })
ipfs = await startIpfs(IPFS, ipfsConfig)
})
before(async () => {
identityStore = await storage.createStore('identity')
const keystore = new Keystore(identityStore)
cacheStore = await storage.createStore('cache')
const cache = new Cache(cacheStore)
testIdentity = await IdentityProvider.createIdentity({ id: 'userA', keystore })
ipfs = await startIpfs(IPFS, ipfsConfig)
const address = 'test-address'
const options = Object.assign({}, DefaultOptions, { cache })
store = new Store(ipfs, testIdentity, address, options)
})
before(async () => {
rmrf.sync(ipfsConfig.repo)
rmrf.sync(identityKeysPath)
rmrf.sync(signingKeysPath)
await fs.copy(identityKeyFixtures, identityKeysPath)
await fs.copy(signingKeyFixtures, signingKeysPath)
testIdentity = await IdentityProvider.createIdentity({ id: 'userA', identityKeysPath, signingKeysPath })
ipfs = await startIpfs(IPFS, ipfsConfig)
})
before(async () => {
rmrf.sync(ipfsConfig.repo)
rmrf.sync(identityKeysPath)
rmrf.sync(signingKeysPath)
await fs.copy(identityKeyFixtures, identityKeysPath)
await fs.copy(signingKeyFixtures, signingKeysPath)
keystore = new Keystore(identityKeysPath)
signingKeystore = new Keystore(signingKeysPath)
testIdentity = await IdentityProvider.createIdentity({ id: 'userA', keystore, signingKeystore })
testIdentity2 = await IdentityProvider.createIdentity({ id: 'userB', keystore, signingKeystore })
testIdentity3 = await IdentityProvider.createIdentity({ id: 'userC', keystore, signingKeystore })
ipfs = await startIpfs(IPFS, ipfsConfig)
})
before(async () => {
rmrf.sync(ipfsConfig.repo)
rmrf.sync(identityKeysPath)
rmrf.sync(signingKeysPath)
await fs.copy(identityKeyFixtures, identityKeysPath)
await fs.copy(signingKeyFixtures, signingKeysPath)
keystore = new Keystore(identityKeysPath)
signingKeystore = new Keystore(signingKeysPath)
testIdentity = await IdentityProvider.createIdentity({ id: 'userA', keystore, signingKeystore })
ipfs = await startIpfs(IPFS, ipfsConfig)
})
before(async () => {
rmrf.sync(ipfsConfig.repo)
rmrf.sync(identityKeysPath)
rmrf.sync(signingKeysPath)
await fs.copy(identityKeyFixtures, identityKeysPath)
await fs.copy(signingKeyFixtures, signingKeysPath)
keystore = new Keystore(identityKeysPath)
signingKeystore = new Keystore(signingKeysPath)
testIdentity = await IdentityProvider.createIdentity({ id: 'userA', keystore, signingKeystore })
testIdentity2 = await IdentityProvider.createIdentity({ id: 'userB', keystore, signingKeystore })
testIdentity3 = await IdentityProvider.createIdentity({ id: 'userC', keystore, signingKeystore })
ipfs = await startIpfs(IPFS, ipfsConfig)
})
before(async () => {
rmrf.sync(ipfsConfig.repo)
rmrf.sync(identityKeysPath)
rmrf.sync(signingKeysPath)
await fs.copy(identityKeyFixtures, identityKeysPath)
await fs.copy(signingKeyFixtures, signingKeysPath)
keystore = new Keystore(identityKeysPath)
signingKeystore = new Keystore(signingKeysPath)
testIdentity = await IdentityProvider.createIdentity({ id: 'userA', keystore, signingKeystore })
testIdentity2 = await IdentityProvider.createIdentity({ id: 'userB', keystore, signingKeystore })
ipfs = await startIpfs(IPFS, ipfsConfig)
})
before(async () => {
rmrf.sync(ipfsConfig.repo)
rmrf.sync(identityKeysPath)
rmrf.sync(signingKeysPath)
await fs.copy(identityKeyFixtures, identityKeysPath)
await fs.copy(signingKeyFixtures, signingKeysPath)
keystore = new Keystore(identityKeysPath)
signingKeystore = new Keystore(signingKeysPath)
testIdentity = await IdentityProvider.createIdentity({ id: 'userC', keystore, signingKeystore })
testIdentity2 = await IdentityProvider.createIdentity({ id: 'userB', keystore, signingKeystore })
testIdentity3 = await IdentityProvider.createIdentity({ id: 'userD', keystore, signingKeystore })
testIdentity4 = await IdentityProvider.createIdentity({ id: 'userA', keystore, signingKeystore })
ipfs = await startIpfs(IPFS, ipfsConfig)
})