Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async _determineAddress (name, type, options = {}) {
if (!OrbitDB.isValidType(type)) { throw new Error(`Invalid database type '${type}'`) }
if (OrbitDBAddress.isValid(name)) { throw new Error('Given database name is an address. Please give only the name of the database!') }
// Create an AccessController, use IPFS AC as the default
options.accessController = Object.assign({}, { name: name, type: 'ipfs' }, options.accessController)
const accessControllerAddress = await AccessControllers.create(this, options.accessController.type, options.accessController || {})
// Save the manifest to IPFS
const manifestHash = await createDBManifest(this._ipfs, name, type, accessControllerAddress, options)
// Create the database address
return OrbitDBAddress.parse(OrbitDBAddress.join(manifestHash, name))
}