// Get a per-user key.
// Wait for attempt but only warn on error.
421654
func (e *Login) perUserKeyUpgradeSoft(m libkb.MetaContext) error {
	eng := NewPerUserKeyUpgrade(m.G(), &PerUserKeyUpgradeArgs{})
	err := RunEngine2(m, eng)
	if err != nil {
		m.Warning("loginProvision PerUserKeyUpgrade failed: %v", err)
	}
	return err
}
1274506
func (c *consulClient) Get(key string) ([]byte, error) {
	duration := spanstat.Start()
	pair, _, err := c.KV().Get(key, nil)
	increaseMetric(key, metricRead, "Get", duration.EndError(err).Total(), err)
	if err != nil {
		return nil, err
	}
	if pair == nil {
		return nil, nil
	}
	return pair.Value, nil
}
710500
func (c *Client) GetUser(userID string) (*User, error) {
	uri := fmt.Sprintf("/1/users/%s", userID)
	resp, err := c.doSimple("GET", uri)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()
	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return nil, err
	}
	c.trace("GetUser", uri, string(body))
	var user *User
	// TODO(tmc): warn if not == .Zero() before populating?
	return user, json.Unmarshal(body, &user)
}
876099
func (km *KeyManager) Get(k Key) KeyState {
	km.mutex.RLock()
	ks := km.mapper[k]
	km.mutex.RUnlock()

	return ks
}
856520
func (api UsersAPI) GetKeyStoreKey(w http.ResponseWriter, r *http.Request) {
	username := mux.Vars(r)["username"]
	globalid := context.Get(r, "client_id").(string)
	label := mux.Vars(r)["label"]

	mgr := keystore.NewManager(r)

	key, err := mgr.GetKeyStoreKey(username, globalid, label)
	if db.IsNotFound(err) {
		http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
		return
	}
	if err != nil {
		log.Error("Failed to get keystore key: ", err)
		http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
		return
	}

	w.Header().Set("Content-Type", "application/json")
	json.NewEncoder(w).Encode(key)
}
1151112
func (h *prioritizedHandler) Get(key string, args ...interface{}) (interface{}, error) {
	switch length := len(args); length {
	case 0:
		return h.byPosition.Get(key)
	default:
		return h.byName.Get(key, args...)
	}
}
1183157
func GetKeyHandler(ctx context.Context, w http.ResponseWriter, r *http.Request) error {
	defer r.Body.Close()
	vars := mux.Vars(r)
	return getKeyHandler(ctx, w, r, vars)
}
482707
func (mk *MemKeystore) Get(name string) (ci.PrivKey, error) {
	if err := validateName(name); err != nil {
		return nil, err
	}

	k, ok := mk.keys[name]
	if !ok {
		return nil, ErrNoSuchKey
	}

	return k, nil
}
126838
func (a *LocalKeyAgent) GetKey() (*Key, error) {
	return a.keyStore.GetKey(a.proxyHost, a.username)
}
540913
func (k windowsKeychain) Get(service, username string) (string, error) {
	cred, err := wincred.GetGenericCredential(k.credName(service, username))
	if err != nil {
		if err.Error() == errNotFound {
			return "", ErrNotFound
		}
		return "", err
	}

	return string(cred.CredentialBlob), nil
}
959307
func (r *Redis) Get(key string) (string, error) {
	return r.Client.Get(key).Result()
}
285393
func (a *API) GetUserByLogin(login string) (*User, error) {
	users, err := a.FindUsers(fmt.Sprintf("login eq \"%s\"", login))
	if err != nil {
		return nil, err
	}

	if len(users) == 0 {
		return nil, ErrNotFound
	}

	if len(users) > 1 {
		return nil, fmt.Errorf("login %q matched too many users. please contact nimbusec.", login)
	}

	return &users[0], nil
}
424636
func (a *AuthServer) GetUser(name string) (user services.User, err error) {
	return a.GetCache().GetUser(name)
}
595925
func (lud *LdapUserData) Get() *querypb.VTGateCallerID {
	if int64(time.Since(lud.lastUpdated).Seconds()) > lud.asl.RefreshSeconds {
		go lud.update()
	}
	return &querypb.VTGateCallerID{Username: lud.username, Groups: lud.groups}
}
719381
func (k macOSXKeychain) Get(service, username string) (string, error) {
	out, err := exec.Command(
		execPathKeychain,
		"find-generic-password",
		"-s", service,
		"-wa", username).CombinedOutput()
	if err != nil {
		if strings.Contains(fmt.Sprintf("%s", out), "could not be found") {
			err = ErrNotFound
		}
		return "", err
	}
	// if the added secret has multiple lines, osx will hex encode it
	trimStr := strings.TrimSpace(string(out[:]))
	dec, err := hex.DecodeString(trimStr)
	// if there was an error hex decoding the string, assume it's not encoded
	if err != nil {
		return fmt.Sprintf("%s", trimStr), nil
	}
	return fmt.Sprintf("%s", dec), err
}
1334476
func (c *Cache) Get(key string) (resp []byte, ok bool) {
	item, err := memcache.Get(c.Context, cacheKey(key))
	if err != nil {
		if err != memcache.ErrCacheMiss {
			c.Context.Errorf("error getting cached response: %v", err)
		}
		return nil, false
	}
	return item.Value, true
}
831277
func (p *Secring) Get(id string) *PrivateKey {
	p.Lock()
	defer p.Unlock()

	xpk := p.fetch(id)
	if xpk == nil {
		return nil
	}

	return secPBToKR(xpk)
}