code: function formatOpts(opts) {
    opts = opts || {};
    // key
    opts.key = opts.key || 'koa:sess';
  
    // back-compat maxage
    if (!('maxAge' in opts)) opts.maxAge = opts.maxage;
  
    // defaults
    if (opts.overwrite == null) opts.overwrite = true;
    if (opts.httpOnly == null) opts.httpOnly = true;
    if (opts.signed == null) opts.signed = true;
  
    debug('session options %j', opts);
  
    // setup encoding/decoding
    if (typeof opts.encode !== 'function') {
      opts.encode = util.encode;
    }
    if (typeof opts.decode !== 'function') {
      opts.decode = util.decode;
    }
  
    const store = opts.store;
    if (store) {
      assert(is.function(store.get), 'store.get must be function');
      assert(is.function(store.set), 'store.set must be function');
      assert(is.function(store.destroy), 'store.destroy must be function');
    }
  
    const ContextStore = opts.ContextStore;
    if (ContextStore) {
      assert(is.class(ContextStore), 'ContextStore must be a class');
      assert(is.function(ContextStore.prototype.get), 'ContextStore.prototype.get must be function');
      assert(is.function(ContextStore.prototype.set), 'ContextStore.prototype.set must be function');
      assert(is.function(ContextStore.prototype.destroy), 'ContextStore.prototype.destroy must be function');
    }
  
    if (!opts.genid) {
      if (opts.prefix) opts.genid = () => opts.prefix + uid.sync(24);
      else opts.genid = () => uid.sync(24);
    }
  
    return opts;
  }
docs: format and check session options
  @param  {Object} opts session options
  @return {Object} new session options
  
  @api private