async function createHyperdriveSession (opts) {
  if (opts.key) {
    let sessionKey = createSessionKey(opts)
    if (sessions[sessionKey]) return sessions[sessionKey]
  }

  const drive = await client.drive.get(opts)
  const key = opts.key = datEncoding.toStr(drive.key)
  var driveObj = {
    key: drive.key,
    discoveryKey: drive.discoveryKey,
    url: `hyper://${opts.domain || key}/`,
    writable: drive.writable,
    domain: opts.domain,
    persistSession: false,

    session: {
      drive,
      opts,
      async close () {
        delete sessions[key]
        return this.drive.close()
      }
    },

    async getInfo () {
      var version = await this.session.drive.version()
      return {version}
    },

    pda: createHyperdriveSessionPDA(drive)
  }
  var sessKey = createSessionKey(opts)
  logger.debug(`Opening drive-session ${sessKey}`)
  sessions[sessKey] = driveObj
  return /** @type DaemonHyperdrive */(driveObj)
}
Creates a hyperdrives interface to the daemon for the given key

@param {Object} opts
@param {Buffer} [opts.key]
@param {number} [opts.version]
@param {Buffer} [opts.hash]
@param {boolean} [opts.writable]
@param {String} [opts.domain]
@returns {Promise<DaemonHyperdrive>}