code: func (s *Serf) writeKeyringFile() error {
  	if len(s.config.KeyringFile) == 0 {
  		return nil
  	}
  
  	keyring := s.config.MemberlistConfig.Keyring
  	keysRaw := keyring.GetKeys()
  	keysEncoded := make([]string, len(keysRaw))
  
  	for i, key := range keysRaw {
  		keysEncoded[i] = base64.StdEncoding.EncodeToString(key)
  	}
  
  	encodedKeys, err := json.MarshalIndent(keysEncoded, "", "  ")
  	if err != nil {
  		return fmt.Errorf("Failed to encode keys: %s", err)
  	}
  
  	// Use 0600 for permissions because key data is sensitive
  	if err = ioutil.WriteFile(s.config.KeyringFile, encodedKeys, 0600); err != nil {
  		return fmt.Errorf("Failed to write keyring file: %s", err)
  	}
  
  	// Success!
  	return nil
  }
docs: // WriteKeyringFile will serialize the current keyring and save it to a file.