docs: function login( usr, pwd ) {
      if ( typeof usr === 'undefined' ) usr = config.usr || '';
      if ( typeof pwd === 'undefined' ) pwd = config.pwd || '';
  
      return new Promise(
          function( resolve, reject ) {
              if ( typeof usr === 'undefined' ) {
                  var autologin = Storage.local.get( "nigolotua" );
                  if ( !Array.isArray( autologin ) ) return reject( {
                      id: exports.MISSING_AUTOLOGIN
                  } );
                  usr = autologin[ 0 ] || '';
                  pwd = autologin[ 1 ] || '';
              }
              Storage.local.set( "nigolotua", null );
              svc( "tfw.login.Challenge", usr )
                  .then(
                      function( code ) {
                          // Hashage du mot de passe à l'aide du code.
                          var output = [
                                  0, 0, 0, 0,
                                  0, 0, 0, 0,
                                  0, 0, 0, 0,
                                  0, 0, 0, 0
                              ],
                              i, j = 0,
                              pass = [],
                              k1, k2, k3;
                          for ( i = 0; i < pwd.length; i++ ) {
                              pass.push( pwd.charCodeAt( i ) );
                          }
                          if ( 256 % pass.length == 0 ) {
                              pass.push( 0 );
                          }
  
                          for ( i = 0; i < 256; i++ ) {
                              output[ i % 16 ] ^= i + pass[ i % pass.length ];
                              k1 = code[ j++ % code.length ] % 16;
                              k2 = code[ j++ % code.length ] % 16;
                              k3 = code[ j++ % code.length ] % 16;
                              output[ k3 ] ^= ( output[ k3 ] + 16 * k2 + k3 ) % 256;
                              output[ k2 ] ^= ( output[ k1 ] + output[ k3 ] ) % 256;
                          }
                          return svc( "tfw.login.Response", output );
                      },
                      reject
                  )
                  .then(
                      function( user ) {
                          if ( typeof user === 'object' ) {
                              currentUser = {
                                  data: user,
                                  hasRole: function( role ) {
                                      for ( var i = 0; i < user.roles.length; i++ ) {
                                          var item = user.roles[ i ];
                                          if ( item == role ) return true;
                                      }
                                      return false;
                                  }
                              };
                              Storage.local.set( "nigolotua", [ usr, pwd ] );
                              exports.eventChange.fire();
                              resolve( user );
                          } else {
                              currentUser = null;
                              reject( {
                                  id: exports.UNKNOWN_USER,
                                  err: "Unknown user '" + usr + "'!"
                              } );
                          }
                      },
                      reject
                  );
          }
      );
  }