code: function delegate(id, method, options) {
    if (typeof openpgp[method] !== 'function') {
      response({ id:id, event:'method-return', err:'Unknown Worker Event' });
      return;
    }
    // construct ReadableStreams from MessagePorts
    openpgp.util.restoreStreams(options);
    // parse cloned packets
    options = openpgp.packet.clone.parseClonedPackets(options, method);
    openpgp[method](options).then(function(data) {
      // clone packets (for web worker structured cloning algorithm)
      response({ id:id, event:'method-return', data:openpgp.packet.clone.clonePackets(data) });
    }).catch(function(e) {
      openpgp.util.print_debug_error(e);
      response({
        id:id, event:'method-return', err:e.message, stack:e.stack
      });
    });
  }
docs: Generic proxy function that handles all commands from the public api.
  @param  {String} method    The public api function to be delegated to the worker thread
  @param  {Object} options   The api function's options