jwk_client.go
func (j *JWKClient) GetKey(ID string) (jose.JSONWebKey, error) {
	j.mu.Lock()
	defer j.mu.Unlock()

	searchedKey, err := j.keyCacher.Get(ID)
	if err != nil {
		keys, err := j.downloadKeys()
		if err != nil {
			return jose.JSONWebKey{}, err
		}
		addedKey, err := j.keyCacher.Add(ID, keys)
		if err != nil {
			return jose.JSONWebKey{}, err
		}
		return *addedKey, nil
	}

	return *searchedKey, nil
}
func (j *JWKClient) GetKey(ID string) (jose.JSONWebKey, error) {
	j.mu.Lock()
	defer j.mu.Unlock()

	searchedKey, err := j.keyCacher.Get(ID)
	if err != nil {
		keys, err := j.downloadKeys()
		if err != nil {
			return jose.JSONWebKey{}, err
		}
		addedKey, err := j.keyCacher.Add(ID, keys)
		if err != nil {
			return jose.JSONWebKey{}, err
		}
		return *addedKey, nil
	}

	return *searchedKey, nil
}
func ( j * JWKClient ) GetKey ( ID string ) ( jose . JSONWebKey , error ) { j . mu . Lock ( ) defer j . mu . Unlock ( ) searchedKey , err := j . keyCacher . Get ( ID ) if err != nil { keys , err := j . downloadKeys ( ) if err != nil { return jose . JSONWebKey { } , err } addedKey , err := j . keyCacher . Add ( ID , keys ) if err != nil { return jose . JSONWebKey { } , err } return * addedKey , nil } return * searchedKey , nil }
// GetKey returns the key associated with the provided ID.
GetKey returns the key associated with the provided ID .