code: func (c *Cluster) UnlockSwarm(req types.UnlockRequest) error {
  	c.controlMutex.Lock()
  	defer c.controlMutex.Unlock()
  
  	c.mu.RLock()
  	state := c.currentNodeState()
  
  	if !state.IsActiveManager() {
  		// when manager is not active,
  		// unless it is locked, otherwise return error.
  		if err := c.errNoManager(state); err != errSwarmLocked {
  			c.mu.RUnlock()
  			return err
  		}
  	} else {
  		// when manager is active, return an error of "not locked"
  		c.mu.RUnlock()
  		return notLockedError{}
  	}
  
  	// only when swarm is locked, code running reaches here
  	nr := c.nr
  	c.mu.RUnlock()
  
  	key, err := encryption.ParseHumanReadableKey(req.UnlockKey)
  	if err != nil {
  		return errdefs.InvalidParameter(err)
  	}
  
  	config := nr.config
  	config.lockKey = key
  	if err := nr.Stop(); err != nil {
  		return err
  	}
  	nr, err = c.newNodeRunner(config)
  	if err != nil {
  		return err
  	}
  
  	c.mu.Lock()
  	c.nr = nr
  	c.mu.Unlock()
  
  	if err := <-nr.Ready(); err != nil {
  		if errors.Cause(err) == errSwarmLocked {
  			return invalidUnlockKey{}
  		}
  		return errors.Errorf("swarm component could not be started: %v", err)
  	}
  	return nil
  }
docs: // UnlockSwarm provides a key to decrypt data that is encrypted at rest.