     if Q.isPromiseAlike api.AuthImpl.matchPassword
       api.AuthImpl.matchPassword passwordHash, password
     else
-      Q.nfcall api.AuthImpl.matchPassword, passwordHash, password
+      Q.ninvoke api.AuthImpl, 'matchPassword', passwordHash, password
 
   matchPassword = (passwordHash, password, callback) ->
     deferred = Q.defer()


  _encodePassword =
    scrypt: (password) ->
      Q.nfcall(scrypt.passwordHash, password, config.scrypt.maxtime)

  _encodePasswordPromise = (password) ->
    if Q.isPromiseAlike api.AuthImpl.encodePassword
      api.AuthImpl.encodePassword password
    else
      Q.nfcall api.AuthImpl.encodePassword, password

  encodePassword = (password, callback) ->
    if api.AuthImpl and api.AuthImpl.encodePassword

    if Q.isPromiseAlike api.AuthImpl.findUser
      api.AuthImpl.findUser login
    else
      Q.ninvoke api.AuthImpl, 'findUser', login

  _jwtPayloadPromise = (user) ->
    if Q.isPromiseAlike api.AuthImpl.jwtPayload
      api.AuthImpl.jwtPayload user
    else
      Q.ninvoke api.AuthImpl, 'jwtPayload', user

  signIn = (login, password, callback) ->
    deferred = Q.defer()
