       links
       callbacks
     }
+
+  .catch (err) =>
+    @emit 'debug', "Authentication failed"
+
+    mungeCallbacks callbacks, 1
+
+    proto.handle {
+      method: 'kite.echo'
+      arguments: [err, responseCallback]
+      links
+      callbacks
+    }

handleAuth = require './auth/auth.coffee'

module.exports = (proto, message) ->


  if args.length > 0
    [{ withArgs, responseCallback, kite, authentication: auth }] = args

  if !withArgs? and !responseCallback?
    @emit 'debug', "Handling a normal dnode message"
    return proto.handle req

  @emit 'debug', "Authenticating request"

  handleAuth(method, auth, @key).then (token) =>
    @emit 'debug', "Authentication passed"

    withArgs ?= []

    withArgs = [withArgs]  unless Array.isArray withArgs

    mungeCallbacks callbacks, withArgs.length

    proto.handle {
      method
