func (c *cache) Get(s Schlosser, u, f string, k int) (string, error) {
	if k == 0 {
		k = 1
	}
	var (
		uKey string
		hash string
	)
	if !isURL.MatchString(u) {
		uKey = fmt.Sprintf("%s/%s.%d", c.dir, u, k)
	} else {
		hash = fmt.Sprintf("%x", md5.Sum([]byte(u)))
		uKey = fmt.Sprintf("%s/%s.%d", c.dir, hash, k)
	}
	if !c.IsFile(uKey) || u == "new" {
		keys, err := s.GetKey(u)
		if err != nil {
			return "", err
		}
		if isURL.MatchString(u) {
			u = hash
		}
		for k, v := range keys {
			err = ioutil.WriteFile(fmt.Sprintf("%s/%s.%d", c.dir, u, k+1),
				[]byte(v),
				0644)
			if err != nil {
				log.Println(err)
			}
		}
		if !c.IsFile(uKey) {
			return "", fmt.Errorf("key index not found, try -k with a value between 1 and %d", len(keys))
		}
	}
	if f != "" {
		key, err := c.FindFingerprint(uKey, f)
		if err != nil {
			return "", err
		}
		return key, nil
	}
	return uKey, nil
}
Get return ssh-key
package sshvault
import (
	"crypto/md5"
	"encoding/pem"
	"fmt"
	"io/ioutil"
	"log"
	"os"
	"os/user"
	"path/filepath"
	"strings"
	"github.com/ssh-vault/ssh2pem"
)
type cache struct {
	dir string
}
func Cache() *cache {
	d := os.Getenv("SSH_VAULT_CACHE_DIR")
	if d == "" {
		home := os.Getenv("HOME")
		if home == "" {
			usr, _ := user.Current()
			home = usr.HomeDir
		}
		d = filepath.Join(home, ".ssh", "vault", "keys")
	}
	if _, err := os.Stat(d); os.IsNotExist(err) {
		if err := os.MkdirAll(d, os.ModePerm); err != nil {
			log.Fatal(err)
		}
	}
	return &cache{d}
}