Exemplo n.º 1
0
// ParseTLF takes keybase paths like
//
//     /keybase/public/patrick,chris
//     /keybase/private/patrick,maxtaco@twitter
//     public/patrick,jack
//     /public/patrick,chris,sam
//
// and creates suitable folders with the name portion and the
// private flag set correctly.
func ParseTLF(path string) (keybase1.Folder, error) {
	dir, name := filepath.Split(path)

	var f keybase1.Folder

	// get the last element of the directory, which should be public or private
	acc := filepath.Base(dir)
	switch acc {
	case "public":
		f.Private = false
	case "private":
		f.Private = true
	default:
		return f, fmt.Errorf("folder path needs to contain public or private subdirectory")
	}

	f.Name = name
	return f, nil
}
Exemplo n.º 2
0
func (c memoryFavoriteClient) FavoriteDelete(folder keybase1.Folder) error {
	delete(c.favorites, folder.ToString())
	return nil
}
Exemplo n.º 3
0
func (c memoryFavoriteClient) FavoriteAdd(folder keybase1.Folder) error {
	c.favorites[folder.ToString()] = folder
	return nil
}